3fc5a8873bdac7eef364c6993f5083fd8085f767
[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 arr_of_J_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         arr_of_J_clz = (*env)->FindClass(env, "[J");
78         CHECK(arr_of_J_clz != NULL);
79         arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_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 LDKCOption_NoneZ LDKCOption_NoneZ_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 COption_NoneZ.ordinal() from rust threw an exception.");
143         }
144         switch (ord) {
145                 case 0: return LDKCOption_NoneZ_Some;
146                 case 1: return LDKCOption_NoneZ_None;
147         }
148         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
149         abort(); // Unreachable, but will let the compiler know we don't return here
150 }
151 static jclass COption_NoneZ_class = NULL;
152 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
153 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
154 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
155         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
156         CHECK(COption_NoneZ_class != NULL);
157         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
158         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
159         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
160         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
161 }
162 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
163         switch (val) {
164                 case LDKCOption_NoneZ_Some:
165                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
166                 case LDKCOption_NoneZ_None:
167                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
168                 default: abort();
169         }
170 }
171
172 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
173         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
174         if (UNLIKELY((*env)->ExceptionCheck(env))) {
175                 (*env)->ExceptionDescribe(env);
176                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
177         }
178         switch (ord) {
179                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
180                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
181                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
182         }
183         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
184         abort(); // Unreachable, but will let the compiler know we don't return here
185 }
186 static jclass ChannelMonitorUpdateStatus_class = NULL;
187 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
188 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
189 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure = NULL;
190 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
191         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
192         CHECK(ChannelMonitorUpdateStatus_class != NULL);
193         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
194         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
195         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
196         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
197         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
198         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure != NULL);
199 }
200 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
201         switch (val) {
202                 case LDKChannelMonitorUpdateStatus_Completed:
203                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
204                 case LDKChannelMonitorUpdateStatus_InProgress:
205                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
206                 case LDKChannelMonitorUpdateStatus_PermanentFailure:
207                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure);
208                 default: abort();
209         }
210 }
211
212 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
213         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
214         if (UNLIKELY((*env)->ExceptionCheck(env))) {
215                 (*env)->ExceptionDescribe(env);
216                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
217         }
218         switch (ord) {
219                 case 0: return LDKConfirmationTarget_Background;
220                 case 1: return LDKConfirmationTarget_Normal;
221                 case 2: return LDKConfirmationTarget_HighPriority;
222         }
223         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
224         abort(); // Unreachable, but will let the compiler know we don't return here
225 }
226 static jclass ConfirmationTarget_class = NULL;
227 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
228 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
229 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
230 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
231         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
232         CHECK(ConfirmationTarget_class != NULL);
233         ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
234         CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
235         ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
236         CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
237         ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
238         CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
239 }
240 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
241         switch (val) {
242                 case LDKConfirmationTarget_Background:
243                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
244                 case LDKConfirmationTarget_Normal:
245                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
246                 case LDKConfirmationTarget_HighPriority:
247                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
248                 default: abort();
249         }
250 }
251
252 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
253         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
254         if (UNLIKELY((*env)->ExceptionCheck(env))) {
255                 (*env)->ExceptionDescribe(env);
256                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
257         }
258         switch (ord) {
259                 case 0: return LDKCreationError_DescriptionTooLong;
260                 case 1: return LDKCreationError_RouteTooLong;
261                 case 2: return LDKCreationError_TimestampOutOfBounds;
262                 case 3: return LDKCreationError_InvalidAmount;
263                 case 4: return LDKCreationError_MissingRouteHints;
264                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
265         }
266         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
267         abort(); // Unreachable, but will let the compiler know we don't return here
268 }
269 static jclass CreationError_class = NULL;
270 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
271 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
272 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
273 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
274 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
275 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
276 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
277         CreationError_class = (*env)->NewGlobalRef(env, clz);
278         CHECK(CreationError_class != NULL);
279         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
280         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
281         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
282         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
283         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
284         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
285         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
286         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
287         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
288         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
289         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
290         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
291 }
292 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
293         switch (val) {
294                 case LDKCreationError_DescriptionTooLong:
295                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
296                 case LDKCreationError_RouteTooLong:
297                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
298                 case LDKCreationError_TimestampOutOfBounds:
299                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
300                 case LDKCreationError_InvalidAmount:
301                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
302                 case LDKCreationError_MissingRouteHints:
303                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
304                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
305                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
306                 default: abort();
307         }
308 }
309
310 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
311         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
312         if (UNLIKELY((*env)->ExceptionCheck(env))) {
313                 (*env)->ExceptionDescribe(env);
314                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
315         }
316         switch (ord) {
317                 case 0: return LDKCurrency_Bitcoin;
318                 case 1: return LDKCurrency_BitcoinTestnet;
319                 case 2: return LDKCurrency_Regtest;
320                 case 3: return LDKCurrency_Simnet;
321                 case 4: return LDKCurrency_Signet;
322         }
323         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
324         abort(); // Unreachable, but will let the compiler know we don't return here
325 }
326 static jclass Currency_class = NULL;
327 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
328 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
329 static jfieldID Currency_LDKCurrency_Regtest = NULL;
330 static jfieldID Currency_LDKCurrency_Simnet = NULL;
331 static jfieldID Currency_LDKCurrency_Signet = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
333         Currency_class = (*env)->NewGlobalRef(env, clz);
334         CHECK(Currency_class != NULL);
335         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
336         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
337         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
338         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
339         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
340         CHECK(Currency_LDKCurrency_Regtest != NULL);
341         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
342         CHECK(Currency_LDKCurrency_Simnet != NULL);
343         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
344         CHECK(Currency_LDKCurrency_Signet != NULL);
345 }
346 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
347         switch (val) {
348                 case LDKCurrency_Bitcoin:
349                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
350                 case LDKCurrency_BitcoinTestnet:
351                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
352                 case LDKCurrency_Regtest:
353                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
354                 case LDKCurrency_Simnet:
355                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
356                 case LDKCurrency_Signet:
357                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
358                 default: abort();
359         }
360 }
361
362 static inline LDKFailureCode LDKFailureCode_from_java(JNIEnv *env, jclass clz) {
363         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
364         if (UNLIKELY((*env)->ExceptionCheck(env))) {
365                 (*env)->ExceptionDescribe(env);
366                 (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust threw an exception.");
367         }
368         switch (ord) {
369                 case 0: return LDKFailureCode_TemporaryNodeFailure;
370                 case 1: return LDKFailureCode_RequiredNodeFeatureMissing;
371                 case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails;
372         }
373         (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust returned an invalid value.");
374         abort(); // Unreachable, but will let the compiler know we don't return here
375 }
376 static jclass FailureCode_class = NULL;
377 static jfieldID FailureCode_LDKFailureCode_TemporaryNodeFailure = NULL;
378 static jfieldID FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = NULL;
379 static jfieldID FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = NULL;
380 JNIEXPORT void JNICALL Java_org_ldk_enums_FailureCode_init (JNIEnv *env, jclass clz) {
381         FailureCode_class = (*env)->NewGlobalRef(env, clz);
382         CHECK(FailureCode_class != NULL);
383         FailureCode_LDKFailureCode_TemporaryNodeFailure = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_TemporaryNodeFailure", "Lorg/ldk/enums/FailureCode;");
384         CHECK(FailureCode_LDKFailureCode_TemporaryNodeFailure != NULL);
385         FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_RequiredNodeFeatureMissing", "Lorg/ldk/enums/FailureCode;");
386         CHECK(FailureCode_LDKFailureCode_RequiredNodeFeatureMissing != NULL);
387         FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_IncorrectOrUnknownPaymentDetails", "Lorg/ldk/enums/FailureCode;");
388         CHECK(FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails != NULL);
389 }
390 static inline jclass LDKFailureCode_to_java(JNIEnv *env, LDKFailureCode val) {
391         switch (val) {
392                 case LDKFailureCode_TemporaryNodeFailure:
393                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_TemporaryNodeFailure);
394                 case LDKFailureCode_RequiredNodeFeatureMissing:
395                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_RequiredNodeFeatureMissing);
396                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails:
397                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails);
398                 default: abort();
399         }
400 }
401
402 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
403         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
405                 (*env)->ExceptionDescribe(env);
406                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
407         }
408         switch (ord) {
409                 case 0: return LDKHTLCClaim_OfferedTimeout;
410                 case 1: return LDKHTLCClaim_OfferedPreimage;
411                 case 2: return LDKHTLCClaim_AcceptedTimeout;
412                 case 3: return LDKHTLCClaim_AcceptedPreimage;
413                 case 4: return LDKHTLCClaim_Revocation;
414         }
415         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
416         abort(); // Unreachable, but will let the compiler know we don't return here
417 }
418 static jclass HTLCClaim_class = NULL;
419 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
420 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
421 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
422 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
423 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
424 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
425         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
426         CHECK(HTLCClaim_class != NULL);
427         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
428         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
429         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
430         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
431         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
432         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
433         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
434         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
435         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
436         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
437 }
438 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
439         switch (val) {
440                 case LDKHTLCClaim_OfferedTimeout:
441                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
442                 case LDKHTLCClaim_OfferedPreimage:
443                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
444                 case LDKHTLCClaim_AcceptedTimeout:
445                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
446                 case LDKHTLCClaim_AcceptedPreimage:
447                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
448                 case LDKHTLCClaim_Revocation:
449                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
450                 default: abort();
451         }
452 }
453
454 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
455         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
456         if (UNLIKELY((*env)->ExceptionCheck(env))) {
457                 (*env)->ExceptionDescribe(env);
458                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
459         }
460         switch (ord) {
461                 case 0: return LDKIOError_NotFound;
462                 case 1: return LDKIOError_PermissionDenied;
463                 case 2: return LDKIOError_ConnectionRefused;
464                 case 3: return LDKIOError_ConnectionReset;
465                 case 4: return LDKIOError_ConnectionAborted;
466                 case 5: return LDKIOError_NotConnected;
467                 case 6: return LDKIOError_AddrInUse;
468                 case 7: return LDKIOError_AddrNotAvailable;
469                 case 8: return LDKIOError_BrokenPipe;
470                 case 9: return LDKIOError_AlreadyExists;
471                 case 10: return LDKIOError_WouldBlock;
472                 case 11: return LDKIOError_InvalidInput;
473                 case 12: return LDKIOError_InvalidData;
474                 case 13: return LDKIOError_TimedOut;
475                 case 14: return LDKIOError_WriteZero;
476                 case 15: return LDKIOError_Interrupted;
477                 case 16: return LDKIOError_Other;
478                 case 17: return LDKIOError_UnexpectedEof;
479         }
480         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
481         abort(); // Unreachable, but will let the compiler know we don't return here
482 }
483 static jclass IOError_class = NULL;
484 static jfieldID IOError_LDKIOError_NotFound = NULL;
485 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
486 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
487 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
488 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
489 static jfieldID IOError_LDKIOError_NotConnected = NULL;
490 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
491 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
492 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
493 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
494 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
495 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
496 static jfieldID IOError_LDKIOError_InvalidData = NULL;
497 static jfieldID IOError_LDKIOError_TimedOut = NULL;
498 static jfieldID IOError_LDKIOError_WriteZero = NULL;
499 static jfieldID IOError_LDKIOError_Interrupted = NULL;
500 static jfieldID IOError_LDKIOError_Other = NULL;
501 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
502 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
503         IOError_class = (*env)->NewGlobalRef(env, clz);
504         CHECK(IOError_class != NULL);
505         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
506         CHECK(IOError_LDKIOError_NotFound != NULL);
507         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
508         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
509         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
510         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
511         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
512         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
513         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
514         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
515         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
516         CHECK(IOError_LDKIOError_NotConnected != NULL);
517         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
518         CHECK(IOError_LDKIOError_AddrInUse != NULL);
519         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
520         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
521         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
522         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
523         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
524         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
525         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
526         CHECK(IOError_LDKIOError_WouldBlock != NULL);
527         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
528         CHECK(IOError_LDKIOError_InvalidInput != NULL);
529         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
530         CHECK(IOError_LDKIOError_InvalidData != NULL);
531         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
532         CHECK(IOError_LDKIOError_TimedOut != NULL);
533         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
534         CHECK(IOError_LDKIOError_WriteZero != NULL);
535         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
536         CHECK(IOError_LDKIOError_Interrupted != NULL);
537         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
538         CHECK(IOError_LDKIOError_Other != NULL);
539         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
540         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
541 }
542 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
543         switch (val) {
544                 case LDKIOError_NotFound:
545                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
546                 case LDKIOError_PermissionDenied:
547                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
548                 case LDKIOError_ConnectionRefused:
549                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
550                 case LDKIOError_ConnectionReset:
551                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
552                 case LDKIOError_ConnectionAborted:
553                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
554                 case LDKIOError_NotConnected:
555                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
556                 case LDKIOError_AddrInUse:
557                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
558                 case LDKIOError_AddrNotAvailable:
559                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
560                 case LDKIOError_BrokenPipe:
561                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
562                 case LDKIOError_AlreadyExists:
563                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
564                 case LDKIOError_WouldBlock:
565                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
566                 case LDKIOError_InvalidInput:
567                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
568                 case LDKIOError_InvalidData:
569                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
570                 case LDKIOError_TimedOut:
571                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
572                 case LDKIOError_WriteZero:
573                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
574                 case LDKIOError_Interrupted:
575                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
576                 case LDKIOError_Other:
577                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
578                 case LDKIOError_UnexpectedEof:
579                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
580                 default: abort();
581         }
582 }
583
584 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
585         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
586         if (UNLIKELY((*env)->ExceptionCheck(env))) {
587                 (*env)->ExceptionDescribe(env);
588                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
589         }
590         switch (ord) {
591                 case 0: return LDKLevel_Gossip;
592                 case 1: return LDKLevel_Trace;
593                 case 2: return LDKLevel_Debug;
594                 case 3: return LDKLevel_Info;
595                 case 4: return LDKLevel_Warn;
596                 case 5: return LDKLevel_Error;
597         }
598         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
599         abort(); // Unreachable, but will let the compiler know we don't return here
600 }
601 static jclass Level_class = NULL;
602 static jfieldID Level_LDKLevel_Gossip = NULL;
603 static jfieldID Level_LDKLevel_Trace = NULL;
604 static jfieldID Level_LDKLevel_Debug = NULL;
605 static jfieldID Level_LDKLevel_Info = NULL;
606 static jfieldID Level_LDKLevel_Warn = NULL;
607 static jfieldID Level_LDKLevel_Error = NULL;
608 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
609         Level_class = (*env)->NewGlobalRef(env, clz);
610         CHECK(Level_class != NULL);
611         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
612         CHECK(Level_LDKLevel_Gossip != NULL);
613         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
614         CHECK(Level_LDKLevel_Trace != NULL);
615         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
616         CHECK(Level_LDKLevel_Debug != NULL);
617         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
618         CHECK(Level_LDKLevel_Info != NULL);
619         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
620         CHECK(Level_LDKLevel_Warn != NULL);
621         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
622         CHECK(Level_LDKLevel_Error != NULL);
623 }
624 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
625         switch (val) {
626                 case LDKLevel_Gossip:
627                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
628                 case LDKLevel_Trace:
629                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
630                 case LDKLevel_Debug:
631                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
632                 case LDKLevel_Info:
633                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
634                 case LDKLevel_Warn:
635                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
636                 case LDKLevel_Error:
637                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
638                 default: abort();
639         }
640 }
641
642 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
643         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
644         if (UNLIKELY((*env)->ExceptionCheck(env))) {
645                 (*env)->ExceptionDescribe(env);
646                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
647         }
648         switch (ord) {
649                 case 0: return LDKNetwork_Bitcoin;
650                 case 1: return LDKNetwork_Testnet;
651                 case 2: return LDKNetwork_Regtest;
652                 case 3: return LDKNetwork_Signet;
653         }
654         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
655         abort(); // Unreachable, but will let the compiler know we don't return here
656 }
657 static jclass Network_class = NULL;
658 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
659 static jfieldID Network_LDKNetwork_Testnet = NULL;
660 static jfieldID Network_LDKNetwork_Regtest = NULL;
661 static jfieldID Network_LDKNetwork_Signet = NULL;
662 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
663         Network_class = (*env)->NewGlobalRef(env, clz);
664         CHECK(Network_class != NULL);
665         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
666         CHECK(Network_LDKNetwork_Bitcoin != NULL);
667         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
668         CHECK(Network_LDKNetwork_Testnet != NULL);
669         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
670         CHECK(Network_LDKNetwork_Regtest != NULL);
671         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
672         CHECK(Network_LDKNetwork_Signet != NULL);
673 }
674 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
675         switch (val) {
676                 case LDKNetwork_Bitcoin:
677                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
678                 case LDKNetwork_Testnet:
679                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
680                 case LDKNetwork_Regtest:
681                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
682                 case LDKNetwork_Signet:
683                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
684                 default: abort();
685         }
686 }
687
688 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
689         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
690         if (UNLIKELY((*env)->ExceptionCheck(env))) {
691                 (*env)->ExceptionDescribe(env);
692                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
693         }
694         switch (ord) {
695                 case 0: return LDKRecipient_Node;
696                 case 1: return LDKRecipient_PhantomNode;
697         }
698         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
699         abort(); // Unreachable, but will let the compiler know we don't return here
700 }
701 static jclass Recipient_class = NULL;
702 static jfieldID Recipient_LDKRecipient_Node = NULL;
703 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
704 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
705         Recipient_class = (*env)->NewGlobalRef(env, clz);
706         CHECK(Recipient_class != NULL);
707         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
708         CHECK(Recipient_LDKRecipient_Node != NULL);
709         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
710         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
711 }
712 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
713         switch (val) {
714                 case LDKRecipient_Node:
715                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
716                 case LDKRecipient_PhantomNode:
717                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
718                 default: abort();
719         }
720 }
721
722 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
723         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
724         if (UNLIKELY((*env)->ExceptionCheck(env))) {
725                 (*env)->ExceptionDescribe(env);
726                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
727         }
728         switch (ord) {
729                 case 0: return LDKRetryableSendFailure_PaymentExpired;
730                 case 1: return LDKRetryableSendFailure_RouteNotFound;
731                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
732         }
733         (*env)->FatalError(env, "A call to RetryableSendFailure.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 RetryableSendFailure_class = NULL;
737 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
738 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
739 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
740 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
741         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
742         CHECK(RetryableSendFailure_class != NULL);
743         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
744         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
745         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
746         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
747         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
748         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
749 }
750 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
751         switch (val) {
752                 case LDKRetryableSendFailure_PaymentExpired:
753                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
754                 case LDKRetryableSendFailure_RouteNotFound:
755                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
756                 case LDKRetryableSendFailure_DuplicatePayment:
757                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
758                 default: abort();
759         }
760 }
761
762 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
763         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
764         if (UNLIKELY((*env)->ExceptionCheck(env))) {
765                 (*env)->ExceptionDescribe(env);
766                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
767         }
768         switch (ord) {
769                 case 0: return LDKSecp256k1Error_IncorrectSignature;
770                 case 1: return LDKSecp256k1Error_InvalidMessage;
771                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
772                 case 3: return LDKSecp256k1Error_InvalidSignature;
773                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
774                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
775                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
776                 case 7: return LDKSecp256k1Error_InvalidTweak;
777                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
778                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
779                 case 10: return LDKSecp256k1Error_InvalidParityValue;
780         }
781         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
782         abort(); // Unreachable, but will let the compiler know we don't return here
783 }
784 static jclass Secp256k1Error_class = NULL;
785 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
786 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
787 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
788 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
789 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
790 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
791 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
792 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
793 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
794 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
795 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
796 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
797         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
798         CHECK(Secp256k1Error_class != NULL);
799         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
800         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
801         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
802         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
803         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
804         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
805         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
806         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
807         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
808         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
809         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
810         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
811         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
812         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
813         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
814         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
815         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
816         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
817         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
818         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
819         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
820         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
821 }
822 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
823         switch (val) {
824                 case LDKSecp256k1Error_IncorrectSignature:
825                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
826                 case LDKSecp256k1Error_InvalidMessage:
827                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
828                 case LDKSecp256k1Error_InvalidPublicKey:
829                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
830                 case LDKSecp256k1Error_InvalidSignature:
831                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
832                 case LDKSecp256k1Error_InvalidSecretKey:
833                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
834                 case LDKSecp256k1Error_InvalidSharedSecret:
835                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
836                 case LDKSecp256k1Error_InvalidRecoveryId:
837                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
838                 case LDKSecp256k1Error_InvalidTweak:
839                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
840                 case LDKSecp256k1Error_NotEnoughMemory:
841                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
842                 case LDKSecp256k1Error_InvalidPublicKeySum:
843                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
844                 case LDKSecp256k1Error_InvalidParityValue:
845                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
846                 default: abort();
847         }
848 }
849
850 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
851         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
852         if (UNLIKELY((*env)->ExceptionCheck(env))) {
853                 (*env)->ExceptionDescribe(env);
854                 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
855         }
856         switch (ord) {
857                 case 0: return LDKSemanticError_NoPaymentHash;
858                 case 1: return LDKSemanticError_MultiplePaymentHashes;
859                 case 2: return LDKSemanticError_NoDescription;
860                 case 3: return LDKSemanticError_MultipleDescriptions;
861                 case 4: return LDKSemanticError_NoPaymentSecret;
862                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
863                 case 6: return LDKSemanticError_InvalidFeatures;
864                 case 7: return LDKSemanticError_InvalidRecoveryId;
865                 case 8: return LDKSemanticError_InvalidSignature;
866                 case 9: return LDKSemanticError_ImpreciseAmount;
867         }
868         (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
869         abort(); // Unreachable, but will let the compiler know we don't return here
870 }
871 static jclass SemanticError_class = NULL;
872 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
873 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
874 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
875 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
876 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
877 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
878 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
879 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
880 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
881 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
882 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
883         SemanticError_class = (*env)->NewGlobalRef(env, clz);
884         CHECK(SemanticError_class != NULL);
885         SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
886         CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
887         SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
888         CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
889         SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
890         CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
891         SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
892         CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
893         SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
894         CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
895         SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
896         CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
897         SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
898         CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
899         SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
900         CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
901         SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
902         CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
903         SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
904         CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
905 }
906 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
907         switch (val) {
908                 case LDKSemanticError_NoPaymentHash:
909                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
910                 case LDKSemanticError_MultiplePaymentHashes:
911                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
912                 case LDKSemanticError_NoDescription:
913                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
914                 case LDKSemanticError_MultipleDescriptions:
915                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
916                 case LDKSemanticError_NoPaymentSecret:
917                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
918                 case LDKSemanticError_MultiplePaymentSecrets:
919                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
920                 case LDKSemanticError_InvalidFeatures:
921                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
922                 case LDKSemanticError_InvalidRecoveryId:
923                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
924                 case LDKSemanticError_InvalidSignature:
925                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
926                 case LDKSemanticError_ImpreciseAmount:
927                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
928                 default: abort();
929         }
930 }
931
932 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
933         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
934         if (UNLIKELY((*env)->ExceptionCheck(env))) {
935                 (*env)->ExceptionDescribe(env);
936                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
937         }
938         switch (ord) {
939                 case 0: return LDKSiPrefix_Milli;
940                 case 1: return LDKSiPrefix_Micro;
941                 case 2: return LDKSiPrefix_Nano;
942                 case 3: return LDKSiPrefix_Pico;
943         }
944         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
945         abort(); // Unreachable, but will let the compiler know we don't return here
946 }
947 static jclass SiPrefix_class = NULL;
948 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
949 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
950 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
951 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
952 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
953         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
954         CHECK(SiPrefix_class != NULL);
955         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
956         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
957         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
958         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
959         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
960         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
961         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
962         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
963 }
964 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
965         switch (val) {
966                 case LDKSiPrefix_Milli:
967                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
968                 case LDKSiPrefix_Micro:
969                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
970                 case LDKSiPrefix_Nano:
971                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
972                 case LDKSiPrefix_Pico:
973                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
974                 default: abort();
975         }
976 }
977
978 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
979         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
980         if (UNLIKELY((*env)->ExceptionCheck(env))) {
981                 (*env)->ExceptionDescribe(env);
982                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
983         }
984         switch (ord) {
985                 case 0: return LDKUtxoLookupError_UnknownChain;
986                 case 1: return LDKUtxoLookupError_UnknownTx;
987         }
988         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
989         abort(); // Unreachable, but will let the compiler know we don't return here
990 }
991 static jclass UtxoLookupError_class = NULL;
992 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
993 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
994 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
995         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
996         CHECK(UtxoLookupError_class != NULL);
997         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
998         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
999         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1000         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1001 }
1002 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1003         switch (val) {
1004                 case LDKUtxoLookupError_UnknownChain:
1005                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1006                 case LDKUtxoLookupError_UnknownTx:
1007                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1008                 default: abort();
1009         }
1010 }
1011
1012 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1013         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1014         return ret;
1015 }
1016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1017         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1018         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1019         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1020         return ret_arr;
1021 }
1022
1023 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1025         if (!ptr_is_owned(thing)) return;
1026         void* thing_ptr = untag_ptr(thing);
1027         CHECK_ACCESS(thing_ptr);
1028         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1029         FREE(untag_ptr(thing));
1030         BigEndianScalar_free(thing_conv);
1031 }
1032
1033 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1034 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1035 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1036 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1037 static jclass LDKBech32Error_InvalidLength_class = NULL;
1038 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1039 static jclass LDKBech32Error_InvalidChar_class = NULL;
1040 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1041 static jclass LDKBech32Error_InvalidData_class = NULL;
1042 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1043 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1044 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1045 static jclass LDKBech32Error_MixedCase_class = NULL;
1046 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1048         LDKBech32Error_MissingSeparator_class =
1049                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1050         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1051         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1052         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1053         LDKBech32Error_InvalidChecksum_class =
1054                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1055         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1056         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1057         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1058         LDKBech32Error_InvalidLength_class =
1059                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1060         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1061         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1062         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1063         LDKBech32Error_InvalidChar_class =
1064                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1065         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1066         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1067         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1068         LDKBech32Error_InvalidData_class =
1069                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1070         CHECK(LDKBech32Error_InvalidData_class != NULL);
1071         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1072         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1073         LDKBech32Error_InvalidPadding_class =
1074                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1075         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1076         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1077         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1078         LDKBech32Error_MixedCase_class =
1079                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1080         CHECK(LDKBech32Error_MixedCase_class != NULL);
1081         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1082         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1083 }
1084 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1085         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1086         switch(obj->tag) {
1087                 case LDKBech32Error_MissingSeparator: {
1088                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1089                 }
1090                 case LDKBech32Error_InvalidChecksum: {
1091                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1092                 }
1093                 case LDKBech32Error_InvalidLength: {
1094                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1095                 }
1096                 case LDKBech32Error_InvalidChar: {
1097                         int32_t invalid_char_conv = obj->invalid_char;
1098                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1099                 }
1100                 case LDKBech32Error_InvalidData: {
1101                         int8_t invalid_data_conv = obj->invalid_data;
1102                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1103                 }
1104                 case LDKBech32Error_InvalidPadding: {
1105                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1106                 }
1107                 case LDKBech32Error_MixedCase: {
1108                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1109                 }
1110                 default: abort();
1111         }
1112 }
1113 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1114         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1115         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1116         return ret;
1117 }
1118 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) {
1119         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1120         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1121         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1122         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1123         CVec_u8Z_free(ret_var);
1124         return ret_arr;
1125 }
1126
1127 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) {
1128         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1129         int64_t ret_conv = TxOut_get_value(thing_conv);
1130         return ret_conv;
1131 }
1132
1133 static jclass LDKAPIError_APIMisuseError_class = NULL;
1134 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1135 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1136 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1137 static jclass LDKAPIError_InvalidRoute_class = NULL;
1138 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1139 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1140 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1141 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1142 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1143 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1144 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1146         LDKAPIError_APIMisuseError_class =
1147                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1148         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1149         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1150         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1151         LDKAPIError_FeeRateTooHigh_class =
1152                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1153         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1154         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1155         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1156         LDKAPIError_InvalidRoute_class =
1157                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1158         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1159         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1160         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1161         LDKAPIError_ChannelUnavailable_class =
1162                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1163         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1164         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1165         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1166         LDKAPIError_MonitorUpdateInProgress_class =
1167                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1168         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1169         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1170         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1171         LDKAPIError_IncompatibleShutdownScript_class =
1172                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1173         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1174         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1175         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1176 }
1177 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1178         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1179         switch(obj->tag) {
1180                 case LDKAPIError_APIMisuseError: {
1181                         LDKStr err_str = obj->api_misuse_error.err;
1182                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1183                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1184                 }
1185                 case LDKAPIError_FeeRateTooHigh: {
1186                         LDKStr err_str = obj->fee_rate_too_high.err;
1187                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1188                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1189                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1190                 }
1191                 case LDKAPIError_InvalidRoute: {
1192                         LDKStr err_str = obj->invalid_route.err;
1193                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1194                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1195                 }
1196                 case LDKAPIError_ChannelUnavailable: {
1197                         LDKStr err_str = obj->channel_unavailable.err;
1198                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1199                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1200                 }
1201                 case LDKAPIError_MonitorUpdateInProgress: {
1202                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1203                 }
1204                 case LDKAPIError_IncompatibleShutdownScript: {
1205                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1206                         int64_t script_ref = 0;
1207                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1208                         script_ref = tag_ptr(script_var.inner, false);
1209                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1210                 }
1211                 default: abort();
1212         }
1213 }
1214 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1215 CHECK(owner->result_ok);
1216         return *owner->contents.result;
1217 }
1218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1219         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1220         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1221 }
1222
1223 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1224 CHECK(!owner->result_ok);
1225         return APIError_clone(&*owner->contents.err);
1226 }
1227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1228         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1229         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1230         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1231         int64_t ret_ref = tag_ptr(ret_copy, true);
1232         return ret_ref;
1233 }
1234
1235 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1236         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1237         for (size_t i = 0; i < ret.datalen; i++) {
1238                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1239         }
1240         return ret;
1241 }
1242 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1243         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1244         for (size_t i = 0; i < ret.datalen; i++) {
1245                 ret.data[i] = APIError_clone(&orig->data[i]);
1246         }
1247         return ret;
1248 }
1249 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
1250 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
1251 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
1252 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
1253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
1254         LDKCOption_HTLCClaimZ_Some_class =
1255                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
1256         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
1257         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
1258         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
1259         LDKCOption_HTLCClaimZ_None_class =
1260                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
1261         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
1262         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
1263         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
1264 }
1265 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1266         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
1267         switch(obj->tag) {
1268                 case LDKCOption_HTLCClaimZ_Some: {
1269                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
1270                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
1271                 }
1272                 case LDKCOption_HTLCClaimZ_None: {
1273                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
1274                 }
1275                 default: abort();
1276         }
1277 }
1278 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1279 CHECK(owner->result_ok);
1280         return *owner->contents.result;
1281 }
1282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1283         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1284         CResult_NoneNoneZ_get_ok(owner_conv);
1285 }
1286
1287 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1288 CHECK(!owner->result_ok);
1289         return *owner->contents.err;
1290 }
1291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1292         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1293         CResult_NoneNoneZ_get_err(owner_conv);
1294 }
1295
1296 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1297 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1298 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1299 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1300 static jclass LDKDecodeError_InvalidValue_class = NULL;
1301 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1302 static jclass LDKDecodeError_ShortRead_class = NULL;
1303 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1304 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1305 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1306 static jclass LDKDecodeError_Io_class = NULL;
1307 static jmethodID LDKDecodeError_Io_meth = NULL;
1308 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1309 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1311         LDKDecodeError_UnknownVersion_class =
1312                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1313         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1314         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1315         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1316         LDKDecodeError_UnknownRequiredFeature_class =
1317                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1318         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1319         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1320         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1321         LDKDecodeError_InvalidValue_class =
1322                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1323         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1324         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1325         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1326         LDKDecodeError_ShortRead_class =
1327                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1328         CHECK(LDKDecodeError_ShortRead_class != NULL);
1329         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1330         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1331         LDKDecodeError_BadLengthDescriptor_class =
1332                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1333         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1334         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1335         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1336         LDKDecodeError_Io_class =
1337                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1338         CHECK(LDKDecodeError_Io_class != NULL);
1339         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1340         CHECK(LDKDecodeError_Io_meth != NULL);
1341         LDKDecodeError_UnsupportedCompression_class =
1342                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1343         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1344         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1345         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1346 }
1347 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1348         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1349         switch(obj->tag) {
1350                 case LDKDecodeError_UnknownVersion: {
1351                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1352                 }
1353                 case LDKDecodeError_UnknownRequiredFeature: {
1354                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1355                 }
1356                 case LDKDecodeError_InvalidValue: {
1357                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1358                 }
1359                 case LDKDecodeError_ShortRead: {
1360                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1361                 }
1362                 case LDKDecodeError_BadLengthDescriptor: {
1363                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1364                 }
1365                 case LDKDecodeError_Io: {
1366                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1367                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1368                 }
1369                 case LDKDecodeError_UnsupportedCompression: {
1370                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1371                 }
1372                 default: abort();
1373         }
1374 }
1375 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1376         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
1377         ret.is_owned = false;
1378         return ret;
1379 }
1380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1381         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1382         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1383         int64_t ret_ref = 0;
1384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1386         return ret_ref;
1387 }
1388
1389 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1390 CHECK(!owner->result_ok);
1391         return DecodeError_clone(&*owner->contents.err);
1392 }
1393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1394         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1395         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1396         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1397         int64_t ret_ref = tag_ptr(ret_copy, true);
1398         return ret_ref;
1399 }
1400
1401 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1402         LDKTxCreationKeys ret = *owner->contents.result;
1403         ret.is_owned = false;
1404         return ret;
1405 }
1406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1407         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1408         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1409         int64_t ret_ref = 0;
1410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1412         return ret_ref;
1413 }
1414
1415 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1416 CHECK(!owner->result_ok);
1417         return DecodeError_clone(&*owner->contents.err);
1418 }
1419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1420         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1421         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1422         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1423         int64_t ret_ref = tag_ptr(ret_copy, true);
1424         return ret_ref;
1425 }
1426
1427 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1428         LDKChannelPublicKeys ret = *owner->contents.result;
1429         ret.is_owned = false;
1430         return ret;
1431 }
1432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1433         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1434         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1435         int64_t ret_ref = 0;
1436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1438         return ret_ref;
1439 }
1440
1441 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1442 CHECK(!owner->result_ok);
1443         return DecodeError_clone(&*owner->contents.err);
1444 }
1445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1446         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1447         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1448         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1449         int64_t ret_ref = tag_ptr(ret_copy, true);
1450         return ret_ref;
1451 }
1452
1453 static jclass LDKCOption_u32Z_Some_class = NULL;
1454 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1455 static jclass LDKCOption_u32Z_None_class = NULL;
1456 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1458         LDKCOption_u32Z_Some_class =
1459                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1460         CHECK(LDKCOption_u32Z_Some_class != NULL);
1461         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1462         CHECK(LDKCOption_u32Z_Some_meth != NULL);
1463         LDKCOption_u32Z_None_class =
1464                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1465         CHECK(LDKCOption_u32Z_None_class != NULL);
1466         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1467         CHECK(LDKCOption_u32Z_None_meth != NULL);
1468 }
1469 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1470         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1471         switch(obj->tag) {
1472                 case LDKCOption_u32Z_Some: {
1473                         int32_t some_conv = obj->some;
1474                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1475                 }
1476                 case LDKCOption_u32Z_None: {
1477                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1478                 }
1479                 default: abort();
1480         }
1481 }
1482 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1483         LDKHTLCOutputInCommitment ret = *owner->contents.result;
1484         ret.is_owned = false;
1485         return ret;
1486 }
1487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1488         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1489         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1490         int64_t ret_ref = 0;
1491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1493         return ret_ref;
1494 }
1495
1496 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1497 CHECK(!owner->result_ok);
1498         return DecodeError_clone(&*owner->contents.err);
1499 }
1500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1501         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1502         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1503         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1504         int64_t ret_ref = tag_ptr(ret_copy, true);
1505         return ret_ref;
1506 }
1507
1508 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1509         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
1510         ret.is_owned = false;
1511         return ret;
1512 }
1513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1514         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1515         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1516         int64_t ret_ref = 0;
1517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1519         return ret_ref;
1520 }
1521
1522 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1523 CHECK(!owner->result_ok);
1524         return DecodeError_clone(&*owner->contents.err);
1525 }
1526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1527         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1529         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1530         int64_t ret_ref = tag_ptr(ret_copy, true);
1531         return ret_ref;
1532 }
1533
1534 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1535         LDKChannelTransactionParameters ret = *owner->contents.result;
1536         ret.is_owned = false;
1537         return ret;
1538 }
1539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1540         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1541         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1542         int64_t ret_ref = 0;
1543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1545         return ret_ref;
1546 }
1547
1548 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1549 CHECK(!owner->result_ok);
1550         return DecodeError_clone(&*owner->contents.err);
1551 }
1552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1553         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1555         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1556         int64_t ret_ref = tag_ptr(ret_copy, true);
1557         return ret_ref;
1558 }
1559
1560 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1561         LDKHolderCommitmentTransaction ret = *owner->contents.result;
1562         ret.is_owned = false;
1563         return ret;
1564 }
1565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1566         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1567         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1568         int64_t ret_ref = 0;
1569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1571         return ret_ref;
1572 }
1573
1574 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1575 CHECK(!owner->result_ok);
1576         return DecodeError_clone(&*owner->contents.err);
1577 }
1578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1579         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1581         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1582         int64_t ret_ref = tag_ptr(ret_copy, true);
1583         return ret_ref;
1584 }
1585
1586 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1587         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
1588         ret.is_owned = false;
1589         return ret;
1590 }
1591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1592         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1593         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1594         int64_t ret_ref = 0;
1595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1597         return ret_ref;
1598 }
1599
1600 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1601 CHECK(!owner->result_ok);
1602         return DecodeError_clone(&*owner->contents.err);
1603 }
1604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1605         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1607         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1608         int64_t ret_ref = tag_ptr(ret_copy, true);
1609         return ret_ref;
1610 }
1611
1612 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1613         LDKTrustedClosingTransaction ret = *owner->contents.result;
1614         ret.is_owned = false;
1615         return ret;
1616 }
1617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1618         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1619         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1620         int64_t ret_ref = 0;
1621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1623         return ret_ref;
1624 }
1625
1626 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1627 CHECK(!owner->result_ok);
1628         return *owner->contents.err;
1629 }
1630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1631         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1632         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1633 }
1634
1635 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1636         LDKCommitmentTransaction ret = *owner->contents.result;
1637         ret.is_owned = false;
1638         return ret;
1639 }
1640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1641         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1642         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1643         int64_t ret_ref = 0;
1644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1646         return ret_ref;
1647 }
1648
1649 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1650 CHECK(!owner->result_ok);
1651         return DecodeError_clone(&*owner->contents.err);
1652 }
1653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1654         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1655         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1656         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1657         int64_t ret_ref = tag_ptr(ret_copy, true);
1658         return ret_ref;
1659 }
1660
1661 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1662         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1663         ret.is_owned = false;
1664         return ret;
1665 }
1666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1667         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1668         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1669         int64_t ret_ref = 0;
1670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1672         return ret_ref;
1673 }
1674
1675 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1676 CHECK(!owner->result_ok);
1677         return *owner->contents.err;
1678 }
1679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1680         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1681         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1682 }
1683
1684 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1685 CHECK(owner->result_ok);
1686         return *owner->contents.result;
1687 }
1688 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1689         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1690         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1691         jobjectArray ret_arr = NULL;
1692         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1693         ;
1694         for (size_t i = 0; i < ret_var.datalen; i++) {
1695                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1696                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1697                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1698         }
1699         
1700         return ret_arr;
1701 }
1702
1703 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1704 CHECK(!owner->result_ok);
1705         return *owner->contents.err;
1706 }
1707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1708         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1709         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1710 }
1711
1712 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1713         LDKShutdownScript ret = *owner->contents.result;
1714         ret.is_owned = false;
1715         return ret;
1716 }
1717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1718         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1719         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1720         int64_t ret_ref = 0;
1721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1723         return ret_ref;
1724 }
1725
1726 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1727 CHECK(!owner->result_ok);
1728         return DecodeError_clone(&*owner->contents.err);
1729 }
1730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1731         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1732         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1733         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1734         int64_t ret_ref = tag_ptr(ret_copy, true);
1735         return ret_ref;
1736 }
1737
1738 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1739         LDKShutdownScript ret = *owner->contents.result;
1740         ret.is_owned = false;
1741         return ret;
1742 }
1743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1744         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1745         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1746         int64_t ret_ref = 0;
1747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1749         return ret_ref;
1750 }
1751
1752 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1753         LDKInvalidShutdownScript ret = *owner->contents.err;
1754         ret.is_owned = false;
1755         return ret;
1756 }
1757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1758         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1759         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1760         int64_t ret_ref = 0;
1761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1763         return ret_ref;
1764 }
1765
1766 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
1767         LDKBlindedPath ret = *owner->contents.result;
1768         ret.is_owned = false;
1769         return ret;
1770 }
1771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1772         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
1773         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
1774         int64_t ret_ref = 0;
1775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1777         return ret_ref;
1778 }
1779
1780 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
1781 CHECK(!owner->result_ok);
1782         return *owner->contents.err;
1783 }
1784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1785         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
1786         CResult_BlindedPathNoneZ_get_err(owner_conv);
1787 }
1788
1789 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
1790         LDKBlindedPath ret = *owner->contents.result;
1791         ret.is_owned = false;
1792         return ret;
1793 }
1794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1795         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
1796         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
1797         int64_t ret_ref = 0;
1798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1800         return ret_ref;
1801 }
1802
1803 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
1804 CHECK(!owner->result_ok);
1805         return DecodeError_clone(&*owner->contents.err);
1806 }
1807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1808         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
1809         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1810         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
1811         int64_t ret_ref = tag_ptr(ret_copy, true);
1812         return ret_ref;
1813 }
1814
1815 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1816         LDKBlindedHop ret = *owner->contents.result;
1817         ret.is_owned = false;
1818         return ret;
1819 }
1820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1821         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1822         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
1823         int64_t ret_ref = 0;
1824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1826         return ret_ref;
1827 }
1828
1829 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1830 CHECK(!owner->result_ok);
1831         return DecodeError_clone(&*owner->contents.err);
1832 }
1833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1834         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1835         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1836         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
1837         int64_t ret_ref = tag_ptr(ret_copy, true);
1838         return ret_ref;
1839 }
1840
1841 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1842         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1843         for (size_t i = 0; i < ret.datalen; i++) {
1844                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1845         }
1846         return ret;
1847 }
1848 typedef struct LDKScore_JCalls {
1849         atomic_size_t refcnt;
1850         JavaVM *vm;
1851         jweak o;
1852         jmethodID channel_penalty_msat_meth;
1853         jmethodID payment_path_failed_meth;
1854         jmethodID payment_path_successful_meth;
1855         jmethodID probe_failed_meth;
1856         jmethodID probe_successful_meth;
1857         jmethodID write_meth;
1858 } LDKScore_JCalls;
1859 static void LDKScore_JCalls_free(void* this_arg) {
1860         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1861         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1862                 JNIEnv *env;
1863                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1864                 if (get_jenv_res == JNI_EDETACHED) {
1865                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1866                 } else {
1867                         DO_ASSERT(get_jenv_res == JNI_OK);
1868                 }
1869                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1870                 if (get_jenv_res == JNI_EDETACHED) {
1871                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1872                 }
1873                 FREE(j_calls);
1874         }
1875 }
1876 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
1877         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1878         JNIEnv *env;
1879         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1880         if (get_jenv_res == JNI_EDETACHED) {
1881                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1882         } else {
1883                 DO_ASSERT(get_jenv_res == JNI_OK);
1884         }
1885         int64_t short_channel_id_conv = short_channel_id;
1886         LDKNodeId source_var = *source;
1887         int64_t source_ref = 0;
1888         source_var = NodeId_clone(&source_var);
1889         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
1890         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
1891         LDKNodeId target_var = *target;
1892         int64_t target_ref = 0;
1893         target_var = NodeId_clone(&target_var);
1894         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
1895         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
1896         LDKChannelUsage usage_var = usage;
1897         int64_t usage_ref = 0;
1898         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
1899         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
1900         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1901         CHECK(obj != NULL);
1902         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
1903         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1904                 (*env)->ExceptionDescribe(env);
1905                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
1906         }
1907         if (get_jenv_res == JNI_EDETACHED) {
1908                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1909         }
1910         return ret;
1911 }
1912 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
1913         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1914         JNIEnv *env;
1915         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1916         if (get_jenv_res == JNI_EDETACHED) {
1917                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1918         } else {
1919                 DO_ASSERT(get_jenv_res == JNI_OK);
1920         }
1921         LDKCVec_RouteHopZ path_var = path;
1922         int64_tArray path_arr = NULL;
1923         path_arr = (*env)->NewLongArray(env, path_var.datalen);
1924         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
1925         for (size_t k = 0; k < path_var.datalen; k++) {
1926                 LDKRouteHop path_conv_10_var = path_var.data[k];
1927                 int64_t path_conv_10_ref = 0;
1928                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1929                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
1930                 path_arr_ptr[k] = path_conv_10_ref;
1931         }
1932         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
1933         FREE(path_var.data);
1934         int64_t short_channel_id_conv = short_channel_id;
1935         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1936         CHECK(obj != NULL);
1937         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
1938         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1939                 (*env)->ExceptionDescribe(env);
1940                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
1941         }
1942         if (get_jenv_res == JNI_EDETACHED) {
1943                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1944         }
1945 }
1946 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
1947         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1948         JNIEnv *env;
1949         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1950         if (get_jenv_res == JNI_EDETACHED) {
1951                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1952         } else {
1953                 DO_ASSERT(get_jenv_res == JNI_OK);
1954         }
1955         LDKCVec_RouteHopZ path_var = path;
1956         int64_tArray path_arr = NULL;
1957         path_arr = (*env)->NewLongArray(env, path_var.datalen);
1958         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
1959         for (size_t k = 0; k < path_var.datalen; k++) {
1960                 LDKRouteHop path_conv_10_var = path_var.data[k];
1961                 int64_t path_conv_10_ref = 0;
1962                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1963                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
1964                 path_arr_ptr[k] = path_conv_10_ref;
1965         }
1966         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
1967         FREE(path_var.data);
1968         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1969         CHECK(obj != NULL);
1970         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
1971         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1972                 (*env)->ExceptionDescribe(env);
1973                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
1974         }
1975         if (get_jenv_res == JNI_EDETACHED) {
1976                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1977         }
1978 }
1979 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
1980         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1981         JNIEnv *env;
1982         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1983         if (get_jenv_res == JNI_EDETACHED) {
1984                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1985         } else {
1986                 DO_ASSERT(get_jenv_res == JNI_OK);
1987         }
1988         LDKCVec_RouteHopZ path_var = path;
1989         int64_tArray path_arr = NULL;
1990         path_arr = (*env)->NewLongArray(env, path_var.datalen);
1991         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
1992         for (size_t k = 0; k < path_var.datalen; k++) {
1993                 LDKRouteHop path_conv_10_var = path_var.data[k];
1994                 int64_t path_conv_10_ref = 0;
1995                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1996                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
1997                 path_arr_ptr[k] = path_conv_10_ref;
1998         }
1999         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2000         FREE(path_var.data);
2001         int64_t short_channel_id_conv = short_channel_id;
2002         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2003         CHECK(obj != NULL);
2004         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv);
2005         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2006                 (*env)->ExceptionDescribe(env);
2007                 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
2008         }
2009         if (get_jenv_res == JNI_EDETACHED) {
2010                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2011         }
2012 }
2013 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
2014         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
2015         JNIEnv *env;
2016         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2017         if (get_jenv_res == JNI_EDETACHED) {
2018                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2019         } else {
2020                 DO_ASSERT(get_jenv_res == JNI_OK);
2021         }
2022         LDKCVec_RouteHopZ path_var = path;
2023         int64_tArray path_arr = NULL;
2024         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2025         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2026         for (size_t k = 0; k < path_var.datalen; k++) {
2027                 LDKRouteHop path_conv_10_var = path_var.data[k];
2028                 int64_t path_conv_10_ref = 0;
2029                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2030                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
2031                 path_arr_ptr[k] = path_conv_10_ref;
2032         }
2033         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2034         FREE(path_var.data);
2035         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2036         CHECK(obj != NULL);
2037         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr);
2038         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2039                 (*env)->ExceptionDescribe(env);
2040                 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
2041         }
2042         if (get_jenv_res == JNI_EDETACHED) {
2043                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2044         }
2045 }
2046 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
2047         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
2048         JNIEnv *env;
2049         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2050         if (get_jenv_res == JNI_EDETACHED) {
2051                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2052         } else {
2053                 DO_ASSERT(get_jenv_res == JNI_OK);
2054         }
2055         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2056         CHECK(obj != NULL);
2057         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2058         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2059                 (*env)->ExceptionDescribe(env);
2060                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
2061         }
2062         LDKCVec_u8Z ret_ref;
2063         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2064         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2065         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2066         if (get_jenv_res == JNI_EDETACHED) {
2067                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2068         }
2069         return ret_ref;
2070 }
2071 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
2072         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
2073         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2074 }
2075 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
2076         jclass c = (*env)->GetObjectClass(env, o);
2077         CHECK(c != NULL);
2078         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
2079         atomic_init(&calls->refcnt, 1);
2080         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2081         calls->o = (*env)->NewWeakGlobalRef(env, o);
2082         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
2083         CHECK(calls->channel_penalty_msat_meth != NULL);
2084         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
2085         CHECK(calls->payment_path_failed_meth != NULL);
2086         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
2087         CHECK(calls->payment_path_successful_meth != NULL);
2088         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V");
2089         CHECK(calls->probe_failed_meth != NULL);
2090         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V");
2091         CHECK(calls->probe_successful_meth != NULL);
2092         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2093         CHECK(calls->write_meth != NULL);
2094
2095         LDKScore ret = {
2096                 .this_arg = (void*) calls,
2097                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
2098                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
2099                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
2100                 .probe_failed = probe_failed_LDKScore_jcall,
2101                 .probe_successful = probe_successful_LDKScore_jcall,
2102                 .write = write_LDKScore_jcall,
2103                 .free = LDKScore_JCalls_free,
2104         };
2105         return ret;
2106 }
2107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
2108         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
2109         *res_ptr = LDKScore_init(env, clz, o);
2110         return tag_ptr(res_ptr, true);
2111 }
2112 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) {
2113         void* this_arg_ptr = untag_ptr(this_arg);
2114         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2115         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2116         LDKNodeId source_conv;
2117         source_conv.inner = untag_ptr(source);
2118         source_conv.is_owned = ptr_is_owned(source);
2119         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
2120         source_conv.is_owned = false;
2121         LDKNodeId target_conv;
2122         target_conv.inner = untag_ptr(target);
2123         target_conv.is_owned = ptr_is_owned(target);
2124         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
2125         target_conv.is_owned = false;
2126         LDKChannelUsage usage_conv;
2127         usage_conv.inner = untag_ptr(usage);
2128         usage_conv.is_owned = ptr_is_owned(usage);
2129         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
2130         usage_conv = ChannelUsage_clone(&usage_conv);
2131         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
2132         return ret_conv;
2133 }
2134
2135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
2136         void* this_arg_ptr = untag_ptr(this_arg);
2137         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2138         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2139         LDKCVec_RouteHopZ path_constr;
2140         path_constr.datalen = (*env)->GetArrayLength(env, path);
2141         if (path_constr.datalen > 0)
2142                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
2143         else
2144                 path_constr.data = NULL;
2145         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
2146         for (size_t k = 0; k < path_constr.datalen; k++) {
2147                 int64_t path_conv_10 = path_vals[k];
2148                 LDKRouteHop path_conv_10_conv;
2149                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
2150                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
2151                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
2152                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
2153                 path_constr.data[k] = path_conv_10_conv;
2154         }
2155         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
2156         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
2157 }
2158
2159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
2160         void* this_arg_ptr = untag_ptr(this_arg);
2161         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2162         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2163         LDKCVec_RouteHopZ path_constr;
2164         path_constr.datalen = (*env)->GetArrayLength(env, path);
2165         if (path_constr.datalen > 0)
2166                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
2167         else
2168                 path_constr.data = NULL;
2169         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
2170         for (size_t k = 0; k < path_constr.datalen; k++) {
2171                 int64_t path_conv_10 = path_vals[k];
2172                 LDKRouteHop path_conv_10_conv;
2173                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
2174                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
2175                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
2176                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
2177                 path_constr.data[k] = path_conv_10_conv;
2178         }
2179         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
2180         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
2181 }
2182
2183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
2184         void* this_arg_ptr = untag_ptr(this_arg);
2185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2186         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2187         LDKCVec_RouteHopZ path_constr;
2188         path_constr.datalen = (*env)->GetArrayLength(env, path);
2189         if (path_constr.datalen > 0)
2190                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
2191         else
2192                 path_constr.data = NULL;
2193         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
2194         for (size_t k = 0; k < path_constr.datalen; k++) {
2195                 int64_t path_conv_10 = path_vals[k];
2196                 LDKRouteHop path_conv_10_conv;
2197                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
2198                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
2199                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
2200                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
2201                 path_constr.data[k] = path_conv_10_conv;
2202         }
2203         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
2204         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
2205 }
2206
2207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
2208         void* this_arg_ptr = untag_ptr(this_arg);
2209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2210         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2211         LDKCVec_RouteHopZ path_constr;
2212         path_constr.datalen = (*env)->GetArrayLength(env, path);
2213         if (path_constr.datalen > 0)
2214                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
2215         else
2216                 path_constr.data = NULL;
2217         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
2218         for (size_t k = 0; k < path_constr.datalen; k++) {
2219                 int64_t path_conv_10 = path_vals[k];
2220                 LDKRouteHop path_conv_10_conv;
2221                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
2222                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
2223                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
2224                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
2225                 path_constr.data[k] = path_conv_10_conv;
2226         }
2227         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
2228         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
2229 }
2230
2231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2232         void* this_arg_ptr = untag_ptr(this_arg);
2233         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2234         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2235         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2236         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2237         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2238         CVec_u8Z_free(ret_var);
2239         return ret_arr;
2240 }
2241
2242 typedef struct LDKLockableScore_JCalls {
2243         atomic_size_t refcnt;
2244         JavaVM *vm;
2245         jweak o;
2246         jmethodID lock_meth;
2247 } LDKLockableScore_JCalls;
2248 static void LDKLockableScore_JCalls_free(void* this_arg) {
2249         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2250         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2251                 JNIEnv *env;
2252                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2253                 if (get_jenv_res == JNI_EDETACHED) {
2254                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2255                 } else {
2256                         DO_ASSERT(get_jenv_res == JNI_OK);
2257                 }
2258                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2259                 if (get_jenv_res == JNI_EDETACHED) {
2260                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2261                 }
2262                 FREE(j_calls);
2263         }
2264 }
2265 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
2266         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2267         JNIEnv *env;
2268         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2269         if (get_jenv_res == JNI_EDETACHED) {
2270                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2271         } else {
2272                 DO_ASSERT(get_jenv_res == JNI_OK);
2273         }
2274         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2275         CHECK(obj != NULL);
2276         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
2277         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2278                 (*env)->ExceptionDescribe(env);
2279                 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
2280         }
2281         void* ret_ptr = untag_ptr(ret);
2282         CHECK_ACCESS(ret_ptr);
2283         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
2284         if (ret_conv.free == LDKScore_JCalls_free) {
2285                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2286                 LDKScore_JCalls_cloned(&ret_conv);
2287         }// WARNING: we may need a move here but no clone is available for LDKScore
2288         
2289         if (get_jenv_res == JNI_EDETACHED) {
2290                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2291         }
2292         return ret_conv;
2293 }
2294 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
2295         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
2296         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2297 }
2298 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
2299         jclass c = (*env)->GetObjectClass(env, o);
2300         CHECK(c != NULL);
2301         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
2302         atomic_init(&calls->refcnt, 1);
2303         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2304         calls->o = (*env)->NewWeakGlobalRef(env, o);
2305         calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
2306         CHECK(calls->lock_meth != NULL);
2307
2308         LDKLockableScore ret = {
2309                 .this_arg = (void*) calls,
2310                 .lock = lock_LDKLockableScore_jcall,
2311                 .free = LDKLockableScore_JCalls_free,
2312         };
2313         return ret;
2314 }
2315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
2316         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
2317         *res_ptr = LDKLockableScore_init(env, clz, o);
2318         return tag_ptr(res_ptr, true);
2319 }
2320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
2321         void* this_arg_ptr = untag_ptr(this_arg);
2322         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2323         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
2324         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
2325         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
2326         return tag_ptr(ret_ret, true);
2327 }
2328
2329 typedef struct LDKWriteableScore_JCalls {
2330         atomic_size_t refcnt;
2331         JavaVM *vm;
2332         jweak o;
2333         LDKLockableScore_JCalls* LockableScore;
2334         jmethodID write_meth;
2335 } LDKWriteableScore_JCalls;
2336 static void LDKWriteableScore_JCalls_free(void* this_arg) {
2337         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2338         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2339                 JNIEnv *env;
2340                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2341                 if (get_jenv_res == JNI_EDETACHED) {
2342                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2343                 } else {
2344                         DO_ASSERT(get_jenv_res == JNI_OK);
2345                 }
2346                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2347                 if (get_jenv_res == JNI_EDETACHED) {
2348                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2349                 }
2350                 FREE(j_calls);
2351         }
2352 }
2353 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
2354         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2355         JNIEnv *env;
2356         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2357         if (get_jenv_res == JNI_EDETACHED) {
2358                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2359         } else {
2360                 DO_ASSERT(get_jenv_res == JNI_OK);
2361         }
2362         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2363         CHECK(obj != NULL);
2364         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2365         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2366                 (*env)->ExceptionDescribe(env);
2367                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
2368         }
2369         LDKCVec_u8Z ret_ref;
2370         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2371         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2372         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2373         if (get_jenv_res == JNI_EDETACHED) {
2374                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2375         }
2376         return ret_ref;
2377 }
2378 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
2379         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
2380         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2381         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
2382 }
2383 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
2384         jclass c = (*env)->GetObjectClass(env, o);
2385         CHECK(c != NULL);
2386         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
2387         atomic_init(&calls->refcnt, 1);
2388         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2389         calls->o = (*env)->NewWeakGlobalRef(env, o);
2390         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2391         CHECK(calls->write_meth != NULL);
2392
2393         LDKWriteableScore ret = {
2394                 .this_arg = (void*) calls,
2395                 .write = write_LDKWriteableScore_jcall,
2396                 .free = LDKWriteableScore_JCalls_free,
2397                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
2398         };
2399         calls->LockableScore = ret.LockableScore.this_arg;
2400         return ret;
2401 }
2402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
2403         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2404         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
2405         return tag_ptr(res_ptr, true);
2406 }
2407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
2408         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
2409         return tag_ptr(&inp->LockableScore, false);
2410 }
2411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2412         void* this_arg_ptr = untag_ptr(this_arg);
2413         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2414         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
2415         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2416         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2417         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2418         CVec_u8Z_free(ret_var);
2419         return ret_arr;
2420 }
2421
2422 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
2423 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
2424 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
2425 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
2426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
2427         LDKCOption_WriteableScoreZ_Some_class =
2428                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
2429         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
2430         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
2431         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
2432         LDKCOption_WriteableScoreZ_None_class =
2433                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
2434         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
2435         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
2436         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
2437 }
2438 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2439         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
2440         switch(obj->tag) {
2441                 case LDKCOption_WriteableScoreZ_Some: {
2442                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2443                         *some_ret = obj->some;
2444                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
2445                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
2446                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2447                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
2448                         }
2449                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
2450                 }
2451                 case LDKCOption_WriteableScoreZ_None: {
2452                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
2453                 }
2454                 default: abort();
2455         }
2456 }
2457 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
2458 CHECK(owner->result_ok);
2459         return *owner->contents.result;
2460 }
2461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2462         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
2463         CResult_NoneErrorZ_get_ok(owner_conv);
2464 }
2465
2466 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
2467 CHECK(!owner->result_ok);
2468         return *owner->contents.err;
2469 }
2470 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2471         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
2472         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
2473         return ret_conv;
2474 }
2475
2476 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2477         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2478         for (size_t i = 0; i < ret.datalen; i++) {
2479                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2480         }
2481         return ret;
2482 }
2483 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2484         LDKRoute ret = *owner->contents.result;
2485         ret.is_owned = false;
2486         return ret;
2487 }
2488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2489         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2490         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2491         int64_t ret_ref = 0;
2492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2494         return ret_ref;
2495 }
2496
2497 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2498         LDKLightningError ret = *owner->contents.err;
2499         ret.is_owned = false;
2500         return ret;
2501 }
2502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2503         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2504         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2505         int64_t ret_ref = 0;
2506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2508         return ret_ref;
2509 }
2510
2511 static jclass LDKCOption_u64Z_Some_class = NULL;
2512 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
2513 static jclass LDKCOption_u64Z_None_class = NULL;
2514 static jmethodID LDKCOption_u64Z_None_meth = NULL;
2515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
2516         LDKCOption_u64Z_Some_class =
2517                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
2518         CHECK(LDKCOption_u64Z_Some_class != NULL);
2519         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
2520         CHECK(LDKCOption_u64Z_Some_meth != NULL);
2521         LDKCOption_u64Z_None_class =
2522                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
2523         CHECK(LDKCOption_u64Z_None_class != NULL);
2524         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
2525         CHECK(LDKCOption_u64Z_None_meth != NULL);
2526 }
2527 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2528         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
2529         switch(obj->tag) {
2530                 case LDKCOption_u64Z_Some: {
2531                         int64_t some_conv = obj->some;
2532                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
2533                 }
2534                 case LDKCOption_u64Z_None: {
2535                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
2536                 }
2537                 default: abort();
2538         }
2539 }
2540 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2541         LDKInFlightHtlcs ret = *owner->contents.result;
2542         ret.is_owned = false;
2543         return ret;
2544 }
2545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2546         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2547         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2548         int64_t ret_ref = 0;
2549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2551         return ret_ref;
2552 }
2553
2554 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2555 CHECK(!owner->result_ok);
2556         return DecodeError_clone(&*owner->contents.err);
2557 }
2558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2559         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2561         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2562         int64_t ret_ref = tag_ptr(ret_copy, true);
2563         return ret_ref;
2564 }
2565
2566 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2567         LDKRouteHop ret = *owner->contents.result;
2568         ret.is_owned = false;
2569         return ret;
2570 }
2571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2572         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2573         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2574         int64_t ret_ref = 0;
2575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2577         return ret_ref;
2578 }
2579
2580 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2581 CHECK(!owner->result_ok);
2582         return DecodeError_clone(&*owner->contents.err);
2583 }
2584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2585         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2587         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2588         int64_t ret_ref = tag_ptr(ret_copy, true);
2589         return ret_ref;
2590 }
2591
2592 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2593         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2594         for (size_t i = 0; i < ret.datalen; i++) {
2595                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2596         }
2597         return ret;
2598 }
2599 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2600         LDKRoute ret = *owner->contents.result;
2601         ret.is_owned = false;
2602         return ret;
2603 }
2604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2605         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2606         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2607         int64_t ret_ref = 0;
2608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2610         return ret_ref;
2611 }
2612
2613 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2614 CHECK(!owner->result_ok);
2615         return DecodeError_clone(&*owner->contents.err);
2616 }
2617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2618         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2619         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2620         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2621         int64_t ret_ref = tag_ptr(ret_copy, true);
2622         return ret_ref;
2623 }
2624
2625 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2626         LDKRouteParameters ret = *owner->contents.result;
2627         ret.is_owned = false;
2628         return ret;
2629 }
2630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2631         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2632         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2633         int64_t ret_ref = 0;
2634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2636         return ret_ref;
2637 }
2638
2639 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2640 CHECK(!owner->result_ok);
2641         return DecodeError_clone(&*owner->contents.err);
2642 }
2643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2644         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2645         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2646         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2647         int64_t ret_ref = tag_ptr(ret_copy, true);
2648         return ret_ref;
2649 }
2650
2651 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2652         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2653         for (size_t i = 0; i < ret.datalen; i++) {
2654                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2655         }
2656         return ret;
2657 }
2658 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2659         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2660         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2661         return ret;
2662 }
2663 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2664         LDKPaymentParameters ret = *owner->contents.result;
2665         ret.is_owned = false;
2666         return ret;
2667 }
2668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2669         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2670         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2671         int64_t ret_ref = 0;
2672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2674         return ret_ref;
2675 }
2676
2677 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2678 CHECK(!owner->result_ok);
2679         return DecodeError_clone(&*owner->contents.err);
2680 }
2681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2682         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2683         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2684         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2685         int64_t ret_ref = tag_ptr(ret_copy, true);
2686         return ret_ref;
2687 }
2688
2689 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2690         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2691         for (size_t i = 0; i < ret.datalen; i++) {
2692                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2693         }
2694         return ret;
2695 }
2696 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2697         LDKRouteHint ret = *owner->contents.result;
2698         ret.is_owned = false;
2699         return ret;
2700 }
2701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2702         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2703         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2704         int64_t ret_ref = 0;
2705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2707         return ret_ref;
2708 }
2709
2710 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2711 CHECK(!owner->result_ok);
2712         return DecodeError_clone(&*owner->contents.err);
2713 }
2714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2715         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2717         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2718         int64_t ret_ref = tag_ptr(ret_copy, true);
2719         return ret_ref;
2720 }
2721
2722 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2723         LDKRouteHintHop ret = *owner->contents.result;
2724         ret.is_owned = false;
2725         return ret;
2726 }
2727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2728         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2729         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2730         int64_t ret_ref = 0;
2731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2733         return ret_ref;
2734 }
2735
2736 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2737 CHECK(!owner->result_ok);
2738         return DecodeError_clone(&*owner->contents.err);
2739 }
2740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2741         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2743         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2744         int64_t ret_ref = tag_ptr(ret_copy, true);
2745         return ret_ref;
2746 }
2747
2748 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
2749 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
2750 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
2751 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
2752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
2753         LDKPaymentPurpose_InvoicePayment_class =
2754                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
2755         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
2756         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
2757         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
2758         LDKPaymentPurpose_SpontaneousPayment_class =
2759                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
2760         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
2761         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
2762         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
2763 }
2764 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2765         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2766         switch(obj->tag) {
2767                 case LDKPaymentPurpose_InvoicePayment: {
2768                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2769                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
2770                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
2771                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
2772                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
2773                 }
2774                 case LDKPaymentPurpose_SpontaneousPayment: {
2775                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
2776                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
2777                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
2778                 }
2779                 default: abort();
2780         }
2781 }
2782 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2783 CHECK(owner->result_ok);
2784         return PaymentPurpose_clone(&*owner->contents.result);
2785 }
2786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2787         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2788         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
2789         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
2790         int64_t ret_ref = tag_ptr(ret_copy, true);
2791         return ret_ref;
2792 }
2793
2794 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2795 CHECK(!owner->result_ok);
2796         return DecodeError_clone(&*owner->contents.err);
2797 }
2798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2799         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2801         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
2802         int64_t ret_ref = tag_ptr(ret_copy, true);
2803         return ret_ref;
2804 }
2805
2806 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2807 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2808 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2809 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2810 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2811 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2813         LDKNetworkUpdate_ChannelUpdateMessage_class =
2814                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2815         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2816         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2817         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2818         LDKNetworkUpdate_ChannelFailure_class =
2819                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2820         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2821         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2822         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2823         LDKNetworkUpdate_NodeFailure_class =
2824                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2825         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2826         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2827         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2828 }
2829 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2830         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2831         switch(obj->tag) {
2832                 case LDKNetworkUpdate_ChannelUpdateMessage: {
2833                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2834                         int64_t msg_ref = 0;
2835                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2836                         msg_ref = tag_ptr(msg_var.inner, false);
2837                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2838                 }
2839                 case LDKNetworkUpdate_ChannelFailure: {
2840                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2841                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2842                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2843                 }
2844                 case LDKNetworkUpdate_NodeFailure: {
2845                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2846                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2847                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
2848                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2849                 }
2850                 default: abort();
2851         }
2852 }
2853 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2854 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2855 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2856 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2858         LDKCOption_NetworkUpdateZ_Some_class =
2859                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2860         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2861         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2862         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2863         LDKCOption_NetworkUpdateZ_None_class =
2864                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2865         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2866         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2867         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2868 }
2869 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2870         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2871         switch(obj->tag) {
2872                 case LDKCOption_NetworkUpdateZ_Some: {
2873                         int64_t some_ref = tag_ptr(&obj->some, false);
2874                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2875                 }
2876                 case LDKCOption_NetworkUpdateZ_None: {
2877                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2878                 }
2879                 default: abort();
2880         }
2881 }
2882 static jclass LDKPathFailure_InitialSend_class = NULL;
2883 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
2884 static jclass LDKPathFailure_OnPath_class = NULL;
2885 static jmethodID LDKPathFailure_OnPath_meth = NULL;
2886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
2887         LDKPathFailure_InitialSend_class =
2888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
2889         CHECK(LDKPathFailure_InitialSend_class != NULL);
2890         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
2891         CHECK(LDKPathFailure_InitialSend_meth != NULL);
2892         LDKPathFailure_OnPath_class =
2893                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
2894         CHECK(LDKPathFailure_OnPath_class != NULL);
2895         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
2896         CHECK(LDKPathFailure_OnPath_meth != NULL);
2897 }
2898 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2899         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
2900         switch(obj->tag) {
2901                 case LDKPathFailure_InitialSend: {
2902                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
2903                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
2904                 }
2905                 case LDKPathFailure_OnPath: {
2906                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
2907                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
2908                 }
2909                 default: abort();
2910         }
2911 }
2912 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
2913 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
2914 static jclass LDKCOption_PathFailureZ_None_class = NULL;
2915 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
2916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
2917         LDKCOption_PathFailureZ_Some_class =
2918                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
2919         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
2920         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
2921         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
2922         LDKCOption_PathFailureZ_None_class =
2923                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
2924         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
2925         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
2926         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
2927 }
2928 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2929         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
2930         switch(obj->tag) {
2931                 case LDKCOption_PathFailureZ_Some: {
2932                         int64_t some_ref = tag_ptr(&obj->some, false);
2933                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
2934                 }
2935                 case LDKCOption_PathFailureZ_None: {
2936                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
2937                 }
2938                 default: abort();
2939         }
2940 }
2941 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
2942 CHECK(owner->result_ok);
2943         return COption_PathFailureZ_clone(&*owner->contents.result);
2944 }
2945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2946         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
2947         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
2948         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
2949         int64_t ret_ref = tag_ptr(ret_copy, true);
2950         return ret_ref;
2951 }
2952
2953 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
2954 CHECK(!owner->result_ok);
2955         return DecodeError_clone(&*owner->contents.err);
2956 }
2957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2958         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
2959         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2960         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
2961         int64_t ret_ref = tag_ptr(ret_copy, true);
2962         return ret_ref;
2963 }
2964
2965 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
2966 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
2967 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
2968 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
2969 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
2970 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
2971 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
2972 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
2973 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
2974 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
2975 static jclass LDKClosureReason_ProcessingError_class = NULL;
2976 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
2977 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
2978 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
2979 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
2980 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
2981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
2982         LDKClosureReason_CounterpartyForceClosed_class =
2983                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
2984         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
2985         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2986         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2987         LDKClosureReason_HolderForceClosed_class =
2988                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2989         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2990         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2991         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2992         LDKClosureReason_CooperativeClosure_class =
2993                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2994         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2995         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2996         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2997         LDKClosureReason_CommitmentTxConfirmed_class =
2998                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2999         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
3000         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
3001         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
3002         LDKClosureReason_FundingTimedOut_class =
3003                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
3004         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
3005         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
3006         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
3007         LDKClosureReason_ProcessingError_class =
3008                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
3009         CHECK(LDKClosureReason_ProcessingError_class != NULL);
3010         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
3011         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
3012         LDKClosureReason_DisconnectedPeer_class =
3013                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
3014         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
3015         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
3016         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
3017         LDKClosureReason_OutdatedChannelManager_class =
3018                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
3019         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
3020         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
3021         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
3022 }
3023 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3024         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3025         switch(obj->tag) {
3026                 case LDKClosureReason_CounterpartyForceClosed: {
3027                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
3028                         jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
3029                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
3030                 }
3031                 case LDKClosureReason_HolderForceClosed: {
3032                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
3033                 }
3034                 case LDKClosureReason_CooperativeClosure: {
3035                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
3036                 }
3037                 case LDKClosureReason_CommitmentTxConfirmed: {
3038                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
3039                 }
3040                 case LDKClosureReason_FundingTimedOut: {
3041                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
3042                 }
3043                 case LDKClosureReason_ProcessingError: {
3044                         LDKStr err_str = obj->processing_error.err;
3045                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3046                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
3047                 }
3048                 case LDKClosureReason_DisconnectedPeer: {
3049                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
3050                 }
3051                 case LDKClosureReason_OutdatedChannelManager: {
3052                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
3053                 }
3054                 default: abort();
3055         }
3056 }
3057 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
3058 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
3059 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
3060 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
3061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
3062         LDKCOption_ClosureReasonZ_Some_class =
3063                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
3064         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
3065         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
3066         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
3067         LDKCOption_ClosureReasonZ_None_class =
3068                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
3069         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
3070         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
3071         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
3072 }
3073 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3074         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
3075         switch(obj->tag) {
3076                 case LDKCOption_ClosureReasonZ_Some: {
3077                         int64_t some_ref = tag_ptr(&obj->some, false);
3078                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
3079                 }
3080                 case LDKCOption_ClosureReasonZ_None: {
3081                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
3082                 }
3083                 default: abort();
3084         }
3085 }
3086 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3087 CHECK(owner->result_ok);
3088         return COption_ClosureReasonZ_clone(&*owner->contents.result);
3089 }
3090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3091         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
3092         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
3093         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
3094         int64_t ret_ref = tag_ptr(ret_copy, true);
3095         return ret_ref;
3096 }
3097
3098 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3099 CHECK(!owner->result_ok);
3100         return DecodeError_clone(&*owner->contents.err);
3101 }
3102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3103         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
3104         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3105         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
3106         int64_t ret_ref = tag_ptr(ret_copy, true);
3107         return ret_ref;
3108 }
3109
3110 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
3111 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
3112 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
3113 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
3114 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
3115 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
3116 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
3117 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
3118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
3119         LDKHTLCDestination_NextHopChannel_class =
3120                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
3121         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
3122         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
3123         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
3124         LDKHTLCDestination_UnknownNextHop_class =
3125                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
3126         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
3127         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
3128         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
3129         LDKHTLCDestination_InvalidForward_class =
3130                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
3131         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
3132         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
3133         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
3134         LDKHTLCDestination_FailedPayment_class =
3135                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
3136         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
3137         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
3138         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
3139 }
3140 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3141         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3142         switch(obj->tag) {
3143                 case LDKHTLCDestination_NextHopChannel: {
3144                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3145                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
3146                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
3147                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
3148                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
3149                 }
3150                 case LDKHTLCDestination_UnknownNextHop: {
3151                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
3152                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
3153                 }
3154                 case LDKHTLCDestination_InvalidForward: {
3155                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
3156                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
3157                 }
3158                 case LDKHTLCDestination_FailedPayment: {
3159                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3160                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
3161                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
3162                 }
3163                 default: abort();
3164         }
3165 }
3166 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
3167 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
3168 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
3169 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
3170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
3171         LDKCOption_HTLCDestinationZ_Some_class =
3172                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
3173         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
3174         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
3175         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
3176         LDKCOption_HTLCDestinationZ_None_class =
3177                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
3178         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
3179         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
3180         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
3181 }
3182 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3183         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
3184         switch(obj->tag) {
3185                 case LDKCOption_HTLCDestinationZ_Some: {
3186                         int64_t some_ref = tag_ptr(&obj->some, false);
3187                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
3188                 }
3189                 case LDKCOption_HTLCDestinationZ_None: {
3190                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
3191                 }
3192                 default: abort();
3193         }
3194 }
3195 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
3196 CHECK(owner->result_ok);
3197         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
3198 }
3199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3200         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
3201         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
3202         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
3203         int64_t ret_ref = tag_ptr(ret_copy, true);
3204         return ret_ref;
3205 }
3206
3207 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
3208 CHECK(!owner->result_ok);
3209         return DecodeError_clone(&*owner->contents.err);
3210 }
3211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3212         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
3213         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3214         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
3215         int64_t ret_ref = tag_ptr(ret_copy, true);
3216         return ret_ref;
3217 }
3218
3219 static jclass LDKCOption_u128Z_Some_class = NULL;
3220 static jmethodID LDKCOption_u128Z_Some_meth = NULL;
3221 static jclass LDKCOption_u128Z_None_class = NULL;
3222 static jmethodID LDKCOption_u128Z_None_meth = NULL;
3223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u128Z_init (JNIEnv *env, jclass clz) {
3224         LDKCOption_u128Z_Some_class =
3225                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u128Z$Some"));
3226         CHECK(LDKCOption_u128Z_Some_class != NULL);
3227         LDKCOption_u128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u128Z_Some_class, "<init>", "([B)V");
3228         CHECK(LDKCOption_u128Z_Some_meth != NULL);
3229         LDKCOption_u128Z_None_class =
3230                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u128Z$None"));
3231         CHECK(LDKCOption_u128Z_None_class != NULL);
3232         LDKCOption_u128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u128Z_None_class, "<init>", "()V");
3233         CHECK(LDKCOption_u128Z_None_meth != NULL);
3234 }
3235 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3236         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
3237         switch(obj->tag) {
3238                 case LDKCOption_u128Z_Some: {
3239                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
3240                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
3241                         return (*env)->NewObject(env, LDKCOption_u128Z_Some_class, LDKCOption_u128Z_Some_meth, some_arr);
3242                 }
3243                 case LDKCOption_u128Z_None: {
3244                         return (*env)->NewObject(env, LDKCOption_u128Z_None_class, LDKCOption_u128Z_None_meth);
3245                 }
3246                 default: abort();
3247         }
3248 }
3249 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
3250 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
3251 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
3252 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
3253 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
3254 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
3255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
3256         LDKSpendableOutputDescriptor_StaticOutput_class =
3257                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
3258         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
3259         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
3260         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
3261         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
3262                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
3263         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
3264         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
3265         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
3266         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
3267                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
3268         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
3269         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
3270         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
3271 }
3272 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3273         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
3274         switch(obj->tag) {
3275                 case LDKSpendableOutputDescriptor_StaticOutput: {
3276                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
3277                         int64_t outpoint_ref = 0;
3278                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
3279                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
3280                         LDKTxOut* output_ref = &obj->static_output.output;
3281                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
3282                 }
3283                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
3284                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
3285                         int64_t delayed_payment_output_ref = 0;
3286                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
3287                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
3288                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
3289                 }
3290                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
3291                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
3292                         int64_t static_payment_output_ref = 0;
3293                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
3294                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
3295                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
3296                 }
3297                 default: abort();
3298         }
3299 }
3300 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
3301         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
3302         for (size_t i = 0; i < ret.datalen; i++) {
3303                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
3304         }
3305         return ret;
3306 }
3307 static jclass LDKEvent_FundingGenerationReady_class = NULL;
3308 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
3309 static jclass LDKEvent_PaymentClaimable_class = NULL;
3310 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
3311 static jclass LDKEvent_PaymentClaimed_class = NULL;
3312 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
3313 static jclass LDKEvent_PaymentSent_class = NULL;
3314 static jmethodID LDKEvent_PaymentSent_meth = NULL;
3315 static jclass LDKEvent_PaymentFailed_class = NULL;
3316 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
3317 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
3318 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
3319 static jclass LDKEvent_PaymentPathFailed_class = NULL;
3320 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
3321 static jclass LDKEvent_ProbeSuccessful_class = NULL;
3322 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
3323 static jclass LDKEvent_ProbeFailed_class = NULL;
3324 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
3325 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
3326 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
3327 static jclass LDKEvent_HTLCIntercepted_class = NULL;
3328 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
3329 static jclass LDKEvent_SpendableOutputs_class = NULL;
3330 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
3331 static jclass LDKEvent_PaymentForwarded_class = NULL;
3332 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
3333 static jclass LDKEvent_ChannelReady_class = NULL;
3334 static jmethodID LDKEvent_ChannelReady_meth = NULL;
3335 static jclass LDKEvent_ChannelClosed_class = NULL;
3336 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
3337 static jclass LDKEvent_DiscardFunding_class = NULL;
3338 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
3339 static jclass LDKEvent_OpenChannelRequest_class = NULL;
3340 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
3341 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
3342 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
3343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
3344         LDKEvent_FundingGenerationReady_class =
3345                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
3346         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
3347         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
3348         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
3349         LDKEvent_PaymentClaimable_class =
3350                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
3351         CHECK(LDKEvent_PaymentClaimable_class != NULL);
3352         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJ[BJ)V");
3353         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
3354         LDKEvent_PaymentClaimed_class =
3355                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
3356         CHECK(LDKEvent_PaymentClaimed_class != NULL);
3357         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ)V");
3358         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
3359         LDKEvent_PaymentSent_class =
3360                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
3361         CHECK(LDKEvent_PaymentSent_class != NULL);
3362         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
3363         CHECK(LDKEvent_PaymentSent_meth != NULL);
3364         LDKEvent_PaymentFailed_class =
3365                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
3366         CHECK(LDKEvent_PaymentFailed_class != NULL);
3367         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
3368         CHECK(LDKEvent_PaymentFailed_meth != NULL);
3369         LDKEvent_PaymentPathSuccessful_class =
3370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
3371         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
3372         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
3373         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
3374         LDKEvent_PaymentPathFailed_class =
3375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
3376         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
3377         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJ[JJJ)V");
3378         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
3379         LDKEvent_ProbeSuccessful_class =
3380                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
3381         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
3382         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[B[J)V");
3383         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
3384         LDKEvent_ProbeFailed_class =
3385                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
3386         CHECK(LDKEvent_ProbeFailed_class != NULL);
3387         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[B[JJ)V");
3388         CHECK(LDKEvent_ProbeFailed_meth != NULL);
3389         LDKEvent_PendingHTLCsForwardable_class =
3390                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
3391         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
3392         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
3393         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
3394         LDKEvent_HTLCIntercepted_class =
3395                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
3396         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
3397         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
3398         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
3399         LDKEvent_SpendableOutputs_class =
3400                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
3401         CHECK(LDKEvent_SpendableOutputs_class != NULL);
3402         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
3403         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
3404         LDKEvent_PaymentForwarded_class =
3405                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
3406         CHECK(LDKEvent_PaymentForwarded_class != NULL);
3407         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
3408         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
3409         LDKEvent_ChannelReady_class =
3410                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
3411         CHECK(LDKEvent_ChannelReady_class != NULL);
3412         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
3413         CHECK(LDKEvent_ChannelReady_meth != NULL);
3414         LDKEvent_ChannelClosed_class =
3415                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
3416         CHECK(LDKEvent_ChannelClosed_class != NULL);
3417         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ)V");
3418         CHECK(LDKEvent_ChannelClosed_meth != NULL);
3419         LDKEvent_DiscardFunding_class =
3420                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
3421         CHECK(LDKEvent_DiscardFunding_class != NULL);
3422         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
3423         CHECK(LDKEvent_DiscardFunding_meth != NULL);
3424         LDKEvent_OpenChannelRequest_class =
3425                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
3426         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
3427         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
3428         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
3429         LDKEvent_HTLCHandlingFailed_class =
3430                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
3431         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
3432         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
3433         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
3434 }
3435 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3436         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
3437         switch(obj->tag) {
3438                 case LDKEvent_FundingGenerationReady: {
3439                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
3440                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
3441                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
3442                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
3443                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
3444                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3445                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
3446                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
3447                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
3448                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
3449                         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);
3450                 }
3451                 case LDKEvent_PaymentClaimable: {
3452                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
3453                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
3454                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3455                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
3456                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
3457                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
3458                         int8_tArray via_channel_id_arr = (*env)->NewByteArray(env, 32);
3459                         (*env)->SetByteArrayRegion(env, via_channel_id_arr, 0, 32, obj->payment_claimable.via_channel_id.data);
3460                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
3461                         return (*env)->NewObject(env, LDKEvent_PaymentClaimable_class, LDKEvent_PaymentClaimable_meth, receiver_node_id_arr, payment_hash_arr, amount_msat_conv, purpose_ref, via_channel_id_arr, via_user_channel_id_ref);
3462                 }
3463                 case LDKEvent_PaymentClaimed: {
3464                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
3465                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
3466                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3467                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
3468                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
3469                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
3470                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, receiver_node_id_arr, payment_hash_arr, amount_msat_conv, purpose_ref);
3471                 }
3472                 case LDKEvent_PaymentSent: {
3473                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3474                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
3475                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
3476                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
3477                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3478                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
3479                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
3480                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
3481                 }
3482                 case LDKEvent_PaymentFailed: {
3483                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3484                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
3485                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3486                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
3487                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
3488                 }
3489                 case LDKEvent_PaymentPathSuccessful: {
3490                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3491                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
3492                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3493                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
3494                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
3495                         int64_tArray path_arr = NULL;
3496                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3497                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3498                         for (size_t k = 0; k < path_var.datalen; k++) {
3499                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3500                                 int64_t path_conv_10_ref = 0;
3501                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3502                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3503                                 path_arr_ptr[k] = path_conv_10_ref;
3504                         }
3505                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3506                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
3507                 }
3508                 case LDKEvent_PaymentPathFailed: {
3509                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3510                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
3511                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3512                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
3513                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
3514                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
3515                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3516                         int64_tArray path_arr = NULL;
3517                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3518                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3519                         for (size_t k = 0; k < path_var.datalen; k++) {
3520                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3521                                 int64_t path_conv_10_ref = 0;
3522                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3523                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3524                                 path_arr_ptr[k] = path_conv_10_ref;
3525                         }
3526                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3527                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
3528                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
3529                         int64_t retry_ref = 0;
3530                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
3531                         retry_ref = tag_ptr(retry_var.inner, false);
3532                         return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, payment_failed_permanently_conv, failure_ref, path_arr, short_channel_id_ref, retry_ref);
3533                 }
3534                 case LDKEvent_ProbeSuccessful: {
3535                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3536                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
3537                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3538                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
3539                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
3540                         int64_tArray path_arr = NULL;
3541                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3542                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3543                         for (size_t k = 0; k < path_var.datalen; k++) {
3544                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3545                                 int64_t path_conv_10_ref = 0;
3546                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3547                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3548                                 path_arr_ptr[k] = path_conv_10_ref;
3549                         }
3550                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3551                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
3552                 }
3553                 case LDKEvent_ProbeFailed: {
3554                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3555                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
3556                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3557                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
3558                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
3559                         int64_tArray path_arr = NULL;
3560                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3561                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3562                         for (size_t k = 0; k < path_var.datalen; k++) {
3563                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3564                                 int64_t path_conv_10_ref = 0;
3565                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3566                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3567                                 path_arr_ptr[k] = path_conv_10_ref;
3568                         }
3569                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3570                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
3571                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref);
3572                 }
3573                 case LDKEvent_PendingHTLCsForwardable: {
3574                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
3575                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
3576                 }
3577                 case LDKEvent_HTLCIntercepted: {
3578                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
3579                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
3580                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
3581                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3582                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
3583                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
3584                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
3585                         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);
3586                 }
3587                 case LDKEvent_SpendableOutputs: {
3588                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3589                         int64_tArray outputs_arr = NULL;
3590                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
3591                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
3592                         for (size_t b = 0; b < outputs_var.datalen; b++) {
3593                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
3594                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
3595                         }
3596                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
3597                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
3598                 }
3599                 case LDKEvent_PaymentForwarded: {
3600                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
3601                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
3602                         int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
3603                         (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
3604                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
3605                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
3606                         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);
3607                 }
3608                 case LDKEvent_ChannelReady: {
3609                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
3610                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
3611                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
3612                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
3613                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
3614                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
3615                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
3616                         int64_t channel_type_ref = 0;
3617                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
3618                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
3619                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
3620                 }
3621                 case LDKEvent_ChannelClosed: {
3622                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
3623                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
3624                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
3625                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
3626                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
3627                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_arr, reason_ref);
3628                 }
3629                 case LDKEvent_DiscardFunding: {
3630                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
3631                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
3632                         LDKTransaction transaction_var = obj->discard_funding.transaction;
3633                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
3634                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
3635                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
3636                 }
3637                 case LDKEvent_OpenChannelRequest: {
3638                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
3639                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
3640                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
3641                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
3642                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
3643                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
3644                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
3645                         int64_t channel_type_ref = 0;
3646                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
3647                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
3648                         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);
3649                 }
3650                 case LDKEvent_HTLCHandlingFailed: {
3651                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
3652                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
3653                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
3654                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
3655                 }
3656                 default: abort();
3657         }
3658 }
3659 static jclass LDKCOption_EventZ_Some_class = NULL;
3660 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
3661 static jclass LDKCOption_EventZ_None_class = NULL;
3662 static jmethodID LDKCOption_EventZ_None_meth = NULL;
3663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
3664         LDKCOption_EventZ_Some_class =
3665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
3666         CHECK(LDKCOption_EventZ_Some_class != NULL);
3667         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
3668         CHECK(LDKCOption_EventZ_Some_meth != NULL);
3669         LDKCOption_EventZ_None_class =
3670                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
3671         CHECK(LDKCOption_EventZ_None_class != NULL);
3672         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
3673         CHECK(LDKCOption_EventZ_None_meth != NULL);
3674 }
3675 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3676         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
3677         switch(obj->tag) {
3678                 case LDKCOption_EventZ_Some: {
3679                         int64_t some_ref = tag_ptr(&obj->some, false);
3680                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
3681                 }
3682                 case LDKCOption_EventZ_None: {
3683                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
3684                 }
3685                 default: abort();
3686         }
3687 }
3688 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3689 CHECK(owner->result_ok);
3690         return COption_EventZ_clone(&*owner->contents.result);
3691 }
3692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3693         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
3694         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
3695         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
3696         int64_t ret_ref = tag_ptr(ret_copy, true);
3697         return ret_ref;
3698 }
3699
3700 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3701 CHECK(!owner->result_ok);
3702         return DecodeError_clone(&*owner->contents.err);
3703 }
3704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3705         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
3706         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3707         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3708         int64_t ret_ref = tag_ptr(ret_copy, true);
3709         return ret_ref;
3710 }
3711
3712 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
3713 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
3714 static jclass LDKErrorAction_IgnoreError_class = NULL;
3715 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
3716 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
3717 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
3718 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
3719 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
3720 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
3721 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
3722 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
3723 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
3724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
3725         LDKErrorAction_DisconnectPeer_class =
3726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
3727         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
3728         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
3729         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
3730         LDKErrorAction_IgnoreError_class =
3731                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
3732         CHECK(LDKErrorAction_IgnoreError_class != NULL);
3733         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
3734         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
3735         LDKErrorAction_IgnoreAndLog_class =
3736                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
3737         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
3738         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
3739         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
3740         LDKErrorAction_IgnoreDuplicateGossip_class =
3741                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
3742         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
3743         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
3744         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
3745         LDKErrorAction_SendErrorMessage_class =
3746                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
3747         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
3748         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
3749         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
3750         LDKErrorAction_SendWarningMessage_class =
3751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
3752         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
3753         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
3754         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
3755 }
3756 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3757         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3758         switch(obj->tag) {
3759                 case LDKErrorAction_DisconnectPeer: {
3760                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3761                         int64_t msg_ref = 0;
3762                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3763                         msg_ref = tag_ptr(msg_var.inner, false);
3764                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
3765                 }
3766                 case LDKErrorAction_IgnoreError: {
3767                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
3768                 }
3769                 case LDKErrorAction_IgnoreAndLog: {
3770                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
3771                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
3772                 }
3773                 case LDKErrorAction_IgnoreDuplicateGossip: {
3774                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
3775                 }
3776                 case LDKErrorAction_SendErrorMessage: {
3777                         LDKErrorMessage msg_var = obj->send_error_message.msg;
3778                         int64_t msg_ref = 0;
3779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3780                         msg_ref = tag_ptr(msg_var.inner, false);
3781                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
3782                 }
3783                 case LDKErrorAction_SendWarningMessage: {
3784                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3785                         int64_t msg_ref = 0;
3786                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3787                         msg_ref = tag_ptr(msg_var.inner, false);
3788                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
3789                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
3790                 }
3791                 default: abort();
3792         }
3793 }
3794 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
3795 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
3796 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
3797 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
3798 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
3799 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
3800 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
3801 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
3802 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
3803 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
3804 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
3805 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
3806 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
3807 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
3808 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
3809 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
3810 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
3811 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
3812 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
3813 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
3814 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
3815 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
3816 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
3817 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
3818 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
3819 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
3820 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
3821 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
3822 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
3823 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
3824 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
3825 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
3826 static jclass LDKMessageSendEvent_HandleError_class = NULL;
3827 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
3828 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
3829 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
3830 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
3831 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
3832 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
3833 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
3834 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
3835 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
3836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
3837         LDKMessageSendEvent_SendAcceptChannel_class =
3838                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
3839         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
3840         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
3841         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
3842         LDKMessageSendEvent_SendOpenChannel_class =
3843                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
3844         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
3845         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
3846         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
3847         LDKMessageSendEvent_SendFundingCreated_class =
3848                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
3849         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
3850         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
3851         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
3852         LDKMessageSendEvent_SendFundingSigned_class =
3853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
3854         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
3855         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
3856         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
3857         LDKMessageSendEvent_SendChannelReady_class =
3858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
3859         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
3860         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
3861         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
3862         LDKMessageSendEvent_SendAnnouncementSignatures_class =
3863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
3864         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
3865         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
3866         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
3867         LDKMessageSendEvent_UpdateHTLCs_class =
3868                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
3869         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
3870         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
3871         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
3872         LDKMessageSendEvent_SendRevokeAndACK_class =
3873                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
3874         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
3875         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
3876         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
3877         LDKMessageSendEvent_SendClosingSigned_class =
3878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
3879         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
3880         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
3881         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
3882         LDKMessageSendEvent_SendShutdown_class =
3883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
3884         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
3885         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
3886         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
3887         LDKMessageSendEvent_SendChannelReestablish_class =
3888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
3889         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
3890         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
3891         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
3892         LDKMessageSendEvent_SendChannelAnnouncement_class =
3893                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
3894         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
3895         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
3896         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
3897         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
3898                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
3899         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
3900         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
3901         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
3902         LDKMessageSendEvent_BroadcastChannelUpdate_class =
3903                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
3904         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
3905         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
3906         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
3907         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
3908                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
3909         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
3910         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
3911         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
3912         LDKMessageSendEvent_SendChannelUpdate_class =
3913                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
3914         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
3915         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
3916         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
3917         LDKMessageSendEvent_HandleError_class =
3918                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
3919         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
3920         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
3921         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
3922         LDKMessageSendEvent_SendChannelRangeQuery_class =
3923                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
3924         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
3925         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
3926         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
3927         LDKMessageSendEvent_SendShortIdsQuery_class =
3928                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
3929         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
3930         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
3931         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
3932         LDKMessageSendEvent_SendReplyChannelRange_class =
3933                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
3934         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
3935         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
3936         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
3937         LDKMessageSendEvent_SendGossipTimestampFilter_class =
3938                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
3939         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
3940         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
3941         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
3942 }
3943 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3944         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3945         switch(obj->tag) {
3946                 case LDKMessageSendEvent_SendAcceptChannel: {
3947                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3948                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
3949                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3950                         int64_t msg_ref = 0;
3951                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3952                         msg_ref = tag_ptr(msg_var.inner, false);
3953                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
3954                 }
3955                 case LDKMessageSendEvent_SendOpenChannel: {
3956                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3957                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
3958                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3959                         int64_t msg_ref = 0;
3960                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3961                         msg_ref = tag_ptr(msg_var.inner, false);
3962                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
3963                 }
3964                 case LDKMessageSendEvent_SendFundingCreated: {
3965                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3966                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
3967                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3968                         int64_t msg_ref = 0;
3969                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3970                         msg_ref = tag_ptr(msg_var.inner, false);
3971                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
3972                 }
3973                 case LDKMessageSendEvent_SendFundingSigned: {
3974                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3975                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
3976                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3977                         int64_t msg_ref = 0;
3978                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3979                         msg_ref = tag_ptr(msg_var.inner, false);
3980                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
3981                 }
3982                 case LDKMessageSendEvent_SendChannelReady: {
3983                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3984                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
3985                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3986                         int64_t msg_ref = 0;
3987                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3988                         msg_ref = tag_ptr(msg_var.inner, false);
3989                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
3990                 }
3991                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
3992                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3993                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
3994                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3995                         int64_t msg_ref = 0;
3996                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3997                         msg_ref = tag_ptr(msg_var.inner, false);
3998                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
3999                 }
4000                 case LDKMessageSendEvent_UpdateHTLCs: {
4001                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4002                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
4003                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4004                         int64_t updates_ref = 0;
4005                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4006                         updates_ref = tag_ptr(updates_var.inner, false);
4007                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
4008                 }
4009                 case LDKMessageSendEvent_SendRevokeAndACK: {
4010                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4011                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
4012                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4013                         int64_t msg_ref = 0;
4014                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4015                         msg_ref = tag_ptr(msg_var.inner, false);
4016                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
4017                 }
4018                 case LDKMessageSendEvent_SendClosingSigned: {
4019                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4020                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
4021                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4022                         int64_t msg_ref = 0;
4023                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4024                         msg_ref = tag_ptr(msg_var.inner, false);
4025                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
4026                 }
4027                 case LDKMessageSendEvent_SendShutdown: {
4028                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4029                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
4030                         LDKShutdown msg_var = obj->send_shutdown.msg;
4031                         int64_t msg_ref = 0;
4032                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4033                         msg_ref = tag_ptr(msg_var.inner, false);
4034                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
4035                 }
4036                 case LDKMessageSendEvent_SendChannelReestablish: {
4037                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4038                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
4039                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4040                         int64_t msg_ref = 0;
4041                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4042                         msg_ref = tag_ptr(msg_var.inner, false);
4043                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
4044                 }
4045                 case LDKMessageSendEvent_SendChannelAnnouncement: {
4046                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4047                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
4048                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4049                         int64_t msg_ref = 0;
4050                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4051                         msg_ref = tag_ptr(msg_var.inner, false);
4052                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4053                         int64_t update_msg_ref = 0;
4054                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4055                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4056                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
4057                 }
4058                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
4059                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4060                         int64_t msg_ref = 0;
4061                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4062                         msg_ref = tag_ptr(msg_var.inner, false);
4063                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4064                         int64_t update_msg_ref = 0;
4065                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4066                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4067                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
4068                 }
4069                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
4070                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4071                         int64_t msg_ref = 0;
4072                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4073                         msg_ref = tag_ptr(msg_var.inner, false);
4074                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
4075                 }
4076                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
4077                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4078                         int64_t msg_ref = 0;
4079                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4080                         msg_ref = tag_ptr(msg_var.inner, false);
4081                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
4082                 }
4083                 case LDKMessageSendEvent_SendChannelUpdate: {
4084                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4085                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
4086                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4087                         int64_t msg_ref = 0;
4088                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4089                         msg_ref = tag_ptr(msg_var.inner, false);
4090                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
4091                 }
4092                 case LDKMessageSendEvent_HandleError: {
4093                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4094                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
4095                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4096                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
4097                 }
4098                 case LDKMessageSendEvent_SendChannelRangeQuery: {
4099                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4100                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
4101                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4102                         int64_t msg_ref = 0;
4103                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4104                         msg_ref = tag_ptr(msg_var.inner, false);
4105                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
4106                 }
4107                 case LDKMessageSendEvent_SendShortIdsQuery: {
4108                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4109                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
4110                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4111                         int64_t msg_ref = 0;
4112                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4113                         msg_ref = tag_ptr(msg_var.inner, false);
4114                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
4115                 }
4116                 case LDKMessageSendEvent_SendReplyChannelRange: {
4117                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4118                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
4119                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4120                         int64_t msg_ref = 0;
4121                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4122                         msg_ref = tag_ptr(msg_var.inner, false);
4123                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
4124                 }
4125                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
4126                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
4127                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
4128                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4129                         int64_t msg_ref = 0;
4130                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4131                         msg_ref = tag_ptr(msg_var.inner, false);
4132                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
4133                 }
4134                 default: abort();
4135         }
4136 }
4137 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4138         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4139         for (size_t i = 0; i < ret.datalen; i++) {
4140                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4141         }
4142         return ret;
4143 }
4144 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4145         return owner->a;
4146 }
4147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4148         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4149         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
4150         return ret_conv;
4151 }
4152
4153 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4154         return owner->b;
4155 }
4156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4157         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4158         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
4159         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4160         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4161         return ret_arr;
4162 }
4163
4164 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
4165         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
4166         for (size_t i = 0; i < ret.datalen; i++) {
4167                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
4168         }
4169         return ret;
4170 }
4171 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
4172         return ThirtyTwoBytes_clone(&owner->a);
4173 }
4174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidBlockHashZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4175         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
4176         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4177         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data);
4178         return ret_arr;
4179 }
4180
4181 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
4182         return ThirtyTwoBytes_clone(&owner->b);
4183 }
4184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidBlockHashZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4185         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
4186         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4187         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data);
4188         return ret_arr;
4189 }
4190
4191 static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) {
4192         LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen };
4193         for (size_t i = 0; i < ret.datalen; i++) {
4194                 ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]);
4195         }
4196         return ret;
4197 }
4198 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
4199 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
4200 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
4201 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
4202 static jclass LDKMonitorEvent_Completed_class = NULL;
4203 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
4204 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
4205 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
4206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
4207         LDKMonitorEvent_HTLCEvent_class =
4208                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
4209         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
4210         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
4211         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
4212         LDKMonitorEvent_CommitmentTxConfirmed_class =
4213                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
4214         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
4215         LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
4216         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
4217         LDKMonitorEvent_Completed_class =
4218                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
4219         CHECK(LDKMonitorEvent_Completed_class != NULL);
4220         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
4221         CHECK(LDKMonitorEvent_Completed_meth != NULL);
4222         LDKMonitorEvent_UpdateFailed_class =
4223                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
4224         CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
4225         LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
4226         CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
4227 }
4228 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4229         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
4230         switch(obj->tag) {
4231                 case LDKMonitorEvent_HTLCEvent: {
4232                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
4233                         int64_t htlc_event_ref = 0;
4234                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
4235                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
4236                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
4237                 }
4238                 case LDKMonitorEvent_CommitmentTxConfirmed: {
4239                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
4240                         int64_t commitment_tx_confirmed_ref = 0;
4241                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
4242                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
4243                         return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
4244                 }
4245                 case LDKMonitorEvent_Completed: {
4246                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
4247                         int64_t funding_txo_ref = 0;
4248                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4249                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
4250                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
4251                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
4252                 }
4253                 case LDKMonitorEvent_UpdateFailed: {
4254                         LDKOutPoint update_failed_var = obj->update_failed;
4255                         int64_t update_failed_ref = 0;
4256                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
4257                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
4258                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
4259                 }
4260                 default: abort();
4261         }
4262 }
4263 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
4264         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
4265         for (size_t i = 0; i < ret.datalen; i++) {
4266                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
4267         }
4268         return ret;
4269 }
4270 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4271         LDKOutPoint ret = owner->a;
4272         ret.is_owned = false;
4273         return ret;
4274 }
4275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4276         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4277         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
4278         int64_t ret_ref = 0;
4279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4281         return ret_ref;
4282 }
4283
4284 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4285         return CVec_MonitorEventZ_clone(&owner->b);
4286 }
4287 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4288         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4289         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
4290         int64_tArray ret_arr = NULL;
4291         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4292         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4293         for (size_t o = 0; o < ret_var.datalen; o++) {
4294                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4295                 *ret_conv_14_copy = ret_var.data[o];
4296                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
4297                 ret_arr_ptr[o] = ret_conv_14_ref;
4298         }
4299         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4300         FREE(ret_var.data);
4301         return ret_arr;
4302 }
4303
4304 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4305         return owner->c;
4306 }
4307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
4308         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4309         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4310         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
4311         return ret_arr;
4312 }
4313
4314 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
4315         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
4316         for (size_t i = 0; i < ret.datalen; i++) {
4317                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
4318         }
4319         return ret;
4320 }
4321 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4322         LDKFixedPenaltyScorer ret = *owner->contents.result;
4323         ret.is_owned = false;
4324         return ret;
4325 }
4326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4327         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4328         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4329         int64_t ret_ref = 0;
4330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4332         return ret_ref;
4333 }
4334
4335 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4336 CHECK(!owner->result_ok);
4337         return DecodeError_clone(&*owner->contents.err);
4338 }
4339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4340         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4341         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4342         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4343         int64_t ret_ref = tag_ptr(ret_copy, true);
4344         return ret_ref;
4345 }
4346
4347 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4348         return owner->a;
4349 }
4350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4351         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4352         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4353         return ret_conv;
4354 }
4355
4356 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4357         return owner->b;
4358 }
4359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4360         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4361         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4362         return ret_conv;
4363 }
4364
4365 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4366 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4367 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4368 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4370         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4371                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4372         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4373         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4374         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4375         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4376                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4377         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4378         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4379         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4380 }
4381 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4382         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4383         switch(obj->tag) {
4384                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4385                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4386                         *some_conv = obj->some;
4387                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4388                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4389                 }
4390                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4391                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4392                 }
4393                 default: abort();
4394         }
4395 }
4396 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4397         return owner->a;
4398 }
4399 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4400         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4401         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4402         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_a(owner_conv).data);
4403         return ret_arr;
4404 }
4405
4406 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4407         return owner->b;
4408 }
4409 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4410         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4411         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4412         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_b(owner_conv).data);
4413         return ret_arr;
4414 }
4415
4416 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
4417         return owner->a;
4418 }
4419 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4420         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
4421         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4422         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_a(owner_conv).data);
4423         return ret_arr;
4424 }
4425
4426 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
4427         return owner->b;
4428 }
4429 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4430         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
4431         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4432         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_b(owner_conv).data);
4433         return ret_arr;
4434 }
4435
4436 static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class = NULL;
4437 static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = NULL;
4438 static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class = NULL;
4439 static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = NULL;
4440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_init (JNIEnv *env, jclass clz) {
4441         LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class =
4442                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$Some"));
4443         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class != NULL);
4444         LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, "<init>", "(J)V");
4445         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth != NULL);
4446         LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class =
4447                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$None"));
4448         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class != NULL);
4449         LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, "<init>", "()V");
4450         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth != NULL);
4451 }
4452 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4453         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
4454         switch(obj->tag) {
4455                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: {
4456                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
4457                         *some_conv = obj->some;
4458                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
4459                         return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth, tag_ptr(some_conv, true));
4460                 }
4461                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: {
4462                         return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth);
4463                 }
4464                 default: abort();
4465         }
4466 }
4467 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4468         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4469         for (size_t i = 0; i < ret.datalen; i++) {
4470                 ret.data[i] = NodeId_clone(&orig->data[i]);
4471         }
4472         return ret;
4473 }
4474 typedef struct LDKLogger_JCalls {
4475         atomic_size_t refcnt;
4476         JavaVM *vm;
4477         jweak o;
4478         jmethodID log_meth;
4479 } LDKLogger_JCalls;
4480 static void LDKLogger_JCalls_free(void* this_arg) {
4481         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4482         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4483                 JNIEnv *env;
4484                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4485                 if (get_jenv_res == JNI_EDETACHED) {
4486                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4487                 } else {
4488                         DO_ASSERT(get_jenv_res == JNI_OK);
4489                 }
4490                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4491                 if (get_jenv_res == JNI_EDETACHED) {
4492                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4493                 }
4494                 FREE(j_calls);
4495         }
4496 }
4497 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4498         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4499         JNIEnv *env;
4500         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4501         if (get_jenv_res == JNI_EDETACHED) {
4502                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4503         } else {
4504                 DO_ASSERT(get_jenv_res == JNI_OK);
4505         }
4506         LDKRecord record_var = *record;
4507         int64_t record_ref = 0;
4508         record_var = Record_clone(&record_var);
4509         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4510         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4511         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4512         CHECK(obj != NULL);
4513         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4514         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4515                 (*env)->ExceptionDescribe(env);
4516                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4517         }
4518         if (get_jenv_res == JNI_EDETACHED) {
4519                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4520         }
4521 }
4522 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4523         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4524         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4525 }
4526 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4527         jclass c = (*env)->GetObjectClass(env, o);
4528         CHECK(c != NULL);
4529         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4530         atomic_init(&calls->refcnt, 1);
4531         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4532         calls->o = (*env)->NewWeakGlobalRef(env, o);
4533         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4534         CHECK(calls->log_meth != NULL);
4535
4536         LDKLogger ret = {
4537                 .this_arg = (void*) calls,
4538                 .log = log_LDKLogger_jcall,
4539                 .free = LDKLogger_JCalls_free,
4540         };
4541         return ret;
4542 }
4543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4544         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4545         *res_ptr = LDKLogger_init(env, clz, o);
4546         return tag_ptr(res_ptr, true);
4547 }
4548 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4549         LDKProbabilisticScorer ret = *owner->contents.result;
4550         ret.is_owned = false;
4551         return ret;
4552 }
4553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4554         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4555         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4556         int64_t ret_ref = 0;
4557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4559         return ret_ref;
4560 }
4561
4562 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4563 CHECK(!owner->result_ok);
4564         return DecodeError_clone(&*owner->contents.err);
4565 }
4566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4567         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4568         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4569         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
4570         int64_t ret_ref = tag_ptr(ret_copy, true);
4571         return ret_ref;
4572 }
4573
4574 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4575         LDKInitFeatures ret = *owner->contents.result;
4576         ret.is_owned = false;
4577         return ret;
4578 }
4579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4580         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4581         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4582         int64_t ret_ref = 0;
4583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4585         return ret_ref;
4586 }
4587
4588 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4589 CHECK(!owner->result_ok);
4590         return DecodeError_clone(&*owner->contents.err);
4591 }
4592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4593         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4594         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4595         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4596         int64_t ret_ref = tag_ptr(ret_copy, true);
4597         return ret_ref;
4598 }
4599
4600 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4601         LDKChannelFeatures ret = *owner->contents.result;
4602         ret.is_owned = false;
4603         return ret;
4604 }
4605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4606         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4607         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4608         int64_t ret_ref = 0;
4609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4611         return ret_ref;
4612 }
4613
4614 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4615 CHECK(!owner->result_ok);
4616         return DecodeError_clone(&*owner->contents.err);
4617 }
4618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4619         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4620         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4621         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4622         int64_t ret_ref = tag_ptr(ret_copy, true);
4623         return ret_ref;
4624 }
4625
4626 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4627         LDKNodeFeatures ret = *owner->contents.result;
4628         ret.is_owned = false;
4629         return ret;
4630 }
4631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4632         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4633         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
4634         int64_t ret_ref = 0;
4635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4637         return ret_ref;
4638 }
4639
4640 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4641 CHECK(!owner->result_ok);
4642         return DecodeError_clone(&*owner->contents.err);
4643 }
4644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4645         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4646         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4647         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
4648         int64_t ret_ref = tag_ptr(ret_copy, true);
4649         return ret_ref;
4650 }
4651
4652 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4653         LDKInvoiceFeatures ret = *owner->contents.result;
4654         ret.is_owned = false;
4655         return ret;
4656 }
4657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4658         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4659         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4660         int64_t ret_ref = 0;
4661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4663         return ret_ref;
4664 }
4665
4666 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4667 CHECK(!owner->result_ok);
4668         return DecodeError_clone(&*owner->contents.err);
4669 }
4670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4671         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4672         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4673         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4674         int64_t ret_ref = tag_ptr(ret_copy, true);
4675         return ret_ref;
4676 }
4677
4678 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4679         LDKBlindedHopFeatures ret = *owner->contents.result;
4680         ret.is_owned = false;
4681         return ret;
4682 }
4683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4684         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4685         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
4686         int64_t ret_ref = 0;
4687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4689         return ret_ref;
4690 }
4691
4692 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4693 CHECK(!owner->result_ok);
4694         return DecodeError_clone(&*owner->contents.err);
4695 }
4696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4697         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4698         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4699         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
4700         int64_t ret_ref = tag_ptr(ret_copy, true);
4701         return ret_ref;
4702 }
4703
4704 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4705         LDKChannelTypeFeatures ret = *owner->contents.result;
4706         ret.is_owned = false;
4707         return ret;
4708 }
4709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4710         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4711         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4712         int64_t ret_ref = 0;
4713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4715         return ret_ref;
4716 }
4717
4718 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4719 CHECK(!owner->result_ok);
4720         return DecodeError_clone(&*owner->contents.err);
4721 }
4722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4723         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4724         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4725         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4726         int64_t ret_ref = tag_ptr(ret_copy, true);
4727         return ret_ref;
4728 }
4729
4730 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4731         LDKNodeId ret = *owner->contents.result;
4732         ret.is_owned = false;
4733         return ret;
4734 }
4735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4736         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4737         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
4738         int64_t ret_ref = 0;
4739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4741         return ret_ref;
4742 }
4743
4744 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4745 CHECK(!owner->result_ok);
4746         return DecodeError_clone(&*owner->contents.err);
4747 }
4748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4749         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4750         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4751         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
4752         int64_t ret_ref = tag_ptr(ret_copy, true);
4753         return ret_ref;
4754 }
4755
4756 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4757 CHECK(owner->result_ok);
4758         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
4759 }
4760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4761         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4762         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
4763         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
4764         int64_t ret_ref = tag_ptr(ret_copy, true);
4765         return ret_ref;
4766 }
4767
4768 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4769 CHECK(!owner->result_ok);
4770         return DecodeError_clone(&*owner->contents.err);
4771 }
4772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4773         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4775         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
4776         int64_t ret_ref = tag_ptr(ret_copy, true);
4777         return ret_ref;
4778 }
4779
4780 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4781 CHECK(owner->result_ok);
4782         return TxOut_clone(&*owner->contents.result);
4783 }
4784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4785         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4786         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
4787         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
4788         return tag_ptr(ret_ref, true);
4789 }
4790
4791 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4792 CHECK(!owner->result_ok);
4793         return UtxoLookupError_clone(&*owner->contents.err);
4794 }
4795 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4796         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4797         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
4798         return ret_conv;
4799 }
4800
4801 static jclass LDKUtxoResult_Sync_class = NULL;
4802 static jmethodID LDKUtxoResult_Sync_meth = NULL;
4803 static jclass LDKUtxoResult_Async_class = NULL;
4804 static jmethodID LDKUtxoResult_Async_meth = NULL;
4805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
4806         LDKUtxoResult_Sync_class =
4807                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
4808         CHECK(LDKUtxoResult_Sync_class != NULL);
4809         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
4810         CHECK(LDKUtxoResult_Sync_meth != NULL);
4811         LDKUtxoResult_Async_class =
4812                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
4813         CHECK(LDKUtxoResult_Async_class != NULL);
4814         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
4815         CHECK(LDKUtxoResult_Async_meth != NULL);
4816 }
4817 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4818         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4819         switch(obj->tag) {
4820                 case LDKUtxoResult_Sync: {
4821                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
4822                         *sync_conv = obj->sync;
4823                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
4824                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
4825                 }
4826                 case LDKUtxoResult_Async: {
4827                         LDKUtxoFuture async_var = obj->async;
4828                         int64_t async_ref = 0;
4829                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
4830                         async_ref = tag_ptr(async_var.inner, false);
4831                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
4832                 }
4833                 default: abort();
4834         }
4835 }
4836 typedef struct LDKUtxoLookup_JCalls {
4837         atomic_size_t refcnt;
4838         JavaVM *vm;
4839         jweak o;
4840         jmethodID get_utxo_meth;
4841 } LDKUtxoLookup_JCalls;
4842 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
4843         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4844         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4845                 JNIEnv *env;
4846                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4847                 if (get_jenv_res == JNI_EDETACHED) {
4848                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4849                 } else {
4850                         DO_ASSERT(get_jenv_res == JNI_OK);
4851                 }
4852                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4853                 if (get_jenv_res == JNI_EDETACHED) {
4854                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4855                 }
4856                 FREE(j_calls);
4857         }
4858 }
4859 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4860         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4861         JNIEnv *env;
4862         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4863         if (get_jenv_res == JNI_EDETACHED) {
4864                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4865         } else {
4866                 DO_ASSERT(get_jenv_res == JNI_OK);
4867         }
4868         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4869         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4870         int64_t short_channel_id_conv = short_channel_id;
4871         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4872         CHECK(obj != NULL);
4873         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
4874         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4875                 (*env)->ExceptionDescribe(env);
4876                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
4877         }
4878         void* ret_ptr = untag_ptr(ret);
4879         CHECK_ACCESS(ret_ptr);
4880         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
4881         FREE(untag_ptr(ret));
4882         if (get_jenv_res == JNI_EDETACHED) {
4883                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4884         }
4885         return ret_conv;
4886 }
4887 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
4888         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
4889         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4890 }
4891 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
4892         jclass c = (*env)->GetObjectClass(env, o);
4893         CHECK(c != NULL);
4894         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
4895         atomic_init(&calls->refcnt, 1);
4896         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4897         calls->o = (*env)->NewWeakGlobalRef(env, o);
4898         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4899         CHECK(calls->get_utxo_meth != NULL);
4900
4901         LDKUtxoLookup ret = {
4902                 .this_arg = (void*) calls,
4903                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
4904                 .free = LDKUtxoLookup_JCalls_free,
4905         };
4906         return ret;
4907 }
4908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
4909         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4910         *res_ptr = LDKUtxoLookup_init(env, clz, o);
4911         return tag_ptr(res_ptr, true);
4912 }
4913 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) {
4914         void* this_arg_ptr = untag_ptr(this_arg);
4915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4916         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
4917         uint8_t genesis_hash_arr[32];
4918         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4919         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4920         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
4921         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
4922         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4923         int64_t ret_ref = tag_ptr(ret_copy, true);
4924         return ret_ref;
4925 }
4926
4927 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
4928 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
4929 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
4930 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
4931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
4932         LDKCOption_UtxoLookupZ_Some_class =
4933                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
4934         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
4935         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
4936         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
4937         LDKCOption_UtxoLookupZ_None_class =
4938                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
4939         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
4940         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
4941         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
4942 }
4943 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4944         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4945         switch(obj->tag) {
4946                 case LDKCOption_UtxoLookupZ_Some: {
4947                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4948                         *some_ret = obj->some;
4949                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4950                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
4951                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4952                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
4953                         }
4954                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
4955                 }
4956                 case LDKCOption_UtxoLookupZ_None: {
4957                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
4958                 }
4959                 default: abort();
4960         }
4961 }
4962 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4963 CHECK(owner->result_ok);
4964         return *owner->contents.result;
4965 }
4966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4967         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4968         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4969         return ret_conv;
4970 }
4971
4972 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4973         LDKLightningError ret = *owner->contents.err;
4974         ret.is_owned = false;
4975         return ret;
4976 }
4977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4978         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4979         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4980         int64_t ret_ref = 0;
4981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4983         return ret_ref;
4984 }
4985
4986 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4987         LDKChannelAnnouncement ret = owner->a;
4988         ret.is_owned = false;
4989         return ret;
4990 }
4991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4992         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4993         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4994         int64_t ret_ref = 0;
4995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4997         return ret_ref;
4998 }
4999
5000 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5001         LDKChannelUpdate ret = owner->b;
5002         ret.is_owned = false;
5003         return ret;
5004 }
5005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5006         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5007         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5008         int64_t ret_ref = 0;
5009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5011         return ret_ref;
5012 }
5013
5014 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5015         LDKChannelUpdate ret = owner->c;
5016         ret.is_owned = false;
5017         return ret;
5018 }
5019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5020         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5021         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5022         int64_t ret_ref = 0;
5023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5025         return ret_ref;
5026 }
5027
5028 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5029 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5030 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5031 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5033         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5034                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5035         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5036         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5037         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5038         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5039                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5040         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
5041         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
5042         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
5043 }
5044 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5045         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5046         switch(obj->tag) {
5047                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
5048                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5049                         *some_conv = obj->some;
5050                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5051                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
5052                 }
5053                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
5054                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
5055                 }
5056                 default: abort();
5057         }
5058 }
5059 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5060 CHECK(owner->result_ok);
5061         return *owner->contents.result;
5062 }
5063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5064         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5065         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5066 }
5067
5068 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5069         LDKLightningError ret = *owner->contents.err;
5070         ret.is_owned = false;
5071         return ret;
5072 }
5073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5074         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5075         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5076         int64_t ret_ref = 0;
5077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5079         return ret_ref;
5080 }
5081
5082 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5083         LDKChannelUpdateInfo ret = *owner->contents.result;
5084         ret.is_owned = false;
5085         return ret;
5086 }
5087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5088         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5089         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
5090         int64_t ret_ref = 0;
5091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5093         return ret_ref;
5094 }
5095
5096 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5097 CHECK(!owner->result_ok);
5098         return DecodeError_clone(&*owner->contents.err);
5099 }
5100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5101         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5102         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5103         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
5104         int64_t ret_ref = tag_ptr(ret_copy, true);
5105         return ret_ref;
5106 }
5107
5108 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5109         LDKChannelInfo ret = *owner->contents.result;
5110         ret.is_owned = false;
5111         return ret;
5112 }
5113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5114         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5115         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
5116         int64_t ret_ref = 0;
5117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5119         return ret_ref;
5120 }
5121
5122 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5123 CHECK(!owner->result_ok);
5124         return DecodeError_clone(&*owner->contents.err);
5125 }
5126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5127         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5128         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5129         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
5130         int64_t ret_ref = tag_ptr(ret_copy, true);
5131         return ret_ref;
5132 }
5133
5134 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5135         LDKRoutingFees ret = *owner->contents.result;
5136         ret.is_owned = false;
5137         return ret;
5138 }
5139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5140         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5141         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
5142         int64_t ret_ref = 0;
5143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5145         return ret_ref;
5146 }
5147
5148 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5149 CHECK(!owner->result_ok);
5150         return DecodeError_clone(&*owner->contents.err);
5151 }
5152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5153         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5154         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5155         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
5156         int64_t ret_ref = tag_ptr(ret_copy, true);
5157         return ret_ref;
5158 }
5159
5160 static jclass LDKNetAddress_IPv4_class = NULL;
5161 static jmethodID LDKNetAddress_IPv4_meth = NULL;
5162 static jclass LDKNetAddress_IPv6_class = NULL;
5163 static jmethodID LDKNetAddress_IPv6_meth = NULL;
5164 static jclass LDKNetAddress_OnionV2_class = NULL;
5165 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
5166 static jclass LDKNetAddress_OnionV3_class = NULL;
5167 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
5168 static jclass LDKNetAddress_Hostname_class = NULL;
5169 static jmethodID LDKNetAddress_Hostname_meth = NULL;
5170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
5171         LDKNetAddress_IPv4_class =
5172                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
5173         CHECK(LDKNetAddress_IPv4_class != NULL);
5174         LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
5175         CHECK(LDKNetAddress_IPv4_meth != NULL);
5176         LDKNetAddress_IPv6_class =
5177                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
5178         CHECK(LDKNetAddress_IPv6_class != NULL);
5179         LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
5180         CHECK(LDKNetAddress_IPv6_meth != NULL);
5181         LDKNetAddress_OnionV2_class =
5182                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
5183         CHECK(LDKNetAddress_OnionV2_class != NULL);
5184         LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
5185         CHECK(LDKNetAddress_OnionV2_meth != NULL);
5186         LDKNetAddress_OnionV3_class =
5187                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
5188         CHECK(LDKNetAddress_OnionV3_class != NULL);
5189         LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
5190         CHECK(LDKNetAddress_OnionV3_meth != NULL);
5191         LDKNetAddress_Hostname_class =
5192                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
5193         CHECK(LDKNetAddress_Hostname_class != NULL);
5194         LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
5195         CHECK(LDKNetAddress_Hostname_meth != NULL);
5196 }
5197 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5198         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5199         switch(obj->tag) {
5200                 case LDKNetAddress_IPv4: {
5201                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
5202                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
5203                         int16_t port_conv = obj->i_pv4.port;
5204                         return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
5205                 }
5206                 case LDKNetAddress_IPv6: {
5207                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
5208                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
5209                         int16_t port_conv = obj->i_pv6.port;
5210                         return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
5211                 }
5212                 case LDKNetAddress_OnionV2: {
5213                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
5214                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
5215                         return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
5216                 }
5217                 case LDKNetAddress_OnionV3: {
5218                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
5219                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
5220                         int16_t checksum_conv = obj->onion_v3.checksum;
5221                         int8_t version_conv = obj->onion_v3.version;
5222                         int16_t port_conv = obj->onion_v3.port;
5223                         return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
5224                 }
5225                 case LDKNetAddress_Hostname: {
5226                         LDKHostname hostname_var = obj->hostname.hostname;
5227                         int64_t hostname_ref = 0;
5228                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
5229                         hostname_ref = tag_ptr(hostname_var.inner, false);
5230                         int16_t port_conv = obj->hostname.port;
5231                         return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
5232                 }
5233                 default: abort();
5234         }
5235 }
5236 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
5237         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
5238         for (size_t i = 0; i < ret.datalen; i++) {
5239                 ret.data[i] = NetAddress_clone(&orig->data[i]);
5240         }
5241         return ret;
5242 }
5243 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5244         LDKNodeAnnouncementInfo ret = *owner->contents.result;
5245         ret.is_owned = false;
5246         return ret;
5247 }
5248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5249         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5250         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
5251         int64_t ret_ref = 0;
5252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5254         return ret_ref;
5255 }
5256
5257 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5258 CHECK(!owner->result_ok);
5259         return DecodeError_clone(&*owner->contents.err);
5260 }
5261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5262         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5263         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5264         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
5265         int64_t ret_ref = tag_ptr(ret_copy, true);
5266         return ret_ref;
5267 }
5268
5269 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5270         LDKNodeAlias ret = *owner->contents.result;
5271         ret.is_owned = false;
5272         return ret;
5273 }
5274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5275         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5276         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
5277         int64_t ret_ref = 0;
5278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5280         return ret_ref;
5281 }
5282
5283 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5284 CHECK(!owner->result_ok);
5285         return DecodeError_clone(&*owner->contents.err);
5286 }
5287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5288         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5289         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5290         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5291         int64_t ret_ref = tag_ptr(ret_copy, true);
5292         return ret_ref;
5293 }
5294
5295 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5296         LDKNodeInfo ret = *owner->contents.result;
5297         ret.is_owned = false;
5298         return ret;
5299 }
5300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5301         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5302         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5303         int64_t ret_ref = 0;
5304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5306         return ret_ref;
5307 }
5308
5309 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5310 CHECK(!owner->result_ok);
5311         return DecodeError_clone(&*owner->contents.err);
5312 }
5313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5314         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5315         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5316         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5317         int64_t ret_ref = tag_ptr(ret_copy, true);
5318         return ret_ref;
5319 }
5320
5321 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5322         LDKNetworkGraph ret = *owner->contents.result;
5323         ret.is_owned = false;
5324         return ret;
5325 }
5326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5327         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5328         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5329         int64_t ret_ref = 0;
5330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5332         return ret_ref;
5333 }
5334
5335 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5336 CHECK(!owner->result_ok);
5337         return DecodeError_clone(&*owner->contents.err);
5338 }
5339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5340         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5341         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5342         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5343         int64_t ret_ref = tag_ptr(ret_copy, true);
5344         return ret_ref;
5345 }
5346
5347 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
5348 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
5349 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
5350 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
5351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
5352         LDKCOption_CVec_NetAddressZZ_Some_class =
5353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
5354         CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
5355         LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
5356         CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
5357         LDKCOption_CVec_NetAddressZZ_None_class =
5358                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
5359         CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
5360         LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
5361         CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
5362 }
5363 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5364         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
5365         switch(obj->tag) {
5366                 case LDKCOption_CVec_NetAddressZZ_Some: {
5367                         LDKCVec_NetAddressZ some_var = obj->some;
5368                         int64_tArray some_arr = NULL;
5369                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
5370                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
5371                         for (size_t m = 0; m < some_var.datalen; m++) {
5372                                 int64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
5373                                 some_arr_ptr[m] = some_conv_12_ref;
5374                         }
5375                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
5376                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
5377                 }
5378                 case LDKCOption_CVec_NetAddressZZ_None: {
5379                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
5380                 }
5381                 default: abort();
5382         }
5383 }
5384 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5385         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
5386         ret.is_owned = false;
5387         return ret;
5388 }
5389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5390         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
5391         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5392         int64_t ret_ref = 0;
5393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5395         return ret_ref;
5396 }
5397
5398 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5399 CHECK(!owner->result_ok);
5400         return DecodeError_clone(&*owner->contents.err);
5401 }
5402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5403         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
5404         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5405         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5406         int64_t ret_ref = tag_ptr(ret_copy, true);
5407         return ret_ref;
5408 }
5409
5410 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5411         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
5412         ret.is_owned = false;
5413         return ret;
5414 }
5415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5416         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
5417         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5418         int64_t ret_ref = 0;
5419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5421         return ret_ref;
5422 }
5423
5424 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5425 CHECK(!owner->result_ok);
5426         return DecodeError_clone(&*owner->contents.err);
5427 }
5428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5429         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
5430         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5431         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5432         int64_t ret_ref = tag_ptr(ret_copy, true);
5433         return ret_ref;
5434 }
5435
5436 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5437 CHECK(owner->result_ok);
5438         return SpendableOutputDescriptor_clone(&*owner->contents.result);
5439 }
5440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5441         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
5442         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
5443         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5444         int64_t ret_ref = tag_ptr(ret_copy, true);
5445         return ret_ref;
5446 }
5447
5448 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5449 CHECK(!owner->result_ok);
5450         return DecodeError_clone(&*owner->contents.err);
5451 }
5452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5453         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
5454         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5455         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5456         int64_t ret_ref = tag_ptr(ret_copy, true);
5457         return ret_ref;
5458 }
5459
5460 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
5461         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
5462         for (size_t i = 0; i < ret.datalen; i++) {
5463                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5464         }
5465         return ret;
5466 }
5467 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
5468         return owner->a;
5469 }
5470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5471         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
5472         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
5473         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
5474         return ret_arr;
5475 }
5476
5477 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
5478         return owner->b;
5479 }
5480 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5481         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
5482         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
5483         jobjectArray ret_arr = NULL;
5484         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5485         ;
5486         for (size_t i = 0; i < ret_var.datalen; i++) {
5487                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
5488                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
5489                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5490         }
5491         
5492         return ret_arr;
5493 }
5494
5495 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
5496 CHECK(owner->result_ok);
5497         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
5498 }
5499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5500         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
5501         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5502         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
5503         return tag_ptr(ret_conv, true);
5504 }
5505
5506 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
5507 CHECK(!owner->result_ok);
5508         return *owner->contents.err;
5509 }
5510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5511         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
5512         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
5513 }
5514
5515 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
5516 CHECK(owner->result_ok);
5517         return *owner->contents.result;
5518 }
5519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5520         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
5521         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
5522         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
5523         return ret_arr;
5524 }
5525
5526 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
5527 CHECK(!owner->result_ok);
5528         return *owner->contents.err;
5529 }
5530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5531         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
5532         CResult_SignatureNoneZ_get_err(owner_conv);
5533 }
5534
5535 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
5536 CHECK(owner->result_ok);
5537         return *owner->contents.result;
5538 }
5539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5540         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
5541         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5542         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
5543         return ret_arr;
5544 }
5545
5546 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
5547 CHECK(!owner->result_ok);
5548         return *owner->contents.err;
5549 }
5550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5551         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
5552         CResult_PublicKeyNoneZ_get_err(owner_conv);
5553 }
5554
5555 static jclass LDKCOption_ScalarZ_Some_class = NULL;
5556 static jmethodID LDKCOption_ScalarZ_Some_meth = NULL;
5557 static jclass LDKCOption_ScalarZ_None_class = NULL;
5558 static jmethodID LDKCOption_ScalarZ_None_meth = NULL;
5559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ScalarZ_init (JNIEnv *env, jclass clz) {
5560         LDKCOption_ScalarZ_Some_class =
5561                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$Some"));
5562         CHECK(LDKCOption_ScalarZ_Some_class != NULL);
5563         LDKCOption_ScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_Some_class, "<init>", "(J)V");
5564         CHECK(LDKCOption_ScalarZ_Some_meth != NULL);
5565         LDKCOption_ScalarZ_None_class =
5566                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$None"));
5567         CHECK(LDKCOption_ScalarZ_None_class != NULL);
5568         LDKCOption_ScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_None_class, "<init>", "()V");
5569         CHECK(LDKCOption_ScalarZ_None_meth != NULL);
5570 }
5571 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5572         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
5573         switch(obj->tag) {
5574                 case LDKCOption_ScalarZ_Some: {
5575                         LDKBigEndianScalar* some_ref = &obj->some;
5576                         return (*env)->NewObject(env, LDKCOption_ScalarZ_Some_class, LDKCOption_ScalarZ_Some_meth, tag_ptr(some_ref, false));
5577                 }
5578                 case LDKCOption_ScalarZ_None: {
5579                         return (*env)->NewObject(env, LDKCOption_ScalarZ_None_class, LDKCOption_ScalarZ_None_meth);
5580                 }
5581                 default: abort();
5582         }
5583 }
5584 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
5585 CHECK(owner->result_ok);
5586         return ThirtyTwoBytes_clone(&*owner->contents.result);
5587 }
5588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5589         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
5590         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5591         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SharedSecretNoneZ_get_ok(owner_conv).data);
5592         return ret_arr;
5593 }
5594
5595 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
5596 CHECK(!owner->result_ok);
5597         return *owner->contents.err;
5598 }
5599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5600         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
5601         CResult_SharedSecretNoneZ_get_err(owner_conv);
5602 }
5603
5604 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5605 CHECK(owner->result_ok);
5606         return *owner->contents.result;
5607 }
5608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5609         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5610         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5611         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5612         return ret_arr;
5613 }
5614
5615 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5616 CHECK(!owner->result_ok);
5617         return *owner->contents.err;
5618 }
5619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5620         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5621         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5622 }
5623
5624 typedef struct LDKChannelSigner_JCalls {
5625         atomic_size_t refcnt;
5626         JavaVM *vm;
5627         jweak o;
5628         jmethodID get_per_commitment_point_meth;
5629         jmethodID release_commitment_secret_meth;
5630         jmethodID validate_holder_commitment_meth;
5631         jmethodID channel_keys_id_meth;
5632         jmethodID provide_channel_parameters_meth;
5633 } LDKChannelSigner_JCalls;
5634 static void LDKChannelSigner_JCalls_free(void* this_arg) {
5635         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
5636         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5637                 JNIEnv *env;
5638                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5639                 if (get_jenv_res == JNI_EDETACHED) {
5640                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5641                 } else {
5642                         DO_ASSERT(get_jenv_res == JNI_OK);
5643                 }
5644                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5645                 if (get_jenv_res == JNI_EDETACHED) {
5646                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5647                 }
5648                 FREE(j_calls);
5649         }
5650 }
5651 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
5652         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
5653         JNIEnv *env;
5654         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5655         if (get_jenv_res == JNI_EDETACHED) {
5656                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5657         } else {
5658                 DO_ASSERT(get_jenv_res == JNI_OK);
5659         }
5660         int64_t idx_conv = idx;
5661         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5662         CHECK(obj != NULL);
5663         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
5664         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5665                 (*env)->ExceptionDescribe(env);
5666                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
5667         }
5668         LDKPublicKey ret_ref;
5669         CHECK((*env)->GetArrayLength(env, ret) == 33);
5670         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
5671         if (get_jenv_res == JNI_EDETACHED) {
5672                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5673         }
5674         return ret_ref;
5675 }
5676 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
5677         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
5678         JNIEnv *env;
5679         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5680         if (get_jenv_res == JNI_EDETACHED) {
5681                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5682         } else {
5683                 DO_ASSERT(get_jenv_res == JNI_OK);
5684         }
5685         int64_t idx_conv = idx;
5686         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5687         CHECK(obj != NULL);
5688         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
5689         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5690                 (*env)->ExceptionDescribe(env);
5691                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
5692         }
5693         LDKThirtyTwoBytes ret_ref;
5694         CHECK((*env)->GetArrayLength(env, ret) == 32);
5695         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5696         if (get_jenv_res == JNI_EDETACHED) {
5697                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5698         }
5699         return ret_ref;
5700 }
5701 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
5702         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
5703         JNIEnv *env;
5704         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5705         if (get_jenv_res == JNI_EDETACHED) {
5706                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5707         } else {
5708                 DO_ASSERT(get_jenv_res == JNI_OK);
5709         }
5710         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
5711         int64_t holder_tx_ref = 0;
5712         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
5713         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
5714         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
5715         LDKCVec_PaymentPreimageZ preimages_var = preimages;
5716         jobjectArray preimages_arr = NULL;
5717         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
5718         ;
5719         for (size_t i = 0; i < preimages_var.datalen; i++) {
5720                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
5721                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
5722                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
5723         }
5724         
5725         FREE(preimages_var.data);
5726         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5727         CHECK(obj != NULL);
5728         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
5729         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5730                 (*env)->ExceptionDescribe(env);
5731                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
5732         }
5733         void* ret_ptr = untag_ptr(ret);
5734         CHECK_ACCESS(ret_ptr);
5735         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
5736         FREE(untag_ptr(ret));
5737         if (get_jenv_res == JNI_EDETACHED) {
5738                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5739         }
5740         return ret_conv;
5741 }
5742 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
5743         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
5744         JNIEnv *env;
5745         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5746         if (get_jenv_res == JNI_EDETACHED) {
5747                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5748         } else {
5749                 DO_ASSERT(get_jenv_res == JNI_OK);
5750         }
5751         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5752         CHECK(obj != NULL);
5753         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
5754         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5755                 (*env)->ExceptionDescribe(env);
5756                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
5757         }
5758         LDKThirtyTwoBytes ret_ref;
5759         CHECK((*env)->GetArrayLength(env, ret) == 32);
5760         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5761         if (get_jenv_res == JNI_EDETACHED) {
5762                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5763         }
5764         return ret_ref;
5765 }
5766 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
5767         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
5768         JNIEnv *env;
5769         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5770         if (get_jenv_res == JNI_EDETACHED) {
5771                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5772         } else {
5773                 DO_ASSERT(get_jenv_res == JNI_OK);
5774         }
5775         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
5776         int64_t channel_parameters_ref = 0;
5777         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
5778         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
5779         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
5780         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5781         CHECK(obj != NULL);
5782         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
5783         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5784                 (*env)->ExceptionDescribe(env);
5785                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
5786         }
5787         if (get_jenv_res == JNI_EDETACHED) {
5788                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5789         }
5790 }
5791 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5792         jclass c = (*env)->GetObjectClass(env, o);
5793         CHECK(c != NULL);
5794         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
5795         atomic_init(&calls->refcnt, 1);
5796         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5797         calls->o = (*env)->NewWeakGlobalRef(env, o);
5798         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
5799         CHECK(calls->get_per_commitment_point_meth != NULL);
5800         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
5801         CHECK(calls->release_commitment_secret_meth != NULL);
5802         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
5803         CHECK(calls->validate_holder_commitment_meth != NULL);
5804         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
5805         CHECK(calls->channel_keys_id_meth != NULL);
5806         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
5807         CHECK(calls->provide_channel_parameters_meth != NULL);
5808
5809         LDKChannelPublicKeys pubkeys_conv;
5810         pubkeys_conv.inner = untag_ptr(pubkeys);
5811         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
5812         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5813
5814         LDKChannelSigner ret = {
5815                 .this_arg = (void*) calls,
5816                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
5817                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
5818                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
5819                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
5820                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
5821                 .free = LDKChannelSigner_JCalls_free,
5822                 .pubkeys = pubkeys_conv,
5823                 .set_pubkeys = NULL,
5824         };
5825         return ret;
5826 }
5827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5828         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
5829         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
5830         return tag_ptr(res_ptr, true);
5831 }
5832 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) {
5833         void* this_arg_ptr = untag_ptr(this_arg);
5834         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5835         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
5836         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5837         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
5838         return ret_arr;
5839 }
5840
5841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
5842         void* this_arg_ptr = untag_ptr(this_arg);
5843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5844         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
5845         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
5847         return ret_arr;
5848 }
5849
5850 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) {
5851         void* this_arg_ptr = untag_ptr(this_arg);
5852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5853         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
5854         LDKHolderCommitmentTransaction holder_tx_conv;
5855         holder_tx_conv.inner = untag_ptr(holder_tx);
5856         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
5857         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
5858         holder_tx_conv.is_owned = false;
5859         LDKCVec_PaymentPreimageZ preimages_constr;
5860         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5861         if (preimages_constr.datalen > 0)
5862                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5863         else
5864                 preimages_constr.data = NULL;
5865         for (size_t i = 0; i < preimages_constr.datalen; i++) {
5866                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5867                 LDKThirtyTwoBytes preimages_conv_8_ref;
5868                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5869                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5870                 preimages_constr.data[i] = preimages_conv_8_ref;
5871         }
5872         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5873         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
5874         return tag_ptr(ret_conv, true);
5875 }
5876
5877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5878         void* this_arg_ptr = untag_ptr(this_arg);
5879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5880         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
5881         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5882         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
5883         return ret_arr;
5884 }
5885
5886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5887         void* this_arg_ptr = untag_ptr(this_arg);
5888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5889         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
5890         LDKChannelTransactionParameters channel_parameters_conv;
5891         channel_parameters_conv.inner = untag_ptr(channel_parameters);
5892         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
5893         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5894         channel_parameters_conv.is_owned = false;
5895         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
5896 }
5897
5898 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
5899         if (this_arg->set_pubkeys != NULL)
5900                 this_arg->set_pubkeys(this_arg);
5901         return this_arg->pubkeys;
5902 }
5903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5904         void* this_arg_ptr = untag_ptr(this_arg);
5905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5906         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
5907         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
5908         int64_t ret_ref = 0;
5909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5911         return ret_ref;
5912 }
5913
5914 typedef struct LDKEcdsaChannelSigner_JCalls {
5915         atomic_size_t refcnt;
5916         JavaVM *vm;
5917         jweak o;
5918         LDKChannelSigner_JCalls* ChannelSigner;
5919         jmethodID sign_counterparty_commitment_meth;
5920         jmethodID validate_counterparty_revocation_meth;
5921         jmethodID sign_holder_commitment_and_htlcs_meth;
5922         jmethodID sign_justice_revoked_output_meth;
5923         jmethodID sign_justice_revoked_htlc_meth;
5924         jmethodID sign_counterparty_htlc_transaction_meth;
5925         jmethodID sign_closing_transaction_meth;
5926         jmethodID sign_holder_anchor_input_meth;
5927         jmethodID sign_channel_announcement_with_funding_key_meth;
5928 } LDKEcdsaChannelSigner_JCalls;
5929 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
5930         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
5931         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5932                 JNIEnv *env;
5933                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5934                 if (get_jenv_res == JNI_EDETACHED) {
5935                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5936                 } else {
5937                         DO_ASSERT(get_jenv_res == JNI_OK);
5938                 }
5939                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5940                 if (get_jenv_res == JNI_EDETACHED) {
5941                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5942                 }
5943                 FREE(j_calls);
5944         }
5945 }
5946 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
5947         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
5948         JNIEnv *env;
5949         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5950         if (get_jenv_res == JNI_EDETACHED) {
5951                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5952         } else {
5953                 DO_ASSERT(get_jenv_res == JNI_OK);
5954         }
5955         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
5956         int64_t commitment_tx_ref = 0;
5957         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
5958         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
5959         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
5960         LDKCVec_PaymentPreimageZ preimages_var = preimages;
5961         jobjectArray preimages_arr = NULL;
5962         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
5963         ;
5964         for (size_t i = 0; i < preimages_var.datalen; i++) {
5965                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
5966                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
5967                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
5968         }
5969         
5970         FREE(preimages_var.data);
5971         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5972         CHECK(obj != NULL);
5973         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
5974         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5975                 (*env)->ExceptionDescribe(env);
5976                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
5977         }
5978         void* ret_ptr = untag_ptr(ret);
5979         CHECK_ACCESS(ret_ptr);
5980         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
5981         FREE(untag_ptr(ret));
5982         if (get_jenv_res == JNI_EDETACHED) {
5983                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5984         }
5985         return ret_conv;
5986 }
5987 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
5988         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
5989         JNIEnv *env;
5990         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5991         if (get_jenv_res == JNI_EDETACHED) {
5992                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5993         } else {
5994                 DO_ASSERT(get_jenv_res == JNI_OK);
5995         }
5996         int64_t idx_conv = idx;
5997         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
5998         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
5999         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6000         CHECK(obj != NULL);
6001         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
6002         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6003                 (*env)->ExceptionDescribe(env);
6004                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception.");
6005         }
6006         void* ret_ptr = untag_ptr(ret);
6007         CHECK_ACCESS(ret_ptr);
6008         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
6009         FREE(untag_ptr(ret));
6010         if (get_jenv_res == JNI_EDETACHED) {
6011                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6012         }
6013         return ret_conv;
6014 }
6015 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
6016         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
6017         JNIEnv *env;
6018         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6019         if (get_jenv_res == JNI_EDETACHED) {
6020                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6021         } else {
6022                 DO_ASSERT(get_jenv_res == JNI_OK);
6023         }
6024         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
6025         int64_t commitment_tx_ref = 0;
6026         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
6027         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
6028         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
6029         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6030         CHECK(obj != NULL);
6031         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
6032         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6033                 (*env)->ExceptionDescribe(env);
6034                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception.");
6035         }
6036         void* ret_ptr = untag_ptr(ret);
6037         CHECK_ACCESS(ret_ptr);
6038         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
6039         FREE(untag_ptr(ret));
6040         if (get_jenv_res == JNI_EDETACHED) {
6041                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6042         }
6043         return ret_conv;
6044 }
6045 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]) {
6046         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
6047         JNIEnv *env;
6048         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6049         if (get_jenv_res == JNI_EDETACHED) {
6050                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6051         } else {
6052                 DO_ASSERT(get_jenv_res == JNI_OK);
6053         }
6054         LDKTransaction justice_tx_var = justice_tx;
6055         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
6056         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
6057         Transaction_free(justice_tx_var);
6058         int64_t input_conv = input;
6059         int64_t amount_conv = amount;
6060         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
6061         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
6062         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6063         CHECK(obj != NULL);
6064         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);
6065         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6066                 (*env)->ExceptionDescribe(env);
6067                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
6068         }
6069         void* ret_ptr = untag_ptr(ret);
6070         CHECK_ACCESS(ret_ptr);
6071         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6072         FREE(untag_ptr(ret));
6073         if (get_jenv_res == JNI_EDETACHED) {
6074                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6075         }
6076         return ret_conv;
6077 }
6078 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) {
6079         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
6080         JNIEnv *env;
6081         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6082         if (get_jenv_res == JNI_EDETACHED) {
6083                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6084         } else {
6085                 DO_ASSERT(get_jenv_res == JNI_OK);
6086         }
6087         LDKTransaction justice_tx_var = justice_tx;
6088         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
6089         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
6090         Transaction_free(justice_tx_var);
6091         int64_t input_conv = input;
6092         int64_t amount_conv = amount;
6093         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
6094         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
6095         LDKHTLCOutputInCommitment htlc_var = *htlc;
6096         int64_t htlc_ref = 0;
6097         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
6098         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
6099         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
6100         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6101         CHECK(obj != NULL);
6102         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);
6103         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6104                 (*env)->ExceptionDescribe(env);
6105                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
6106         }
6107         void* ret_ptr = untag_ptr(ret);
6108         CHECK_ACCESS(ret_ptr);
6109         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6110         FREE(untag_ptr(ret));
6111         if (get_jenv_res == JNI_EDETACHED) {
6112                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6113         }
6114         return ret_conv;
6115 }
6116 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) {
6117         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
6118         JNIEnv *env;
6119         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6120         if (get_jenv_res == JNI_EDETACHED) {
6121                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6122         } else {
6123                 DO_ASSERT(get_jenv_res == JNI_OK);
6124         }
6125         LDKTransaction htlc_tx_var = htlc_tx;
6126         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
6127         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
6128         Transaction_free(htlc_tx_var);
6129         int64_t input_conv = input;
6130         int64_t amount_conv = amount;
6131         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
6132         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
6133         LDKHTLCOutputInCommitment htlc_var = *htlc;
6134         int64_t htlc_ref = 0;
6135         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
6136         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
6137         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
6138         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6139         CHECK(obj != NULL);
6140         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);
6141         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6142                 (*env)->ExceptionDescribe(env);
6143                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
6144         }
6145         void* ret_ptr = untag_ptr(ret);
6146         CHECK_ACCESS(ret_ptr);
6147         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6148         FREE(untag_ptr(ret));
6149         if (get_jenv_res == JNI_EDETACHED) {
6150                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6151         }
6152         return ret_conv;
6153 }
6154 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
6155         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
6156         JNIEnv *env;
6157         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6158         if (get_jenv_res == JNI_EDETACHED) {
6159                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6160         } else {
6161                 DO_ASSERT(get_jenv_res == JNI_OK);
6162         }
6163         LDKClosingTransaction closing_tx_var = *closing_tx;
6164         int64_t closing_tx_ref = 0;
6165         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
6166         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
6167         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
6168         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6169         CHECK(obj != NULL);
6170         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
6171         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6172                 (*env)->ExceptionDescribe(env);
6173                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
6174         }
6175         void* ret_ptr = untag_ptr(ret);
6176         CHECK_ACCESS(ret_ptr);
6177         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6178         FREE(untag_ptr(ret));
6179         if (get_jenv_res == JNI_EDETACHED) {
6180                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6181         }
6182         return ret_conv;
6183 }
6184 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
6185         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
6186         JNIEnv *env;
6187         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6188         if (get_jenv_res == JNI_EDETACHED) {
6189                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6190         } else {
6191                 DO_ASSERT(get_jenv_res == JNI_OK);
6192         }
6193         LDKTransaction anchor_tx_var = anchor_tx;
6194         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
6195         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
6196         Transaction_free(anchor_tx_var);
6197         int64_t input_conv = input;
6198         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6199         CHECK(obj != NULL);
6200         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
6201         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6202                 (*env)->ExceptionDescribe(env);
6203                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
6204         }
6205         void* ret_ptr = untag_ptr(ret);
6206         CHECK_ACCESS(ret_ptr);
6207         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6208         FREE(untag_ptr(ret));
6209         if (get_jenv_res == JNI_EDETACHED) {
6210                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6211         }
6212         return ret_conv;
6213 }
6214 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
6215         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
6216         JNIEnv *env;
6217         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6218         if (get_jenv_res == JNI_EDETACHED) {
6219                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6220         } else {
6221                 DO_ASSERT(get_jenv_res == JNI_OK);
6222         }
6223         LDKUnsignedChannelAnnouncement msg_var = *msg;
6224         int64_t msg_ref = 0;
6225         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
6226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6227         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
6228         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6229         CHECK(obj != NULL);
6230         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
6231         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6232                 (*env)->ExceptionDescribe(env);
6233                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
6234         }
6235         void* ret_ptr = untag_ptr(ret);
6236         CHECK_ACCESS(ret_ptr);
6237         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6238         FREE(untag_ptr(ret));
6239         if (get_jenv_res == JNI_EDETACHED) {
6240                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6241         }
6242         return ret_conv;
6243 }
6244 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
6245         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
6246         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6247         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
6248 }
6249 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
6250         jclass c = (*env)->GetObjectClass(env, o);
6251         CHECK(c != NULL);
6252         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
6253         atomic_init(&calls->refcnt, 1);
6254         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6255         calls->o = (*env)->NewWeakGlobalRef(env, o);
6256         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
6257         CHECK(calls->sign_counterparty_commitment_meth != NULL);
6258         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
6259         CHECK(calls->validate_counterparty_revocation_meth != NULL);
6260         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
6261         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
6262         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
6263         CHECK(calls->sign_justice_revoked_output_meth != NULL);
6264         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
6265         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
6266         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
6267         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
6268         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
6269         CHECK(calls->sign_closing_transaction_meth != NULL);
6270         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
6271         CHECK(calls->sign_holder_anchor_input_meth != NULL);
6272         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
6273         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
6274
6275         LDKChannelPublicKeys pubkeys_conv;
6276         pubkeys_conv.inner = untag_ptr(pubkeys);
6277         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
6278         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
6279
6280         LDKEcdsaChannelSigner ret = {
6281                 .this_arg = (void*) calls,
6282                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
6283                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
6284                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
6285                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
6286                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
6287                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
6288                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
6289                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
6290                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
6291                 .free = LDKEcdsaChannelSigner_JCalls_free,
6292                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
6293         };
6294         calls->ChannelSigner = ret.ChannelSigner.this_arg;
6295         return ret;
6296 }
6297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
6298         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
6299         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
6300         return tag_ptr(res_ptr, true);
6301 }
6302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
6303         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
6304         return tag_ptr(&inp->ChannelSigner, false);
6305 }
6306 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) {
6307         void* this_arg_ptr = untag_ptr(this_arg);
6308         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6309         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6310         LDKCommitmentTransaction commitment_tx_conv;
6311         commitment_tx_conv.inner = untag_ptr(commitment_tx);
6312         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
6313         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
6314         commitment_tx_conv.is_owned = false;
6315         LDKCVec_PaymentPreimageZ preimages_constr;
6316         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
6317         if (preimages_constr.datalen > 0)
6318                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
6319         else
6320                 preimages_constr.data = NULL;
6321         for (size_t i = 0; i < preimages_constr.datalen; i++) {
6322                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
6323                 LDKThirtyTwoBytes preimages_conv_8_ref;
6324                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
6325                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
6326                 preimages_constr.data[i] = preimages_conv_8_ref;
6327         }
6328         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6329         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
6330         return tag_ptr(ret_conv, true);
6331 }
6332
6333 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) {
6334         void* this_arg_ptr = untag_ptr(this_arg);
6335         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6336         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6337         uint8_t secret_arr[32];
6338         CHECK((*env)->GetArrayLength(env, secret) == 32);
6339         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
6340         uint8_t (*secret_ref)[32] = &secret_arr;
6341         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
6342         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
6343         return tag_ptr(ret_conv, true);
6344 }
6345
6346 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) {
6347         void* this_arg_ptr = untag_ptr(this_arg);
6348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6349         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6350         LDKHolderCommitmentTransaction commitment_tx_conv;
6351         commitment_tx_conv.inner = untag_ptr(commitment_tx);
6352         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
6353         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
6354         commitment_tx_conv.is_owned = false;
6355         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6356         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
6357         return tag_ptr(ret_conv, true);
6358 }
6359
6360 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) {
6361         void* this_arg_ptr = untag_ptr(this_arg);
6362         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6363         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6364         LDKTransaction justice_tx_ref;
6365         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
6366         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
6367         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
6368         justice_tx_ref.data_is_owned = true;
6369         uint8_t per_commitment_key_arr[32];
6370         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
6371         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
6372         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
6373         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6374         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
6375         return tag_ptr(ret_conv, true);
6376 }
6377
6378 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) {
6379         void* this_arg_ptr = untag_ptr(this_arg);
6380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6381         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6382         LDKTransaction justice_tx_ref;
6383         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
6384         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
6385         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
6386         justice_tx_ref.data_is_owned = true;
6387         uint8_t per_commitment_key_arr[32];
6388         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
6389         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
6390         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
6391         LDKHTLCOutputInCommitment htlc_conv;
6392         htlc_conv.inner = untag_ptr(htlc);
6393         htlc_conv.is_owned = ptr_is_owned(htlc);
6394         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
6395         htlc_conv.is_owned = false;
6396         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6397         *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);
6398         return tag_ptr(ret_conv, true);
6399 }
6400
6401 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) {
6402         void* this_arg_ptr = untag_ptr(this_arg);
6403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6404         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6405         LDKTransaction htlc_tx_ref;
6406         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
6407         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
6408         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
6409         htlc_tx_ref.data_is_owned = true;
6410         LDKPublicKey per_commitment_point_ref;
6411         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
6412         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
6413         LDKHTLCOutputInCommitment htlc_conv;
6414         htlc_conv.inner = untag_ptr(htlc);
6415         htlc_conv.is_owned = ptr_is_owned(htlc);
6416         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
6417         htlc_conv.is_owned = false;
6418         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6419         *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);
6420         return tag_ptr(ret_conv, true);
6421 }
6422
6423 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) {
6424         void* this_arg_ptr = untag_ptr(this_arg);
6425         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6426         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6427         LDKClosingTransaction closing_tx_conv;
6428         closing_tx_conv.inner = untag_ptr(closing_tx);
6429         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
6430         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
6431         closing_tx_conv.is_owned = false;
6432         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6433         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
6434         return tag_ptr(ret_conv, true);
6435 }
6436
6437 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) {
6438         void* this_arg_ptr = untag_ptr(this_arg);
6439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6440         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6441         LDKTransaction anchor_tx_ref;
6442         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
6443         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
6444         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
6445         anchor_tx_ref.data_is_owned = true;
6446         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6447         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
6448         return tag_ptr(ret_conv, true);
6449 }
6450
6451 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) {
6452         void* this_arg_ptr = untag_ptr(this_arg);
6453         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6454         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
6455         LDKUnsignedChannelAnnouncement msg_conv;
6456         msg_conv.inner = untag_ptr(msg);
6457         msg_conv.is_owned = ptr_is_owned(msg);
6458         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
6459         msg_conv.is_owned = false;
6460         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6461         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
6462         return tag_ptr(ret_conv, true);
6463 }
6464
6465 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
6466         atomic_size_t refcnt;
6467         JavaVM *vm;
6468         jweak o;
6469         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
6470         LDKChannelSigner_JCalls* ChannelSigner;
6471         jmethodID write_meth;
6472 } LDKWriteableEcdsaChannelSigner_JCalls;
6473 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
6474         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
6475         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6476                 JNIEnv *env;
6477                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6478                 if (get_jenv_res == JNI_EDETACHED) {
6479                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6480                 } else {
6481                         DO_ASSERT(get_jenv_res == JNI_OK);
6482                 }
6483                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6484                 if (get_jenv_res == JNI_EDETACHED) {
6485                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6486                 }
6487                 FREE(j_calls);
6488         }
6489 }
6490 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
6491         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
6492         JNIEnv *env;
6493         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6494         if (get_jenv_res == JNI_EDETACHED) {
6495                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6496         } else {
6497                 DO_ASSERT(get_jenv_res == JNI_OK);
6498         }
6499         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6500         CHECK(obj != NULL);
6501         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6502         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6503                 (*env)->ExceptionDescribe(env);
6504                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
6505         }
6506         LDKCVec_u8Z ret_ref;
6507         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6508         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6509         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6510         if (get_jenv_res == JNI_EDETACHED) {
6511                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6512         }
6513         return ret_ref;
6514 }
6515 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
6516         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
6517         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6518         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
6519         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
6520 }
6521 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
6522         jclass c = (*env)->GetObjectClass(env, o);
6523         CHECK(c != NULL);
6524         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
6525         atomic_init(&calls->refcnt, 1);
6526         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6527         calls->o = (*env)->NewWeakGlobalRef(env, o);
6528         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
6529         CHECK(calls->write_meth != NULL);
6530
6531         LDKChannelPublicKeys pubkeys_conv;
6532         pubkeys_conv.inner = untag_ptr(pubkeys);
6533         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
6534         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
6535
6536         LDKWriteableEcdsaChannelSigner ret = {
6537                 .this_arg = (void*) calls,
6538                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
6539                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
6540                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
6541                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
6542         };
6543         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
6544         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
6545         return ret;
6546 }
6547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
6548         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6549         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
6550         return tag_ptr(res_ptr, true);
6551 }
6552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
6553         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
6554         return tag_ptr(&inp->EcdsaChannelSigner, false);
6555 }
6556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
6557         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
6558         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
6559 }
6560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
6561         void* this_arg_ptr = untag_ptr(this_arg);
6562         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6563         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
6564         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6565         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6566         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6567         CVec_u8Z_free(ret_var);
6568         return ret_arr;
6569 }
6570
6571 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
6572 CHECK(owner->result_ok);
6573         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
6574 }
6575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6576         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
6577         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6578         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
6579         return tag_ptr(ret_ret, true);
6580 }
6581
6582 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
6583 CHECK(!owner->result_ok);
6584         return DecodeError_clone(&*owner->contents.err);
6585 }
6586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6587         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
6588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6589         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
6590         int64_t ret_ref = tag_ptr(ret_copy, true);
6591         return ret_ref;
6592 }
6593
6594 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
6595         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
6596         for (size_t i = 0; i < ret.datalen; i++) {
6597                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
6598         }
6599         return ret;
6600 }
6601 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
6602 CHECK(owner->result_ok);
6603         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
6604 }
6605 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6606         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
6607         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
6608         jobjectArray ret_arr = NULL;
6609         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6610         ;
6611         for (size_t i = 0; i < ret_var.datalen; i++) {
6612                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
6613                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
6614                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
6615                 CVec_u8Z_free(ret_conv_8_var);
6616                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6617         }
6618         
6619         FREE(ret_var.data);
6620         return ret_arr;
6621 }
6622
6623 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
6624 CHECK(!owner->result_ok);
6625         return *owner->contents.err;
6626 }
6627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6628         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
6629         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
6630 }
6631
6632 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
6633         LDKInMemorySigner ret = *owner->contents.result;
6634         ret.is_owned = false;
6635         return ret;
6636 }
6637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6638         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
6639         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
6640         int64_t ret_ref = 0;
6641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6643         return ret_ref;
6644 }
6645
6646 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
6647 CHECK(!owner->result_ok);
6648         return DecodeError_clone(&*owner->contents.err);
6649 }
6650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6651         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
6652         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6653         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
6654         int64_t ret_ref = tag_ptr(ret_copy, true);
6655         return ret_ref;
6656 }
6657
6658 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
6659         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
6660         for (size_t i = 0; i < ret.datalen; i++) {
6661                 ret.data[i] = TxOut_clone(&orig->data[i]);
6662         }
6663         return ret;
6664 }
6665 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
6666 CHECK(owner->result_ok);
6667         return *owner->contents.result;
6668 }
6669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6670         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
6671         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
6672         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6673         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6674         return ret_arr;
6675 }
6676
6677 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
6678 CHECK(!owner->result_ok);
6679         return *owner->contents.err;
6680 }
6681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6682         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
6683         CResult_TransactionNoneZ_get_err(owner_conv);
6684 }
6685
6686 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6687         return ThirtyTwoBytes_clone(&owner->a);
6688 }
6689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6690         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6691         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6692         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
6693         return ret_arr;
6694 }
6695
6696 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6697         LDKChannelMonitor ret = owner->b;
6698         ret.is_owned = false;
6699         return ret;
6700 }
6701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6702         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6703         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6704         int64_t ret_ref = 0;
6705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6707         return ret_ref;
6708 }
6709
6710 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
6711         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
6712         for (size_t i = 0; i < ret.datalen; i++) {
6713                 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
6714         }
6715         return ret;
6716 }
6717 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
6718 CHECK(owner->result_ok);
6719         return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
6720 }
6721 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6722         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
6723         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
6724         int64_tArray ret_arr = NULL;
6725         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6726         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6727         for (size_t j = 0; j < ret_var.datalen; j++) {
6728                 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6729                 *ret_conv_35_conv = ret_var.data[j];
6730                 ret_arr_ptr[j] = tag_ptr(ret_conv_35_conv, true);
6731         }
6732         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6733         FREE(ret_var.data);
6734         return ret_arr;
6735 }
6736
6737 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
6738 CHECK(!owner->result_ok);
6739         return *owner->contents.err;
6740 }
6741 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6742         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
6743         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
6744         return ret_conv;
6745 }
6746
6747 static jclass LDKCOption_u16Z_Some_class = NULL;
6748 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
6749 static jclass LDKCOption_u16Z_None_class = NULL;
6750 static jmethodID LDKCOption_u16Z_None_meth = NULL;
6751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
6752         LDKCOption_u16Z_Some_class =
6753                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
6754         CHECK(LDKCOption_u16Z_Some_class != NULL);
6755         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
6756         CHECK(LDKCOption_u16Z_Some_meth != NULL);
6757         LDKCOption_u16Z_None_class =
6758                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
6759         CHECK(LDKCOption_u16Z_None_class != NULL);
6760         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
6761         CHECK(LDKCOption_u16Z_None_meth != NULL);
6762 }
6763 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6764         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
6765         switch(obj->tag) {
6766                 case LDKCOption_u16Z_Some: {
6767                         int16_t some_conv = obj->some;
6768                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
6769                 }
6770                 case LDKCOption_u16Z_None: {
6771                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
6772                 }
6773                 default: abort();
6774         }
6775 }
6776 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6777 CHECK(owner->result_ok);
6778         return ThirtyTwoBytes_clone(&*owner->contents.result);
6779 }
6780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6781         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6782         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6783         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
6784         return ret_arr;
6785 }
6786
6787 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6788 CHECK(!owner->result_ok);
6789         return APIError_clone(&*owner->contents.err);
6790 }
6791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6792         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6793         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6794         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
6795         int64_t ret_ref = tag_ptr(ret_copy, true);
6796         return ret_ref;
6797 }
6798
6799 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
6800 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
6801 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
6802 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
6803 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
6804 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
6805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
6806         LDKRecentPaymentDetails_Pending_class =
6807                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
6808         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
6809         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([BJ)V");
6810         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
6811         LDKRecentPaymentDetails_Fulfilled_class =
6812                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
6813         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
6814         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([B)V");
6815         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
6816         LDKRecentPaymentDetails_Abandoned_class =
6817                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
6818         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
6819         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B)V");
6820         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
6821 }
6822 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6823         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6824         switch(obj->tag) {
6825                 case LDKRecentPaymentDetails_Pending: {
6826                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6827                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
6828                         int64_t total_msat_conv = obj->pending.total_msat;
6829                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_hash_arr, total_msat_conv);
6830                 }
6831                 case LDKRecentPaymentDetails_Fulfilled: {
6832                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6833                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->fulfilled.payment_hash.data);
6834                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_hash_arr);
6835                 }
6836                 case LDKRecentPaymentDetails_Abandoned: {
6837                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6838                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
6839                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_hash_arr);
6840                 }
6841                 default: abort();
6842         }
6843 }
6844 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
6845         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
6846         for (size_t i = 0; i < ret.datalen; i++) {
6847                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
6848         }
6849         return ret;
6850 }
6851 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
6852 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
6853 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
6854 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
6855 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
6856 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
6857 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
6858 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
6859 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
6860 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
6861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
6862         LDKPaymentSendFailure_ParameterError_class =
6863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
6864         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
6865         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
6866         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
6867         LDKPaymentSendFailure_PathParameterError_class =
6868                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
6869         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
6870         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
6871         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
6872         LDKPaymentSendFailure_AllFailedResendSafe_class =
6873                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
6874         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
6875         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
6876         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
6877         LDKPaymentSendFailure_DuplicatePayment_class =
6878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
6879         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
6880         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
6881         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
6882         LDKPaymentSendFailure_PartialFailure_class =
6883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
6884         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
6885         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
6886         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
6887 }
6888 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6889         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6890         switch(obj->tag) {
6891                 case LDKPaymentSendFailure_ParameterError: {
6892                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6893                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
6894                 }
6895                 case LDKPaymentSendFailure_PathParameterError: {
6896                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6897                         int64_tArray path_parameter_error_arr = NULL;
6898                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
6899                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
6900                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6901                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6902                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6903                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6904                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6905                         }
6906                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
6907                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
6908                 }
6909                 case LDKPaymentSendFailure_AllFailedResendSafe: {
6910                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
6911                         int64_tArray all_failed_resend_safe_arr = NULL;
6912                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
6913                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
6914                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
6915                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
6916                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
6917                         }
6918                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
6919                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
6920                 }
6921                 case LDKPaymentSendFailure_DuplicatePayment: {
6922                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
6923                 }
6924                 case LDKPaymentSendFailure_PartialFailure: {
6925                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6926                         int64_tArray results_arr = NULL;
6927                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
6928                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
6929                         for (size_t w = 0; w < results_var.datalen; w++) {
6930                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6931                                 *results_conv_22_conv = results_var.data[w];
6932                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6933                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6934                         }
6935                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
6936                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6937                         int64_t failed_paths_retry_ref = 0;
6938                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6939                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6940                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6941                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
6942                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
6943                 }
6944                 default: abort();
6945         }
6946 }
6947 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6948 CHECK(owner->result_ok);
6949         return *owner->contents.result;
6950 }
6951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6952         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6953         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6954 }
6955
6956 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6957 CHECK(!owner->result_ok);
6958         return PaymentSendFailure_clone(&*owner->contents.err);
6959 }
6960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6961         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6962         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6963         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6964         int64_t ret_ref = tag_ptr(ret_copy, true);
6965         return ret_ref;
6966 }
6967
6968 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6969 CHECK(owner->result_ok);
6970         return *owner->contents.result;
6971 }
6972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6973         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6974         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
6975 }
6976
6977 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6978 CHECK(!owner->result_ok);
6979         return RetryableSendFailure_clone(&*owner->contents.err);
6980 }
6981 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6982         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6983         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
6984         return ret_conv;
6985 }
6986
6987 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *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_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6992         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6993         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6994         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data);
6995         return ret_arr;
6996 }
6997
6998 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6999 CHECK(!owner->result_ok);
7000         return PaymentSendFailure_clone(&*owner->contents.err);
7001 }
7002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7003         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
7004         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7005         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
7006         int64_t ret_ref = tag_ptr(ret_copy, true);
7007         return ret_ref;
7008 }
7009
7010 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
7011 CHECK(owner->result_ok);
7012         return ThirtyTwoBytes_clone(&*owner->contents.result);
7013 }
7014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7015         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
7016         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7017         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data);
7018         return ret_arr;
7019 }
7020
7021 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
7022 CHECK(!owner->result_ok);
7023         return RetryableSendFailure_clone(&*owner->contents.err);
7024 }
7025 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7026         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
7027         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
7028         return ret_conv;
7029 }
7030
7031 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
7032         return ThirtyTwoBytes_clone(&owner->a);
7033 }
7034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7035         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
7036         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7037         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
7038         return ret_arr;
7039 }
7040
7041 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
7042         return ThirtyTwoBytes_clone(&owner->b);
7043 }
7044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7045         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
7046         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7047         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
7048         return ret_arr;
7049 }
7050
7051 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
7052 CHECK(owner->result_ok);
7053         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
7054 }
7055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7056         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
7057         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
7058         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
7059         return tag_ptr(ret_conv, true);
7060 }
7061
7062 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
7063 CHECK(!owner->result_ok);
7064         return PaymentSendFailure_clone(&*owner->contents.err);
7065 }
7066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7067         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
7068         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7069         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
7070         int64_t ret_ref = tag_ptr(ret_copy, true);
7071         return ret_ref;
7072 }
7073
7074 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
7075         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
7076         for (size_t i = 0; i < ret.datalen; i++) {
7077                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
7078         }
7079         return ret;
7080 }
7081 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
7082         return ThirtyTwoBytes_clone(&owner->a);
7083 }
7084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7085         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
7086         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7087         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
7088         return ret_arr;
7089 }
7090
7091 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
7092         return ThirtyTwoBytes_clone(&owner->b);
7093 }
7094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7095         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
7096         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7097         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
7098         return ret_arr;
7099 }
7100
7101 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
7102 CHECK(owner->result_ok);
7103         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
7104 }
7105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7106         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
7107         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
7108         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
7109         return tag_ptr(ret_conv, true);
7110 }
7111
7112 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
7113 CHECK(!owner->result_ok);
7114         return *owner->contents.err;
7115 }
7116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7117         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
7118         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
7119 }
7120
7121 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
7122 CHECK(owner->result_ok);
7123         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
7124 }
7125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7126         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
7127         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
7128         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
7129         return tag_ptr(ret_conv, true);
7130 }
7131
7132 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
7133 CHECK(!owner->result_ok);
7134         return APIError_clone(&*owner->contents.err);
7135 }
7136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7137         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
7138         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7139         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
7140         int64_t ret_ref = tag_ptr(ret_copy, true);
7141         return ret_ref;
7142 }
7143
7144 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
7145 CHECK(owner->result_ok);
7146         return ThirtyTwoBytes_clone(&*owner->contents.result);
7147 }
7148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7149         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
7150         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7151         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
7152         return ret_arr;
7153 }
7154
7155 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
7156 CHECK(!owner->result_ok);
7157         return *owner->contents.err;
7158 }
7159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7160         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
7161         CResult_PaymentSecretNoneZ_get_err(owner_conv);
7162 }
7163
7164 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
7165 CHECK(owner->result_ok);
7166         return ThirtyTwoBytes_clone(&*owner->contents.result);
7167 }
7168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7169         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
7170         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
7172         return ret_arr;
7173 }
7174
7175 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
7176 CHECK(!owner->result_ok);
7177         return APIError_clone(&*owner->contents.err);
7178 }
7179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7180         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
7181         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7182         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
7183         int64_t ret_ref = tag_ptr(ret_copy, true);
7184         return ret_ref;
7185 }
7186
7187 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
7188 CHECK(owner->result_ok);
7189         return ThirtyTwoBytes_clone(&*owner->contents.result);
7190 }
7191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7192         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
7193         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7194         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
7195         return ret_arr;
7196 }
7197
7198 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
7199 CHECK(!owner->result_ok);
7200         return APIError_clone(&*owner->contents.err);
7201 }
7202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7203         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
7204         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7205         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
7206         int64_t ret_ref = tag_ptr(ret_copy, true);
7207         return ret_ref;
7208 }
7209
7210 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7211         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7212         ret.is_owned = false;
7213         return ret;
7214 }
7215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7216         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7217         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7218         int64_t ret_ref = 0;
7219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7221         return ret_ref;
7222 }
7223
7224 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7225 CHECK(!owner->result_ok);
7226         return DecodeError_clone(&*owner->contents.err);
7227 }
7228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7229         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7230         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7231         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7232         int64_t ret_ref = tag_ptr(ret_copy, true);
7233         return ret_ref;
7234 }
7235
7236 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7237         LDKChannelCounterparty ret = *owner->contents.result;
7238         ret.is_owned = false;
7239         return ret;
7240 }
7241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7242         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7243         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7244         int64_t ret_ref = 0;
7245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7247         return ret_ref;
7248 }
7249
7250 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7251 CHECK(!owner->result_ok);
7252         return DecodeError_clone(&*owner->contents.err);
7253 }
7254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7255         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7256         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7257         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7258         int64_t ret_ref = tag_ptr(ret_copy, true);
7259         return ret_ref;
7260 }
7261
7262 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7263         LDKChannelDetails ret = *owner->contents.result;
7264         ret.is_owned = false;
7265         return ret;
7266 }
7267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7268         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7269         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7270         int64_t ret_ref = 0;
7271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7273         return ret_ref;
7274 }
7275
7276 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7277 CHECK(!owner->result_ok);
7278         return DecodeError_clone(&*owner->contents.err);
7279 }
7280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7281         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7282         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7283         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7284         int64_t ret_ref = tag_ptr(ret_copy, true);
7285         return ret_ref;
7286 }
7287
7288 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7289         LDKPhantomRouteHints ret = *owner->contents.result;
7290         ret.is_owned = false;
7291         return ret;
7292 }
7293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7294         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7295         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7296         int64_t ret_ref = 0;
7297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7299         return ret_ref;
7300 }
7301
7302 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7303 CHECK(!owner->result_ok);
7304         return DecodeError_clone(&*owner->contents.err);
7305 }
7306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7307         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7308         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7309         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7310         int64_t ret_ref = tag_ptr(ret_copy, true);
7311         return ret_ref;
7312 }
7313
7314 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
7315         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
7316         for (size_t i = 0; i < ret.datalen; i++) {
7317                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
7318         }
7319         return ret;
7320 }
7321 typedef struct LDKWatch_JCalls {
7322         atomic_size_t refcnt;
7323         JavaVM *vm;
7324         jweak o;
7325         jmethodID watch_channel_meth;
7326         jmethodID update_channel_meth;
7327         jmethodID release_pending_monitor_events_meth;
7328 } LDKWatch_JCalls;
7329 static void LDKWatch_JCalls_free(void* this_arg) {
7330         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7331         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7332                 JNIEnv *env;
7333                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7334                 if (get_jenv_res == JNI_EDETACHED) {
7335                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7336                 } else {
7337                         DO_ASSERT(get_jenv_res == JNI_OK);
7338                 }
7339                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7340                 if (get_jenv_res == JNI_EDETACHED) {
7341                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7342                 }
7343                 FREE(j_calls);
7344         }
7345 }
7346 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
7347         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7348         JNIEnv *env;
7349         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7350         if (get_jenv_res == JNI_EDETACHED) {
7351                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7352         } else {
7353                 DO_ASSERT(get_jenv_res == JNI_OK);
7354         }
7355         LDKOutPoint funding_txo_var = funding_txo;
7356         int64_t funding_txo_ref = 0;
7357         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7358         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7359         LDKChannelMonitor monitor_var = monitor;
7360         int64_t monitor_ref = 0;
7361         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
7362         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
7363         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7364         CHECK(obj != NULL);
7365         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
7366         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7367                 (*env)->ExceptionDescribe(env);
7368                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
7369         }
7370         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7371         if (get_jenv_res == JNI_EDETACHED) {
7372                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7373         }
7374         return ret_conv;
7375 }
7376 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
7377         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7378         JNIEnv *env;
7379         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7380         if (get_jenv_res == JNI_EDETACHED) {
7381                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7382         } else {
7383                 DO_ASSERT(get_jenv_res == JNI_OK);
7384         }
7385         LDKOutPoint funding_txo_var = funding_txo;
7386         int64_t funding_txo_ref = 0;
7387         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7388         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7389         LDKChannelMonitorUpdate update_var = *update;
7390         int64_t update_ref = 0;
7391         update_var = ChannelMonitorUpdate_clone(&update_var);
7392         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7393         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
7394         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7395         CHECK(obj != NULL);
7396         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
7397         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7398                 (*env)->ExceptionDescribe(env);
7399                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
7400         }
7401         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7402         if (get_jenv_res == JNI_EDETACHED) {
7403                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7404         }
7405         return ret_conv;
7406 }
7407 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
7408         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7409         JNIEnv *env;
7410         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7411         if (get_jenv_res == JNI_EDETACHED) {
7412                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7413         } else {
7414                 DO_ASSERT(get_jenv_res == JNI_OK);
7415         }
7416         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7417         CHECK(obj != NULL);
7418         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
7419         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7420                 (*env)->ExceptionDescribe(env);
7421                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
7422         }
7423         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
7424         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7425         if (ret_constr.datalen > 0)
7426                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
7427         else
7428                 ret_constr.data = NULL;
7429         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7430         for (size_t x = 0; x < ret_constr.datalen; x++) {
7431                 int64_t ret_conv_49 = ret_vals[x];
7432                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
7433                 CHECK_ACCESS(ret_conv_49_ptr);
7434                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
7435                 FREE(untag_ptr(ret_conv_49));
7436                 ret_constr.data[x] = ret_conv_49_conv;
7437         }
7438         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7439         if (get_jenv_res == JNI_EDETACHED) {
7440                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7441         }
7442         return ret_constr;
7443 }
7444 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
7445         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
7446         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7447 }
7448 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
7449         jclass c = (*env)->GetObjectClass(env, o);
7450         CHECK(c != NULL);
7451         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
7452         atomic_init(&calls->refcnt, 1);
7453         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7454         calls->o = (*env)->NewWeakGlobalRef(env, o);
7455         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7456         CHECK(calls->watch_channel_meth != NULL);
7457         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7458         CHECK(calls->update_channel_meth != NULL);
7459         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
7460         CHECK(calls->release_pending_monitor_events_meth != NULL);
7461
7462         LDKWatch ret = {
7463                 .this_arg = (void*) calls,
7464                 .watch_channel = watch_channel_LDKWatch_jcall,
7465                 .update_channel = update_channel_LDKWatch_jcall,
7466                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
7467                 .free = LDKWatch_JCalls_free,
7468         };
7469         return ret;
7470 }
7471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
7472         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
7473         *res_ptr = LDKWatch_init(env, clz, o);
7474         return tag_ptr(res_ptr, true);
7475 }
7476 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) {
7477         void* this_arg_ptr = untag_ptr(this_arg);
7478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7479         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7480         LDKOutPoint funding_txo_conv;
7481         funding_txo_conv.inner = untag_ptr(funding_txo);
7482         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7483         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7484         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7485         LDKChannelMonitor monitor_conv;
7486         monitor_conv.inner = untag_ptr(monitor);
7487         monitor_conv.is_owned = ptr_is_owned(monitor);
7488         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7489         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7490         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
7491         return ret_conv;
7492 }
7493
7494 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) {
7495         void* this_arg_ptr = untag_ptr(this_arg);
7496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7497         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7498         LDKOutPoint funding_txo_conv;
7499         funding_txo_conv.inner = untag_ptr(funding_txo);
7500         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7501         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7502         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7503         LDKChannelMonitorUpdate update_conv;
7504         update_conv.inner = untag_ptr(update);
7505         update_conv.is_owned = ptr_is_owned(update);
7506         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7507         update_conv.is_owned = false;
7508         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7509         return ret_conv;
7510 }
7511
7512 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7513         void* this_arg_ptr = untag_ptr(this_arg);
7514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7515         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7516         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7517         int64_tArray ret_arr = NULL;
7518         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7519         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7520         for (size_t x = 0; x < ret_var.datalen; x++) {
7521                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
7522                 *ret_conv_49_conv = ret_var.data[x];
7523                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
7524         }
7525         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7526         FREE(ret_var.data);
7527         return ret_arr;
7528 }
7529
7530 typedef struct LDKBroadcasterInterface_JCalls {
7531         atomic_size_t refcnt;
7532         JavaVM *vm;
7533         jweak o;
7534         jmethodID broadcast_transaction_meth;
7535 } LDKBroadcasterInterface_JCalls;
7536 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7537         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7538         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7539                 JNIEnv *env;
7540                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7541                 if (get_jenv_res == JNI_EDETACHED) {
7542                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7543                 } else {
7544                         DO_ASSERT(get_jenv_res == JNI_OK);
7545                 }
7546                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7547                 if (get_jenv_res == JNI_EDETACHED) {
7548                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7549                 }
7550                 FREE(j_calls);
7551         }
7552 }
7553 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
7554         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7555         JNIEnv *env;
7556         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7557         if (get_jenv_res == JNI_EDETACHED) {
7558                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7559         } else {
7560                 DO_ASSERT(get_jenv_res == JNI_OK);
7561         }
7562         LDKTransaction tx_var = tx;
7563         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
7564         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
7565         Transaction_free(tx_var);
7566         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7567         CHECK(obj != NULL);
7568         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
7569         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7570                 (*env)->ExceptionDescribe(env);
7571                 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
7572         }
7573         if (get_jenv_res == JNI_EDETACHED) {
7574                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7575         }
7576 }
7577 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7578         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7579         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7580 }
7581 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
7582         jclass c = (*env)->GetObjectClass(env, o);
7583         CHECK(c != NULL);
7584         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7585         atomic_init(&calls->refcnt, 1);
7586         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7587         calls->o = (*env)->NewWeakGlobalRef(env, o);
7588         calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
7589         CHECK(calls->broadcast_transaction_meth != NULL);
7590
7591         LDKBroadcasterInterface ret = {
7592                 .this_arg = (void*) calls,
7593                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
7594                 .free = LDKBroadcasterInterface_JCalls_free,
7595         };
7596         return ret;
7597 }
7598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7599         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7600         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
7601         return tag_ptr(res_ptr, true);
7602 }
7603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
7604         void* this_arg_ptr = untag_ptr(this_arg);
7605         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7606         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7607         LDKTransaction tx_ref;
7608         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
7609         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
7610         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
7611         tx_ref.data_is_owned = true;
7612         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
7613 }
7614
7615 typedef struct LDKEntropySource_JCalls {
7616         atomic_size_t refcnt;
7617         JavaVM *vm;
7618         jweak o;
7619         jmethodID get_secure_random_bytes_meth;
7620 } LDKEntropySource_JCalls;
7621 static void LDKEntropySource_JCalls_free(void* this_arg) {
7622         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7623         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7624                 JNIEnv *env;
7625                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7626                 if (get_jenv_res == JNI_EDETACHED) {
7627                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7628                 } else {
7629                         DO_ASSERT(get_jenv_res == JNI_OK);
7630                 }
7631                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7632                 if (get_jenv_res == JNI_EDETACHED) {
7633                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7634                 }
7635                 FREE(j_calls);
7636         }
7637 }
7638 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
7639         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7640         JNIEnv *env;
7641         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7642         if (get_jenv_res == JNI_EDETACHED) {
7643                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7644         } else {
7645                 DO_ASSERT(get_jenv_res == JNI_OK);
7646         }
7647         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7648         CHECK(obj != NULL);
7649         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
7650         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7651                 (*env)->ExceptionDescribe(env);
7652                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
7653         }
7654         LDKThirtyTwoBytes ret_ref;
7655         CHECK((*env)->GetArrayLength(env, ret) == 32);
7656         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7657         if (get_jenv_res == JNI_EDETACHED) {
7658                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7659         }
7660         return ret_ref;
7661 }
7662 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
7663         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
7664         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7665 }
7666 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
7667         jclass c = (*env)->GetObjectClass(env, o);
7668         CHECK(c != NULL);
7669         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
7670         atomic_init(&calls->refcnt, 1);
7671         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7672         calls->o = (*env)->NewWeakGlobalRef(env, o);
7673         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7674         CHECK(calls->get_secure_random_bytes_meth != NULL);
7675
7676         LDKEntropySource ret = {
7677                 .this_arg = (void*) calls,
7678                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
7679                 .free = LDKEntropySource_JCalls_free,
7680         };
7681         return ret;
7682 }
7683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
7684         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
7685         *res_ptr = LDKEntropySource_init(env, clz, o);
7686         return tag_ptr(res_ptr, true);
7687 }
7688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7689         void* this_arg_ptr = untag_ptr(this_arg);
7690         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7691         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
7692         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7693         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7694         return ret_arr;
7695 }
7696
7697 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
7698 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
7699 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
7700 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
7701 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
7702 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
7703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
7704         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
7705                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
7706         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
7707         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
7708         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
7709         LDKUnsignedGossipMessage_ChannelUpdate_class =
7710                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
7711         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
7712         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
7713         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
7714         LDKUnsignedGossipMessage_NodeAnnouncement_class =
7715                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
7716         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
7717         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
7718         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
7719 }
7720 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7721         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7722         switch(obj->tag) {
7723                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
7724                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
7725                         int64_t channel_announcement_ref = 0;
7726                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
7727                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
7728                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
7729                 }
7730                 case LDKUnsignedGossipMessage_ChannelUpdate: {
7731                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
7732                         int64_t channel_update_ref = 0;
7733                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
7734                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
7735                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
7736                 }
7737                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
7738                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
7739                         int64_t node_announcement_ref = 0;
7740                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
7741                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
7742                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
7743                 }
7744                 default: abort();
7745         }
7746 }
7747 typedef struct LDKNodeSigner_JCalls {
7748         atomic_size_t refcnt;
7749         JavaVM *vm;
7750         jweak o;
7751         jmethodID get_inbound_payment_key_material_meth;
7752         jmethodID get_node_id_meth;
7753         jmethodID ecdh_meth;
7754         jmethodID sign_invoice_meth;
7755         jmethodID sign_gossip_message_meth;
7756 } LDKNodeSigner_JCalls;
7757 static void LDKNodeSigner_JCalls_free(void* this_arg) {
7758         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7759         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7760                 JNIEnv *env;
7761                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7762                 if (get_jenv_res == JNI_EDETACHED) {
7763                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7764                 } else {
7765                         DO_ASSERT(get_jenv_res == JNI_OK);
7766                 }
7767                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7768                 if (get_jenv_res == JNI_EDETACHED) {
7769                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7770                 }
7771                 FREE(j_calls);
7772         }
7773 }
7774 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
7775         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7776         JNIEnv *env;
7777         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7778         if (get_jenv_res == JNI_EDETACHED) {
7779                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7780         } else {
7781                 DO_ASSERT(get_jenv_res == JNI_OK);
7782         }
7783         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7784         CHECK(obj != NULL);
7785         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7786         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7787                 (*env)->ExceptionDescribe(env);
7788                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
7789         }
7790         LDKThirtyTwoBytes ret_ref;
7791         CHECK((*env)->GetArrayLength(env, ret) == 32);
7792         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7793         if (get_jenv_res == JNI_EDETACHED) {
7794                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7795         }
7796         return ret_ref;
7797 }
7798 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
7799         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7800         JNIEnv *env;
7801         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7802         if (get_jenv_res == JNI_EDETACHED) {
7803                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7804         } else {
7805                 DO_ASSERT(get_jenv_res == JNI_OK);
7806         }
7807         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7808         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7809         CHECK(obj != NULL);
7810         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
7811         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7812                 (*env)->ExceptionDescribe(env);
7813                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
7814         }
7815         void* ret_ptr = untag_ptr(ret);
7816         CHECK_ACCESS(ret_ptr);
7817         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
7818         FREE(untag_ptr(ret));
7819         if (get_jenv_res == JNI_EDETACHED) {
7820                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7821         }
7822         return ret_conv;
7823 }
7824 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
7825         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7826         JNIEnv *env;
7827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7828         if (get_jenv_res == JNI_EDETACHED) {
7829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7830         } else {
7831                 DO_ASSERT(get_jenv_res == JNI_OK);
7832         }
7833         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7834         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
7835         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
7836         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
7837         *tweak_copy = tweak;
7838         int64_t tweak_ref = tag_ptr(tweak_copy, true);
7839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7840         CHECK(obj != NULL);
7841         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
7842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7843                 (*env)->ExceptionDescribe(env);
7844                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
7845         }
7846         void* ret_ptr = untag_ptr(ret);
7847         CHECK_ACCESS(ret_ptr);
7848         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
7849         FREE(untag_ptr(ret));
7850         if (get_jenv_res == JNI_EDETACHED) {
7851                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7852         }
7853         return ret_conv;
7854 }
7855 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
7856         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7857         JNIEnv *env;
7858         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7859         if (get_jenv_res == JNI_EDETACHED) {
7860                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7861         } else {
7862                 DO_ASSERT(get_jenv_res == JNI_OK);
7863         }
7864         LDKu8slice hrp_bytes_var = hrp_bytes;
7865         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
7866         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
7867         LDKCVec_U5Z invoice_data_var = invoice_data;
7868         jobjectArray invoice_data_arr = NULL;
7869         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
7870         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
7871         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7872                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7873                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7874         }
7875         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
7876         FREE(invoice_data_var.data);
7877         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7878         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7879         CHECK(obj != NULL);
7880         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
7881         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7882                 (*env)->ExceptionDescribe(env);
7883                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
7884         }
7885         void* ret_ptr = untag_ptr(ret);
7886         CHECK_ACCESS(ret_ptr);
7887         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7888         FREE(untag_ptr(ret));
7889         if (get_jenv_res == JNI_EDETACHED) {
7890                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7891         }
7892         return ret_conv;
7893 }
7894 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
7895         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7896         JNIEnv *env;
7897         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7898         if (get_jenv_res == JNI_EDETACHED) {
7899                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7900         } else {
7901                 DO_ASSERT(get_jenv_res == JNI_OK);
7902         }
7903         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
7904         *msg_copy = msg;
7905         int64_t msg_ref = tag_ptr(msg_copy, true);
7906         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7907         CHECK(obj != NULL);
7908         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
7909         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7910                 (*env)->ExceptionDescribe(env);
7911                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
7912         }
7913         void* ret_ptr = untag_ptr(ret);
7914         CHECK_ACCESS(ret_ptr);
7915         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
7916         FREE(untag_ptr(ret));
7917         if (get_jenv_res == JNI_EDETACHED) {
7918                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7919         }
7920         return ret_conv;
7921 }
7922 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
7923         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
7924         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7925 }
7926 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
7927         jclass c = (*env)->GetObjectClass(env, o);
7928         CHECK(c != NULL);
7929         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
7930         atomic_init(&calls->refcnt, 1);
7931         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7932         calls->o = (*env)->NewWeakGlobalRef(env, o);
7933         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
7934         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
7935         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
7936         CHECK(calls->get_node_id_meth != NULL);
7937         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
7938         CHECK(calls->ecdh_meth != NULL);
7939         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
7940         CHECK(calls->sign_invoice_meth != NULL);
7941         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
7942         CHECK(calls->sign_gossip_message_meth != NULL);
7943
7944         LDKNodeSigner ret = {
7945                 .this_arg = (void*) calls,
7946                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
7947                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
7948                 .ecdh = ecdh_LDKNodeSigner_jcall,
7949                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
7950                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
7951                 .free = LDKNodeSigner_JCalls_free,
7952         };
7953         return ret;
7954 }
7955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
7956         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
7957         *res_ptr = LDKNodeSigner_init(env, clz, o);
7958         return tag_ptr(res_ptr, true);
7959 }
7960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
7961         void* this_arg_ptr = untag_ptr(this_arg);
7962         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7963         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7964         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7965         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
7966         return ret_arr;
7967 }
7968
7969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
7970         void* this_arg_ptr = untag_ptr(this_arg);
7971         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7972         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7973         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7974         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
7975         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
7976         return tag_ptr(ret_conv, true);
7977 }
7978
7979 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) {
7980         void* this_arg_ptr = untag_ptr(this_arg);
7981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7982         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7983         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7984         LDKPublicKey other_key_ref;
7985         CHECK((*env)->GetArrayLength(env, other_key) == 33);
7986         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
7987         void* tweak_ptr = untag_ptr(tweak);
7988         CHECK_ACCESS(tweak_ptr);
7989         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
7990         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
7991         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
7992         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
7993         return tag_ptr(ret_conv, true);
7994 }
7995
7996 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) {
7997         void* this_arg_ptr = untag_ptr(this_arg);
7998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7999         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8000         LDKu8slice hrp_bytes_ref;
8001         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
8002         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
8003         LDKCVec_U5Z invoice_data_constr;
8004         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
8005         if (invoice_data_constr.datalen > 0)
8006                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
8007         else
8008                 invoice_data_constr.data = NULL;
8009         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
8010         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
8011                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
8012                 
8013                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
8014         }
8015         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
8016         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8017         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8018         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
8019         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
8020         return tag_ptr(ret_conv, true);
8021 }
8022
8023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8024         void* this_arg_ptr = untag_ptr(this_arg);
8025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8026         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8027         void* msg_ptr = untag_ptr(msg);
8028         CHECK_ACCESS(msg_ptr);
8029         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
8030         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
8031         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
8032         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
8033         return tag_ptr(ret_conv, true);
8034 }
8035
8036 typedef struct LDKSignerProvider_JCalls {
8037         atomic_size_t refcnt;
8038         JavaVM *vm;
8039         jweak o;
8040         jmethodID generate_channel_keys_id_meth;
8041         jmethodID derive_channel_signer_meth;
8042         jmethodID read_chan_signer_meth;
8043         jmethodID get_destination_script_meth;
8044         jmethodID get_shutdown_scriptpubkey_meth;
8045 } LDKSignerProvider_JCalls;
8046 static void LDKSignerProvider_JCalls_free(void* this_arg) {
8047         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8048         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8049                 JNIEnv *env;
8050                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8051                 if (get_jenv_res == JNI_EDETACHED) {
8052                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8053                 } else {
8054                         DO_ASSERT(get_jenv_res == JNI_OK);
8055                 }
8056                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8057                 if (get_jenv_res == JNI_EDETACHED) {
8058                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8059                 }
8060                 FREE(j_calls);
8061         }
8062 }
8063 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
8064         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8065         JNIEnv *env;
8066         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8067         if (get_jenv_res == JNI_EDETACHED) {
8068                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8069         } else {
8070                 DO_ASSERT(get_jenv_res == JNI_OK);
8071         }
8072         jboolean inbound_conv = inbound;
8073         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8074         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
8075         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
8076         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8077         CHECK(obj != NULL);
8078         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
8079         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8080                 (*env)->ExceptionDescribe(env);
8081                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
8082         }
8083         LDKThirtyTwoBytes ret_ref;
8084         CHECK((*env)->GetArrayLength(env, ret) == 32);
8085         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8086         if (get_jenv_res == JNI_EDETACHED) {
8087                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8088         }
8089         return ret_ref;
8090 }
8091 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
8092         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8093         JNIEnv *env;
8094         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8095         if (get_jenv_res == JNI_EDETACHED) {
8096                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8097         } else {
8098                 DO_ASSERT(get_jenv_res == JNI_OK);
8099         }
8100         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8101         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
8102         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
8103         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8104         CHECK(obj != NULL);
8105         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
8106         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8107                 (*env)->ExceptionDescribe(env);
8108                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
8109         }
8110         void* ret_ptr = untag_ptr(ret);
8111         CHECK_ACCESS(ret_ptr);
8112         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
8113         FREE(untag_ptr(ret));
8114         if (get_jenv_res == JNI_EDETACHED) {
8115                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8116         }
8117         return ret_conv;
8118 }
8119 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
8120         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8121         JNIEnv *env;
8122         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8123         if (get_jenv_res == JNI_EDETACHED) {
8124                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8125         } else {
8126                 DO_ASSERT(get_jenv_res == JNI_OK);
8127         }
8128         LDKu8slice reader_var = reader;
8129         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
8130         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
8131         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8132         CHECK(obj != NULL);
8133         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
8134         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8135                 (*env)->ExceptionDescribe(env);
8136                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
8137         }
8138         void* ret_ptr = untag_ptr(ret);
8139         CHECK_ACCESS(ret_ptr);
8140         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
8141         FREE(untag_ptr(ret));
8142         if (get_jenv_res == JNI_EDETACHED) {
8143                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8144         }
8145         return ret_conv;
8146 }
8147 LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
8148         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8149         JNIEnv *env;
8150         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8151         if (get_jenv_res == JNI_EDETACHED) {
8152                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8153         } else {
8154                 DO_ASSERT(get_jenv_res == JNI_OK);
8155         }
8156         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8157         CHECK(obj != NULL);
8158         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
8159         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8160                 (*env)->ExceptionDescribe(env);
8161                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
8162         }
8163         LDKCVec_u8Z ret_ref;
8164         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
8165         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8166         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
8167         if (get_jenv_res == JNI_EDETACHED) {
8168                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8169         }
8170         return ret_ref;
8171 }
8172 LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
8173         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8174         JNIEnv *env;
8175         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8176         if (get_jenv_res == JNI_EDETACHED) {
8177                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8178         } else {
8179                 DO_ASSERT(get_jenv_res == JNI_OK);
8180         }
8181         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8182         CHECK(obj != NULL);
8183         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
8184         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8185                 (*env)->ExceptionDescribe(env);
8186                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
8187         }
8188         LDKShutdownScript ret_conv;
8189         ret_conv.inner = untag_ptr(ret);
8190         ret_conv.is_owned = ptr_is_owned(ret);
8191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
8192         if (get_jenv_res == JNI_EDETACHED) {
8193                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8194         }
8195         return ret_conv;
8196 }
8197 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
8198         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
8199         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8200 }
8201 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
8202         jclass c = (*env)->GetObjectClass(env, o);
8203         CHECK(c != NULL);
8204         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
8205         atomic_init(&calls->refcnt, 1);
8206         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8207         calls->o = (*env)->NewWeakGlobalRef(env, o);
8208         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
8209         CHECK(calls->generate_channel_keys_id_meth != NULL);
8210         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
8211         CHECK(calls->derive_channel_signer_meth != NULL);
8212         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
8213         CHECK(calls->read_chan_signer_meth != NULL);
8214         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
8215         CHECK(calls->get_destination_script_meth != NULL);
8216         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
8217         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
8218
8219         LDKSignerProvider ret = {
8220                 .this_arg = (void*) calls,
8221                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
8222                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
8223                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
8224                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
8225                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
8226                 .free = LDKSignerProvider_JCalls_free,
8227         };
8228         return ret;
8229 }
8230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8231         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
8232         *res_ptr = LDKSignerProvider_init(env, clz, o);
8233         return tag_ptr(res_ptr, true);
8234 }
8235 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) {
8236         void* this_arg_ptr = untag_ptr(this_arg);
8237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8238         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8239         LDKU128 user_channel_id_ref;
8240         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
8241         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
8242         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8243         (*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);
8244         return ret_arr;
8245 }
8246
8247 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) {
8248         void* this_arg_ptr = untag_ptr(this_arg);
8249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8250         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8251         LDKThirtyTwoBytes channel_keys_id_ref;
8252         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
8253         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
8254         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
8255         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
8256         return tag_ptr(ret_ret, true);
8257 }
8258
8259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
8260         void* this_arg_ptr = untag_ptr(this_arg);
8261         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8262         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8263         LDKu8slice reader_ref;
8264         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
8265         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
8266         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
8267         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
8268         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
8269         return tag_ptr(ret_conv, true);
8270 }
8271
8272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
8273         void* this_arg_ptr = untag_ptr(this_arg);
8274         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8275         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8276         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
8277         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8278         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8279         CVec_u8Z_free(ret_var);
8280         return ret_arr;
8281 }
8282
8283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
8284         void* this_arg_ptr = untag_ptr(this_arg);
8285         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8286         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8287         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
8288         int64_t ret_ref = 0;
8289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8291         return ret_ref;
8292 }
8293
8294 typedef struct LDKFeeEstimator_JCalls {
8295         atomic_size_t refcnt;
8296         JavaVM *vm;
8297         jweak o;
8298         jmethodID get_est_sat_per_1000_weight_meth;
8299 } LDKFeeEstimator_JCalls;
8300 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
8301         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8302         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8303                 JNIEnv *env;
8304                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8305                 if (get_jenv_res == JNI_EDETACHED) {
8306                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8307                 } else {
8308                         DO_ASSERT(get_jenv_res == JNI_OK);
8309                 }
8310                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8311                 if (get_jenv_res == JNI_EDETACHED) {
8312                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8313                 }
8314                 FREE(j_calls);
8315         }
8316 }
8317 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
8318         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8319         JNIEnv *env;
8320         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8321         if (get_jenv_res == JNI_EDETACHED) {
8322                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8323         } else {
8324                 DO_ASSERT(get_jenv_res == JNI_OK);
8325         }
8326         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
8327         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8328         CHECK(obj != NULL);
8329         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
8330         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8331                 (*env)->ExceptionDescribe(env);
8332                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
8333         }
8334         if (get_jenv_res == JNI_EDETACHED) {
8335                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8336         }
8337         return ret;
8338 }
8339 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
8340         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
8341         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8342 }
8343 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
8344         jclass c = (*env)->GetObjectClass(env, o);
8345         CHECK(c != NULL);
8346         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
8347         atomic_init(&calls->refcnt, 1);
8348         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8349         calls->o = (*env)->NewWeakGlobalRef(env, o);
8350         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
8351         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
8352
8353         LDKFeeEstimator ret = {
8354                 .this_arg = (void*) calls,
8355                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
8356                 .free = LDKFeeEstimator_JCalls_free,
8357         };
8358         return ret;
8359 }
8360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
8361         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
8362         *res_ptr = LDKFeeEstimator_init(env, clz, o);
8363         return tag_ptr(res_ptr, true);
8364 }
8365 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) {
8366         void* this_arg_ptr = untag_ptr(this_arg);
8367         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8368         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
8369         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
8370         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
8371         return ret_conv;
8372 }
8373
8374 typedef struct LDKRouter_JCalls {
8375         atomic_size_t refcnt;
8376         JavaVM *vm;
8377         jweak o;
8378         jmethodID find_route_meth;
8379         jmethodID find_route_with_id_meth;
8380 } LDKRouter_JCalls;
8381 static void LDKRouter_JCalls_free(void* this_arg) {
8382         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8383         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8384                 JNIEnv *env;
8385                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8386                 if (get_jenv_res == JNI_EDETACHED) {
8387                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8388                 } else {
8389                         DO_ASSERT(get_jenv_res == JNI_OK);
8390                 }
8391                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8392                 if (get_jenv_res == JNI_EDETACHED) {
8393                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8394                 }
8395                 FREE(j_calls);
8396         }
8397 }
8398 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs) {
8399         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8400         JNIEnv *env;
8401         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8402         if (get_jenv_res == JNI_EDETACHED) {
8403                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8404         } else {
8405                 DO_ASSERT(get_jenv_res == JNI_OK);
8406         }
8407         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8408         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8409         LDKRouteParameters route_params_var = *route_params;
8410         int64_t route_params_ref = 0;
8411         route_params_var = RouteParameters_clone(&route_params_var);
8412         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8413         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8414         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8415         int64_tArray first_hops_arr = NULL;
8416         if (first_hops != NULL) {
8417                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8418                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8419                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8420                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8421                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8422                         int64_t first_hops_conv_16_ref = 0;
8423                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8424                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8425                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8426                 }
8427                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8428         }
8429         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
8430         int64_t inflight_htlcs_ref = 0;
8431         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
8432         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8433         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8434         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8435         CHECK(obj != NULL);
8436         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
8437         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8438                 (*env)->ExceptionDescribe(env);
8439                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
8440         }
8441         void* ret_ptr = untag_ptr(ret);
8442         CHECK_ACCESS(ret_ptr);
8443         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8444         FREE(untag_ptr(ret));
8445         if (get_jenv_res == JNI_EDETACHED) {
8446                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8447         }
8448         return ret_conv;
8449 }
8450 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
8451         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8452         JNIEnv *env;
8453         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8454         if (get_jenv_res == JNI_EDETACHED) {
8455                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8456         } else {
8457                 DO_ASSERT(get_jenv_res == JNI_OK);
8458         }
8459         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8460         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8461         LDKRouteParameters route_params_var = *route_params;
8462         int64_t route_params_ref = 0;
8463         route_params_var = RouteParameters_clone(&route_params_var);
8464         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8465         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8466         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8467         int64_tArray first_hops_arr = NULL;
8468         if (first_hops != NULL) {
8469                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8470                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8471                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8472                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8473                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8474                         int64_t first_hops_conv_16_ref = 0;
8475                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8476                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8477                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8478                 }
8479                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8480         }
8481         LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs;
8482         int64_t inflight_htlcs_ref = 0;
8483         inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var);
8484         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8485         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8486         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
8487         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
8488         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
8489         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
8490         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8491         CHECK(obj != NULL);
8492         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);
8493         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8494                 (*env)->ExceptionDescribe(env);
8495                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
8496         }
8497         void* ret_ptr = untag_ptr(ret);
8498         CHECK_ACCESS(ret_ptr);
8499         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8500         FREE(untag_ptr(ret));
8501         if (get_jenv_res == JNI_EDETACHED) {
8502                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8503         }
8504         return ret_conv;
8505 }
8506 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
8507         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
8508         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8509 }
8510 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
8511         jclass c = (*env)->GetObjectClass(env, o);
8512         CHECK(c != NULL);
8513         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
8514         atomic_init(&calls->refcnt, 1);
8515         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8516         calls->o = (*env)->NewWeakGlobalRef(env, o);
8517         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
8518         CHECK(calls->find_route_meth != NULL);
8519         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
8520         CHECK(calls->find_route_with_id_meth != NULL);
8521
8522         LDKRouter ret = {
8523                 .this_arg = (void*) calls,
8524                 .find_route = find_route_LDKRouter_jcall,
8525                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
8526                 .free = LDKRouter_JCalls_free,
8527         };
8528         return ret;
8529 }
8530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
8531         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
8532         *res_ptr = LDKRouter_init(env, clz, o);
8533         return tag_ptr(res_ptr, true);
8534 }
8535 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) {
8536         void* this_arg_ptr = untag_ptr(this_arg);
8537         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8538         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8539         LDKPublicKey payer_ref;
8540         CHECK((*env)->GetArrayLength(env, payer) == 33);
8541         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8542         LDKRouteParameters route_params_conv;
8543         route_params_conv.inner = untag_ptr(route_params);
8544         route_params_conv.is_owned = ptr_is_owned(route_params);
8545         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8546         route_params_conv.is_owned = false;
8547         LDKCVec_ChannelDetailsZ first_hops_constr;
8548         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8549         if (first_hops != NULL) {
8550                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8551                 if (first_hops_constr.datalen > 0)
8552                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8553                 else
8554                         first_hops_constr.data = NULL;
8555                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8556                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8557                         int64_t first_hops_conv_16 = first_hops_vals[q];
8558                         LDKChannelDetails first_hops_conv_16_conv;
8559                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8560                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8561                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8562                         first_hops_conv_16_conv.is_owned = false;
8563                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8564                 }
8565                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8566                 first_hops_ptr = &first_hops_constr;
8567         }
8568         LDKInFlightHtlcs inflight_htlcs_conv;
8569         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8570         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8571         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8572         inflight_htlcs_conv.is_owned = false;
8573         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8574         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv);
8575         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8576         return tag_ptr(ret_conv, true);
8577 }
8578
8579 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) {
8580         void* this_arg_ptr = untag_ptr(this_arg);
8581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8582         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8583         LDKPublicKey payer_ref;
8584         CHECK((*env)->GetArrayLength(env, payer) == 33);
8585         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8586         LDKRouteParameters route_params_conv;
8587         route_params_conv.inner = untag_ptr(route_params);
8588         route_params_conv.is_owned = ptr_is_owned(route_params);
8589         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8590         route_params_conv.is_owned = false;
8591         LDKCVec_ChannelDetailsZ first_hops_constr;
8592         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8593         if (first_hops != NULL) {
8594                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8595                 if (first_hops_constr.datalen > 0)
8596                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8597                 else
8598                         first_hops_constr.data = NULL;
8599                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8600                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8601                         int64_t first_hops_conv_16 = first_hops_vals[q];
8602                         LDKChannelDetails first_hops_conv_16_conv;
8603                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8604                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8605                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8606                         first_hops_conv_16_conv.is_owned = false;
8607                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8608                 }
8609                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8610                 first_hops_ptr = &first_hops_constr;
8611         }
8612         LDKInFlightHtlcs inflight_htlcs_conv;
8613         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8614         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8615         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8616         inflight_htlcs_conv.is_owned = false;
8617         LDKThirtyTwoBytes _payment_hash_ref;
8618         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
8619         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
8620         LDKThirtyTwoBytes _payment_id_ref;
8621         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
8622         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
8623         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8624         *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);
8625         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8626         return tag_ptr(ret_conv, true);
8627 }
8628
8629 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
8630         return ThirtyTwoBytes_clone(&owner->a);
8631 }
8632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8633         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
8634         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8635         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
8636         return ret_arr;
8637 }
8638
8639 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
8640         LDKChannelManager ret = owner->b;
8641         ret.is_owned = false;
8642         return ret;
8643 }
8644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8645         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
8646         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
8647         int64_t ret_ref = 0;
8648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8650         return ret_ref;
8651 }
8652
8653 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8654 CHECK(owner->result_ok);
8655         return &*owner->contents.result;
8656 }
8657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8658         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8659         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
8660         return ret_ret;
8661 }
8662
8663 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8664 CHECK(!owner->result_ok);
8665         return DecodeError_clone(&*owner->contents.err);
8666 }
8667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8668         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8669         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8670         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
8671         int64_t ret_ref = tag_ptr(ret_copy, true);
8672         return ret_ref;
8673 }
8674
8675 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8676         LDKChannelConfig ret = *owner->contents.result;
8677         ret.is_owned = false;
8678         return ret;
8679 }
8680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8681         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8682         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
8683         int64_t ret_ref = 0;
8684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8686         return ret_ref;
8687 }
8688
8689 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8690 CHECK(!owner->result_ok);
8691         return DecodeError_clone(&*owner->contents.err);
8692 }
8693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8694         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8695         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8696         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
8697         int64_t ret_ref = tag_ptr(ret_copy, true);
8698         return ret_ref;
8699 }
8700
8701 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
8702 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
8703 static jclass LDKCOption_APIErrorZ_None_class = NULL;
8704 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
8705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
8706         LDKCOption_APIErrorZ_Some_class =
8707                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
8708         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
8709         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
8710         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
8711         LDKCOption_APIErrorZ_None_class =
8712                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
8713         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
8714         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
8715         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
8716 }
8717 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8718         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
8719         switch(obj->tag) {
8720                 case LDKCOption_APIErrorZ_Some: {
8721                         int64_t some_ref = tag_ptr(&obj->some, false);
8722                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
8723                 }
8724                 case LDKCOption_APIErrorZ_None: {
8725                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
8726                 }
8727                 default: abort();
8728         }
8729 }
8730 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8731 CHECK(owner->result_ok);
8732         return COption_APIErrorZ_clone(&*owner->contents.result);
8733 }
8734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8735         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8736         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
8737         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
8738         int64_t ret_ref = tag_ptr(ret_copy, true);
8739         return ret_ref;
8740 }
8741
8742 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8743 CHECK(!owner->result_ok);
8744         return DecodeError_clone(&*owner->contents.err);
8745 }
8746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8747         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8748         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8749         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
8750         int64_t ret_ref = tag_ptr(ret_copy, true);
8751         return ret_ref;
8752 }
8753
8754 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
8755         LDKOutPoint ret = *owner->contents.result;
8756         ret.is_owned = false;
8757         return ret;
8758 }
8759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8760         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
8761         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
8762         int64_t ret_ref = 0;
8763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8765         return ret_ref;
8766 }
8767
8768 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
8769 CHECK(!owner->result_ok);
8770         return DecodeError_clone(&*owner->contents.err);
8771 }
8772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8773         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
8774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8775         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
8776         int64_t ret_ref = tag_ptr(ret_copy, true);
8777         return ret_ref;
8778 }
8779
8780 typedef struct LDKType_JCalls {
8781         atomic_size_t refcnt;
8782         JavaVM *vm;
8783         jweak o;
8784         jmethodID type_id_meth;
8785         jmethodID debug_str_meth;
8786         jmethodID write_meth;
8787 } LDKType_JCalls;
8788 static void LDKType_JCalls_free(void* this_arg) {
8789         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8790         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8791                 JNIEnv *env;
8792                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8793                 if (get_jenv_res == JNI_EDETACHED) {
8794                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8795                 } else {
8796                         DO_ASSERT(get_jenv_res == JNI_OK);
8797                 }
8798                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8799                 if (get_jenv_res == JNI_EDETACHED) {
8800                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8801                 }
8802                 FREE(j_calls);
8803         }
8804 }
8805 uint16_t type_id_LDKType_jcall(const void* this_arg) {
8806         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8807         JNIEnv *env;
8808         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8809         if (get_jenv_res == JNI_EDETACHED) {
8810                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8811         } else {
8812                 DO_ASSERT(get_jenv_res == JNI_OK);
8813         }
8814         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8815         CHECK(obj != NULL);
8816         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
8817         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8818                 (*env)->ExceptionDescribe(env);
8819                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
8820         }
8821         if (get_jenv_res == JNI_EDETACHED) {
8822                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8823         }
8824         return ret;
8825 }
8826 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
8827         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8828         JNIEnv *env;
8829         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8830         if (get_jenv_res == JNI_EDETACHED) {
8831                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8832         } else {
8833                 DO_ASSERT(get_jenv_res == JNI_OK);
8834         }
8835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8836         CHECK(obj != NULL);
8837         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
8838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8839                 (*env)->ExceptionDescribe(env);
8840                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
8841         }
8842         LDKStr ret_conv = java_to_owned_str(env, ret);
8843         if (get_jenv_res == JNI_EDETACHED) {
8844                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8845         }
8846         return ret_conv;
8847 }
8848 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
8849         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8850         JNIEnv *env;
8851         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8852         if (get_jenv_res == JNI_EDETACHED) {
8853                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8854         } else {
8855                 DO_ASSERT(get_jenv_res == JNI_OK);
8856         }
8857         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8858         CHECK(obj != NULL);
8859         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
8860         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8861                 (*env)->ExceptionDescribe(env);
8862                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
8863         }
8864         LDKCVec_u8Z ret_ref;
8865         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
8866         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8867         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
8868         if (get_jenv_res == JNI_EDETACHED) {
8869                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8870         }
8871         return ret_ref;
8872 }
8873 static void LDKType_JCalls_cloned(LDKType* new_obj) {
8874         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
8875         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8876 }
8877 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
8878         jclass c = (*env)->GetObjectClass(env, o);
8879         CHECK(c != NULL);
8880         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
8881         atomic_init(&calls->refcnt, 1);
8882         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8883         calls->o = (*env)->NewWeakGlobalRef(env, o);
8884         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
8885         CHECK(calls->type_id_meth != NULL);
8886         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
8887         CHECK(calls->debug_str_meth != NULL);
8888         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
8889         CHECK(calls->write_meth != NULL);
8890
8891         LDKType ret = {
8892                 .this_arg = (void*) calls,
8893                 .type_id = type_id_LDKType_jcall,
8894                 .debug_str = debug_str_LDKType_jcall,
8895                 .write = write_LDKType_jcall,
8896                 .cloned = LDKType_JCalls_cloned,
8897                 .free = LDKType_JCalls_free,
8898         };
8899         return ret;
8900 }
8901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
8902         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
8903         *res_ptr = LDKType_init(env, clz, o);
8904         return tag_ptr(res_ptr, true);
8905 }
8906 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8907         void* this_arg_ptr = untag_ptr(this_arg);
8908         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8909         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8910         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
8911         return ret_conv;
8912 }
8913
8914 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
8915         void* this_arg_ptr = untag_ptr(this_arg);
8916         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8917         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8918         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8919         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8920         Str_free(ret_str);
8921         return ret_conv;
8922 }
8923
8924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
8925         void* this_arg_ptr = untag_ptr(this_arg);
8926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8927         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8928         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8929         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8930         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8931         CVec_u8Z_free(ret_var);
8932         return ret_arr;
8933 }
8934
8935 static jclass LDKCOption_TypeZ_Some_class = NULL;
8936 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
8937 static jclass LDKCOption_TypeZ_None_class = NULL;
8938 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
8939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
8940         LDKCOption_TypeZ_Some_class =
8941                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
8942         CHECK(LDKCOption_TypeZ_Some_class != NULL);
8943         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
8944         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
8945         LDKCOption_TypeZ_None_class =
8946                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
8947         CHECK(LDKCOption_TypeZ_None_class != NULL);
8948         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
8949         CHECK(LDKCOption_TypeZ_None_meth != NULL);
8950 }
8951 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8952         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8953         switch(obj->tag) {
8954                 case LDKCOption_TypeZ_Some: {
8955                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8956                         *some_ret = Type_clone(&obj->some);
8957                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
8958                 }
8959                 case LDKCOption_TypeZ_None: {
8960                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
8961                 }
8962                 default: abort();
8963         }
8964 }
8965 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8966 CHECK(owner->result_ok);
8967         return COption_TypeZ_clone(&*owner->contents.result);
8968 }
8969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8970         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8971         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8972         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8973         int64_t ret_ref = tag_ptr(ret_copy, true);
8974         return ret_ref;
8975 }
8976
8977 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8978 CHECK(!owner->result_ok);
8979         return DecodeError_clone(&*owner->contents.err);
8980 }
8981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8982         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8983         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8984         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8985         int64_t ret_ref = tag_ptr(ret_copy, true);
8986         return ret_ref;
8987 }
8988
8989 static jclass LDKPaymentError_Invoice_class = NULL;
8990 static jmethodID LDKPaymentError_Invoice_meth = NULL;
8991 static jclass LDKPaymentError_Sending_class = NULL;
8992 static jmethodID LDKPaymentError_Sending_meth = NULL;
8993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
8994         LDKPaymentError_Invoice_class =
8995                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
8996         CHECK(LDKPaymentError_Invoice_class != NULL);
8997         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
8998         CHECK(LDKPaymentError_Invoice_meth != NULL);
8999         LDKPaymentError_Sending_class =
9000                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
9001         CHECK(LDKPaymentError_Sending_class != NULL);
9002         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(Lorg/ldk/enums/RetryableSendFailure;)V");
9003         CHECK(LDKPaymentError_Sending_meth != NULL);
9004 }
9005 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9006         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
9007         switch(obj->tag) {
9008                 case LDKPaymentError_Invoice: {
9009                         LDKStr invoice_str = obj->invoice;
9010                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
9011                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
9012                 }
9013                 case LDKPaymentError_Sending: {
9014                         jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending);
9015                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv);
9016                 }
9017                 default: abort();
9018         }
9019 }
9020 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
9021 CHECK(owner->result_ok);
9022         return ThirtyTwoBytes_clone(&*owner->contents.result);
9023 }
9024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9025         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
9026         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9027         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
9028         return ret_arr;
9029 }
9030
9031 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
9032 CHECK(!owner->result_ok);
9033         return PaymentError_clone(&*owner->contents.err);
9034 }
9035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9036         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
9037         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
9038         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
9039         int64_t ret_ref = tag_ptr(ret_copy, true);
9040         return ret_ref;
9041 }
9042
9043 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
9044 CHECK(owner->result_ok);
9045         return *owner->contents.result;
9046 }
9047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9048         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
9049         CResult_NonePaymentErrorZ_get_ok(owner_conv);
9050 }
9051
9052 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
9053 CHECK(!owner->result_ok);
9054         return PaymentError_clone(&*owner->contents.err);
9055 }
9056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9057         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
9058         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
9059         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
9060         int64_t ret_ref = tag_ptr(ret_copy, true);
9061         return ret_ref;
9062 }
9063
9064 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
9065 CHECK(owner->result_ok);
9066         return *owner->contents.result;
9067 }
9068 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9069         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
9070         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
9071         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9072         return ret_conv;
9073 }
9074
9075 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
9076 CHECK(!owner->result_ok);
9077         return *owner->contents.err;
9078 }
9079 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9080         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
9081         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
9082         return ret_conv;
9083 }
9084
9085 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
9086 CHECK(owner->result_ok);
9087         return *owner->contents.result;
9088 }
9089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9090         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
9091         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9092         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
9093         return ret_arr;
9094 }
9095
9096 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
9097 CHECK(!owner->result_ok);
9098         return *owner->contents.err;
9099 }
9100 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9101         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
9102         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
9103         return ret_conv;
9104 }
9105
9106 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9107         LDKChannelMonitorUpdate ret = *owner->contents.result;
9108         ret.is_owned = false;
9109         return ret;
9110 }
9111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9112         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9113         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
9114         int64_t ret_ref = 0;
9115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9117         return ret_ref;
9118 }
9119
9120 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9121 CHECK(!owner->result_ok);
9122         return DecodeError_clone(&*owner->contents.err);
9123 }
9124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9125         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9126         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9127         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
9128         int64_t ret_ref = tag_ptr(ret_copy, true);
9129         return ret_ref;
9130 }
9131
9132 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
9133 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
9134 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
9135 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
9136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
9137         LDKCOption_MonitorEventZ_Some_class =
9138                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
9139         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
9140         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
9141         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
9142         LDKCOption_MonitorEventZ_None_class =
9143                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
9144         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
9145         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
9146         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
9147 }
9148 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9149         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
9150         switch(obj->tag) {
9151                 case LDKCOption_MonitorEventZ_Some: {
9152                         int64_t some_ref = tag_ptr(&obj->some, false);
9153                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
9154                 }
9155                 case LDKCOption_MonitorEventZ_None: {
9156                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
9157                 }
9158                 default: abort();
9159         }
9160 }
9161 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9162 CHECK(owner->result_ok);
9163         return COption_MonitorEventZ_clone(&*owner->contents.result);
9164 }
9165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9166         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9167         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9168         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
9169         int64_t ret_ref = tag_ptr(ret_copy, true);
9170         return ret_ref;
9171 }
9172
9173 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9174 CHECK(!owner->result_ok);
9175         return DecodeError_clone(&*owner->contents.err);
9176 }
9177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9178         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9179         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9180         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
9181         int64_t ret_ref = tag_ptr(ret_copy, true);
9182         return ret_ref;
9183 }
9184
9185 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9186         LDKHTLCUpdate ret = *owner->contents.result;
9187         ret.is_owned = false;
9188         return ret;
9189 }
9190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9191         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9192         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
9193         int64_t ret_ref = 0;
9194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9196         return ret_ref;
9197 }
9198
9199 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9200 CHECK(!owner->result_ok);
9201         return DecodeError_clone(&*owner->contents.err);
9202 }
9203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9204         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9206         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
9207         int64_t ret_ref = tag_ptr(ret_copy, true);
9208         return ret_ref;
9209 }
9210
9211 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
9212         LDKOutPoint ret = owner->a;
9213         ret.is_owned = false;
9214         return ret;
9215 }
9216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9217         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
9218         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
9219         int64_t ret_ref = 0;
9220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9222         return ret_ref;
9223 }
9224
9225 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
9226         return CVec_u8Z_clone(&owner->b);
9227 }
9228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9229         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
9230         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
9231         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9232         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9233         CVec_u8Z_free(ret_var);
9234         return ret_arr;
9235 }
9236
9237 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
9238         return owner->a;
9239 }
9240 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9241         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
9242         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
9243         return ret_conv;
9244 }
9245
9246 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
9247         return CVec_u8Z_clone(&owner->b);
9248 }
9249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9250         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
9251         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
9252         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9253         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9254         CVec_u8Z_free(ret_var);
9255         return ret_arr;
9256 }
9257
9258 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
9259         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
9260         for (size_t i = 0; i < ret.datalen; i++) {
9261                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
9262         }
9263         return ret;
9264 }
9265 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
9266         return ThirtyTwoBytes_clone(&owner->a);
9267 }
9268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9269         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
9270         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9271         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
9272         return ret_arr;
9273 }
9274
9275 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
9276         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
9277 }
9278 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9279         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
9280         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
9281         int64_tArray ret_arr = NULL;
9282         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9283         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9284         for (size_t v = 0; v < ret_var.datalen; v++) {
9285                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
9286                 *ret_conv_21_conv = ret_var.data[v];
9287                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
9288         }
9289         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9290         FREE(ret_var.data);
9291         return ret_arr;
9292 }
9293
9294 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
9295         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 };
9296         for (size_t i = 0; i < ret.datalen; i++) {
9297                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
9298         }
9299         return ret;
9300 }
9301 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
9302         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
9303         for (size_t i = 0; i < ret.datalen; i++) {
9304                 ret.data[i] = Event_clone(&orig->data[i]);
9305         }
9306         return ret;
9307 }
9308 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9309         return owner->a;
9310 }
9311 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9312         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9313         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
9314         return ret_conv;
9315 }
9316
9317 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9318         return TxOut_clone(&owner->b);
9319 }
9320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9321         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9322         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9323         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
9324         return tag_ptr(ret_ref, true);
9325 }
9326
9327 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
9328         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
9329         for (size_t i = 0; i < ret.datalen; i++) {
9330                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
9331         }
9332         return ret;
9333 }
9334 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9335         return ThirtyTwoBytes_clone(&owner->a);
9336 }
9337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9338         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9339         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9340         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
9341         return ret_arr;
9342 }
9343
9344 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9345         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
9346 }
9347 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9348         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9349         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
9350         int64_tArray ret_arr = NULL;
9351         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9352         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9353         for (size_t u = 0; u < ret_var.datalen; u++) {
9354                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9355                 *ret_conv_20_conv = ret_var.data[u];
9356                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
9357         }
9358         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9359         FREE(ret_var.data);
9360         return ret_arr;
9361 }
9362
9363 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
9364         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 };
9365         for (size_t i = 0; i < ret.datalen; i++) {
9366                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
9367         }
9368         return ret;
9369 }
9370 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
9371 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
9372 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
9373 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
9374 static jclass LDKBalance_ContentiousClaimable_class = NULL;
9375 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
9376 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
9377 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
9378 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
9379 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
9380 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
9381 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
9382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
9383         LDKBalance_ClaimableOnChannelClose_class =
9384                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
9385         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
9386         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
9387         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
9388         LDKBalance_ClaimableAwaitingConfirmations_class =
9389                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
9390         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
9391         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
9392         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
9393         LDKBalance_ContentiousClaimable_class =
9394                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
9395         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
9396         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
9397         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
9398         LDKBalance_MaybeTimeoutClaimableHTLC_class =
9399                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
9400         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
9401         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI)V");
9402         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
9403         LDKBalance_MaybePreimageClaimableHTLC_class =
9404                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
9405         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
9406         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI)V");
9407         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
9408         LDKBalance_CounterpartyRevokedOutputClaimable_class =
9409                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
9410         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
9411         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
9412         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
9413 }
9414 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9415         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
9416         switch(obj->tag) {
9417                 case LDKBalance_ClaimableOnChannelClose: {
9418                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
9419                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
9420                 }
9421                 case LDKBalance_ClaimableAwaitingConfirmations: {
9422                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
9423                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
9424                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
9425                 }
9426                 case LDKBalance_ContentiousClaimable: {
9427                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
9428                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
9429                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
9430                 }
9431                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
9432                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
9433                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
9434                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, claimable_amount_satoshis_conv, claimable_height_conv);
9435                 }
9436                 case LDKBalance_MaybePreimageClaimableHTLC: {
9437                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
9438                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
9439                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, claimable_amount_satoshis_conv, expiry_height_conv);
9440                 }
9441                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
9442                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
9443                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, claimable_amount_satoshis_conv);
9444                 }
9445                 default: abort();
9446         }
9447 }
9448 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
9449         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
9450         for (size_t i = 0; i < ret.datalen; i++) {
9451                 ret.data[i] = Balance_clone(&orig->data[i]);
9452         }
9453         return ret;
9454 }
9455 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9456 CHECK(owner->result_ok);
9457         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
9458 }
9459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9460         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9461         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9462         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
9463         return tag_ptr(ret_conv, true);
9464 }
9465
9466 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9467 CHECK(!owner->result_ok);
9468         return DecodeError_clone(&*owner->contents.err);
9469 }
9470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9471         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9473         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
9474         int64_t ret_ref = tag_ptr(ret_copy, true);
9475         return ret_ref;
9476 }
9477
9478 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9479         return owner->a;
9480 }
9481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9482         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9483         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9484         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
9485         return ret_arr;
9486 }
9487
9488 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9489         return Type_clone(&owner->b);
9490 }
9491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9492         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9493         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
9494         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
9495         return tag_ptr(ret_ret, true);
9496 }
9497
9498 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
9499         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
9500         for (size_t i = 0; i < ret.datalen; i++) {
9501                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
9502         }
9503         return ret;
9504 }
9505 typedef struct LDKCustomOnionMessageContents_JCalls {
9506         atomic_size_t refcnt;
9507         JavaVM *vm;
9508         jweak o;
9509         jmethodID tlv_type_meth;
9510         jmethodID write_meth;
9511 } LDKCustomOnionMessageContents_JCalls;
9512 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
9513         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9514         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9515                 JNIEnv *env;
9516                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9517                 if (get_jenv_res == JNI_EDETACHED) {
9518                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9519                 } else {
9520                         DO_ASSERT(get_jenv_res == JNI_OK);
9521                 }
9522                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9523                 if (get_jenv_res == JNI_EDETACHED) {
9524                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9525                 }
9526                 FREE(j_calls);
9527         }
9528 }
9529 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9530         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9531         JNIEnv *env;
9532         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9533         if (get_jenv_res == JNI_EDETACHED) {
9534                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9535         } else {
9536                 DO_ASSERT(get_jenv_res == JNI_OK);
9537         }
9538         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9539         CHECK(obj != NULL);
9540         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
9541         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9542                 (*env)->ExceptionDescribe(env);
9543                 (*env)->FatalError(env, "A call to tlv_type in LDKCustomOnionMessageContents from rust threw an exception.");
9544         }
9545         if (get_jenv_res == JNI_EDETACHED) {
9546                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9547         }
9548         return ret;
9549 }
9550 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9551         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9552         JNIEnv *env;
9553         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9554         if (get_jenv_res == JNI_EDETACHED) {
9555                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9556         } else {
9557                 DO_ASSERT(get_jenv_res == JNI_OK);
9558         }
9559         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9560         CHECK(obj != NULL);
9561         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9562         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9563                 (*env)->ExceptionDescribe(env);
9564                 (*env)->FatalError(env, "A call to write in LDKCustomOnionMessageContents from rust threw an exception.");
9565         }
9566         LDKCVec_u8Z ret_ref;
9567         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9568         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9569         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9570         if (get_jenv_res == JNI_EDETACHED) {
9571                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9572         }
9573         return ret_ref;
9574 }
9575 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
9576         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
9577         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9578 }
9579 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
9580         jclass c = (*env)->GetObjectClass(env, o);
9581         CHECK(c != NULL);
9582         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
9583         atomic_init(&calls->refcnt, 1);
9584         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9585         calls->o = (*env)->NewWeakGlobalRef(env, o);
9586         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
9587         CHECK(calls->tlv_type_meth != NULL);
9588         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9589         CHECK(calls->write_meth != NULL);
9590
9591         LDKCustomOnionMessageContents ret = {
9592                 .this_arg = (void*) calls,
9593                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
9594                 .write = write_LDKCustomOnionMessageContents_jcall,
9595                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
9596                 .free = LDKCustomOnionMessageContents_JCalls_free,
9597         };
9598         return ret;
9599 }
9600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
9601         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9602         *res_ptr = LDKCustomOnionMessageContents_init(env, clz, o);
9603         return tag_ptr(res_ptr, true);
9604 }
9605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
9606         void* this_arg_ptr = untag_ptr(this_arg);
9607         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9608         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9609         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
9610         return ret_conv;
9611 }
9612
9613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9614         void* this_arg_ptr = untag_ptr(this_arg);
9615         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9616         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9617         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9618         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9619         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9620         CVec_u8Z_free(ret_var);
9621         return ret_arr;
9622 }
9623
9624 static jclass LDKCOption_CustomOnionMessageContentsZ_Some_class = NULL;
9625 static jmethodID LDKCOption_CustomOnionMessageContentsZ_Some_meth = NULL;
9626 static jclass LDKCOption_CustomOnionMessageContentsZ_None_class = NULL;
9627 static jmethodID LDKCOption_CustomOnionMessageContentsZ_None_meth = NULL;
9628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CustomOnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
9629         LDKCOption_CustomOnionMessageContentsZ_Some_class =
9630                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$Some"));
9631         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_class != NULL);
9632         LDKCOption_CustomOnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, "<init>", "(J)V");
9633         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_meth != NULL);
9634         LDKCOption_CustomOnionMessageContentsZ_None_class =
9635                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$None"));
9636         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_class != NULL);
9637         LDKCOption_CustomOnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_None_class, "<init>", "()V");
9638         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_meth != NULL);
9639 }
9640 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CustomOnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9641         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
9642         switch(obj->tag) {
9643                 case LDKCOption_CustomOnionMessageContentsZ_Some: {
9644                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9645                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
9646                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, LDKCOption_CustomOnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
9647                 }
9648                 case LDKCOption_CustomOnionMessageContentsZ_None: {
9649                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_None_class, LDKCOption_CustomOnionMessageContentsZ_None_meth);
9650                 }
9651                 default: abort();
9652         }
9653 }
9654 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9655 CHECK(owner->result_ok);
9656         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
9657 }
9658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9659         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9660         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
9661         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
9662         int64_t ret_ref = tag_ptr(ret_copy, true);
9663         return ret_ref;
9664 }
9665
9666 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9667 CHECK(!owner->result_ok);
9668         return DecodeError_clone(&*owner->contents.err);
9669 }
9670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9671         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9672         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9673         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
9674         int64_t ret_ref = tag_ptr(ret_copy, true);
9675         return ret_ref;
9676 }
9677
9678 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
9679 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
9680 static jclass LDKCOption_NetAddressZ_None_class = NULL;
9681 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
9682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
9683         LDKCOption_NetAddressZ_Some_class =
9684                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
9685         CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
9686         LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
9687         CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
9688         LDKCOption_NetAddressZ_None_class =
9689                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
9690         CHECK(LDKCOption_NetAddressZ_None_class != NULL);
9691         LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
9692         CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
9693 }
9694 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9695         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
9696         switch(obj->tag) {
9697                 case LDKCOption_NetAddressZ_Some: {
9698                         int64_t some_ref = tag_ptr(&obj->some, false);
9699                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
9700                 }
9701                 case LDKCOption_NetAddressZ_None: {
9702                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
9703                 }
9704                 default: abort();
9705         }
9706 }
9707 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
9708         return owner->a;
9709 }
9710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9711         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
9712         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9713         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form);
9714         return ret_arr;
9715 }
9716
9717 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
9718         return COption_NetAddressZ_clone(&owner->b);
9719 }
9720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9721         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
9722         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
9723         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
9724         int64_t ret_ref = tag_ptr(ret_copy, true);
9725         return ret_ref;
9726 }
9727
9728 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
9729         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
9730         for (size_t i = 0; i < ret.datalen; i++) {
9731                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
9732         }
9733         return ret;
9734 }
9735 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
9736 CHECK(owner->result_ok);
9737         return CVec_u8Z_clone(&*owner->contents.result);
9738 }
9739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9740         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
9741         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
9742         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9743         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9744         CVec_u8Z_free(ret_var);
9745         return ret_arr;
9746 }
9747
9748 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
9749         LDKPeerHandleError ret = *owner->contents.err;
9750         ret.is_owned = false;
9751         return ret;
9752 }
9753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9754         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
9755         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
9756         int64_t ret_ref = 0;
9757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9759         return ret_ref;
9760 }
9761
9762 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
9763 CHECK(owner->result_ok);
9764         return *owner->contents.result;
9765 }
9766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9767         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9768         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
9769 }
9770
9771 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
9772         LDKPeerHandleError ret = *owner->contents.err;
9773         ret.is_owned = false;
9774         return ret;
9775 }
9776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9777         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9778         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
9779         int64_t ret_ref = 0;
9780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9782         return ret_ref;
9783 }
9784
9785 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9786 CHECK(owner->result_ok);
9787         return *owner->contents.result;
9788 }
9789 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9790         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9791         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
9792         return ret_conv;
9793 }
9794
9795 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9796         LDKPeerHandleError ret = *owner->contents.err;
9797         ret.is_owned = false;
9798         return ret;
9799 }
9800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9801         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9802         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
9803         int64_t ret_ref = 0;
9804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9806         return ret_ref;
9807 }
9808
9809 static jclass LDKSendError_Secp256k1_class = NULL;
9810 static jmethodID LDKSendError_Secp256k1_meth = NULL;
9811 static jclass LDKSendError_TooBigPacket_class = NULL;
9812 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
9813 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
9814 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
9815 static jclass LDKSendError_InvalidFirstHop_class = NULL;
9816 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
9817 static jclass LDKSendError_InvalidMessage_class = NULL;
9818 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
9819 static jclass LDKSendError_BufferFull_class = NULL;
9820 static jmethodID LDKSendError_BufferFull_meth = NULL;
9821 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
9822 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
9823 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
9824 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
9825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
9826         LDKSendError_Secp256k1_class =
9827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
9828         CHECK(LDKSendError_Secp256k1_class != NULL);
9829         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
9830         CHECK(LDKSendError_Secp256k1_meth != NULL);
9831         LDKSendError_TooBigPacket_class =
9832                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
9833         CHECK(LDKSendError_TooBigPacket_class != NULL);
9834         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
9835         CHECK(LDKSendError_TooBigPacket_meth != NULL);
9836         LDKSendError_TooFewBlindedHops_class =
9837                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
9838         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
9839         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
9840         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
9841         LDKSendError_InvalidFirstHop_class =
9842                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
9843         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
9844         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
9845         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
9846         LDKSendError_InvalidMessage_class =
9847                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
9848         CHECK(LDKSendError_InvalidMessage_class != NULL);
9849         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
9850         CHECK(LDKSendError_InvalidMessage_meth != NULL);
9851         LDKSendError_BufferFull_class =
9852                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
9853         CHECK(LDKSendError_BufferFull_class != NULL);
9854         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
9855         CHECK(LDKSendError_BufferFull_meth != NULL);
9856         LDKSendError_GetNodeIdFailed_class =
9857                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
9858         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
9859         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
9860         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
9861         LDKSendError_BlindedPathAdvanceFailed_class =
9862                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
9863         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
9864         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
9865         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
9866 }
9867 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9868         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
9869         switch(obj->tag) {
9870                 case LDKSendError_Secp256k1: {
9871                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
9872                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
9873                 }
9874                 case LDKSendError_TooBigPacket: {
9875                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
9876                 }
9877                 case LDKSendError_TooFewBlindedHops: {
9878                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
9879                 }
9880                 case LDKSendError_InvalidFirstHop: {
9881                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
9882                 }
9883                 case LDKSendError_InvalidMessage: {
9884                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
9885                 }
9886                 case LDKSendError_BufferFull: {
9887                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
9888                 }
9889                 case LDKSendError_GetNodeIdFailed: {
9890                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
9891                 }
9892                 case LDKSendError_BlindedPathAdvanceFailed: {
9893                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
9894                 }
9895                 default: abort();
9896         }
9897 }
9898 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
9899 CHECK(owner->result_ok);
9900         return *owner->contents.result;
9901 }
9902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9903         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
9904         CResult_NoneSendErrorZ_get_ok(owner_conv);
9905 }
9906
9907 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
9908 CHECK(!owner->result_ok);
9909         return SendError_clone(&*owner->contents.err);
9910 }
9911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9912         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
9913         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
9914         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
9915         int64_t ret_ref = tag_ptr(ret_copy, true);
9916         return ret_ref;
9917 }
9918
9919 static jclass LDKParseError_Bech32Error_class = NULL;
9920 static jmethodID LDKParseError_Bech32Error_meth = NULL;
9921 static jclass LDKParseError_ParseAmountError_class = NULL;
9922 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
9923 static jclass LDKParseError_MalformedSignature_class = NULL;
9924 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
9925 static jclass LDKParseError_BadPrefix_class = NULL;
9926 static jmethodID LDKParseError_BadPrefix_meth = NULL;
9927 static jclass LDKParseError_UnknownCurrency_class = NULL;
9928 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
9929 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
9930 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
9931 static jclass LDKParseError_MalformedHRP_class = NULL;
9932 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
9933 static jclass LDKParseError_TooShortDataPart_class = NULL;
9934 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
9935 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
9936 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
9937 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
9938 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
9939 static jclass LDKParseError_PaddingError_class = NULL;
9940 static jmethodID LDKParseError_PaddingError_meth = NULL;
9941 static jclass LDKParseError_IntegerOverflowError_class = NULL;
9942 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
9943 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
9944 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
9945 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
9946 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
9947 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
9948 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
9949 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
9950 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
9951 static jclass LDKParseError_InvalidSliceLength_class = NULL;
9952 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
9953 static jclass LDKParseError_Skip_class = NULL;
9954 static jmethodID LDKParseError_Skip_meth = NULL;
9955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
9956         LDKParseError_Bech32Error_class =
9957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
9958         CHECK(LDKParseError_Bech32Error_class != NULL);
9959         LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
9960         CHECK(LDKParseError_Bech32Error_meth != NULL);
9961         LDKParseError_ParseAmountError_class =
9962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
9963         CHECK(LDKParseError_ParseAmountError_class != NULL);
9964         LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
9965         CHECK(LDKParseError_ParseAmountError_meth != NULL);
9966         LDKParseError_MalformedSignature_class =
9967                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
9968         CHECK(LDKParseError_MalformedSignature_class != NULL);
9969         LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
9970         CHECK(LDKParseError_MalformedSignature_meth != NULL);
9971         LDKParseError_BadPrefix_class =
9972                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
9973         CHECK(LDKParseError_BadPrefix_class != NULL);
9974         LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
9975         CHECK(LDKParseError_BadPrefix_meth != NULL);
9976         LDKParseError_UnknownCurrency_class =
9977                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
9978         CHECK(LDKParseError_UnknownCurrency_class != NULL);
9979         LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
9980         CHECK(LDKParseError_UnknownCurrency_meth != NULL);
9981         LDKParseError_UnknownSiPrefix_class =
9982                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
9983         CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
9984         LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
9985         CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
9986         LDKParseError_MalformedHRP_class =
9987                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
9988         CHECK(LDKParseError_MalformedHRP_class != NULL);
9989         LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
9990         CHECK(LDKParseError_MalformedHRP_meth != NULL);
9991         LDKParseError_TooShortDataPart_class =
9992                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
9993         CHECK(LDKParseError_TooShortDataPart_class != NULL);
9994         LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
9995         CHECK(LDKParseError_TooShortDataPart_meth != NULL);
9996         LDKParseError_UnexpectedEndOfTaggedFields_class =
9997                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
9998         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
9999         LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
10000         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
10001         LDKParseError_DescriptionDecodeError_class =
10002                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
10003         CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
10004         LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
10005         CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
10006         LDKParseError_PaddingError_class =
10007                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
10008         CHECK(LDKParseError_PaddingError_class != NULL);
10009         LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
10010         CHECK(LDKParseError_PaddingError_meth != NULL);
10011         LDKParseError_IntegerOverflowError_class =
10012                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
10013         CHECK(LDKParseError_IntegerOverflowError_class != NULL);
10014         LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
10015         CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
10016         LDKParseError_InvalidSegWitProgramLength_class =
10017                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
10018         CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
10019         LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
10020         CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
10021         LDKParseError_InvalidPubKeyHashLength_class =
10022                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
10023         CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
10024         LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
10025         CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
10026         LDKParseError_InvalidScriptHashLength_class =
10027                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
10028         CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
10029         LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
10030         CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
10031         LDKParseError_InvalidRecoveryId_class =
10032                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
10033         CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
10034         LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
10035         CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
10036         LDKParseError_InvalidSliceLength_class =
10037                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
10038         CHECK(LDKParseError_InvalidSliceLength_class != NULL);
10039         LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
10040         CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
10041         LDKParseError_Skip_class =
10042                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
10043         CHECK(LDKParseError_Skip_class != NULL);
10044         LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
10045         CHECK(LDKParseError_Skip_meth != NULL);
10046 }
10047 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10048         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
10049         switch(obj->tag) {
10050                 case LDKParseError_Bech32Error: {
10051                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
10052                         return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
10053                 }
10054                 case LDKParseError_ParseAmountError: {
10055                         /*obj->parse_amount_error*/
10056                         return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
10057                 }
10058                 case LDKParseError_MalformedSignature: {
10059                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
10060                         return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
10061                 }
10062                 case LDKParseError_BadPrefix: {
10063                         return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
10064                 }
10065                 case LDKParseError_UnknownCurrency: {
10066                         return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
10067                 }
10068                 case LDKParseError_UnknownSiPrefix: {
10069                         return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
10070                 }
10071                 case LDKParseError_MalformedHRP: {
10072                         return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
10073                 }
10074                 case LDKParseError_TooShortDataPart: {
10075                         return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
10076                 }
10077                 case LDKParseError_UnexpectedEndOfTaggedFields: {
10078                         return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
10079                 }
10080                 case LDKParseError_DescriptionDecodeError: {
10081                         /*obj->description_decode_error*/
10082                         return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
10083                 }
10084                 case LDKParseError_PaddingError: {
10085                         return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
10086                 }
10087                 case LDKParseError_IntegerOverflowError: {
10088                         return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
10089                 }
10090                 case LDKParseError_InvalidSegWitProgramLength: {
10091                         return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
10092                 }
10093                 case LDKParseError_InvalidPubKeyHashLength: {
10094                         return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
10095                 }
10096                 case LDKParseError_InvalidScriptHashLength: {
10097                         return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
10098                 }
10099                 case LDKParseError_InvalidRecoveryId: {
10100                         return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
10101                 }
10102                 case LDKParseError_InvalidSliceLength: {
10103                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
10104                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
10105                         return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
10106                 }
10107                 case LDKParseError_Skip: {
10108                         return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
10109                 }
10110                 default: abort();
10111         }
10112 }
10113 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
10114 CHECK(owner->result_ok);
10115         return SiPrefix_clone(&*owner->contents.result);
10116 }
10117 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10118         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
10119         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
10120         return ret_conv;
10121 }
10122
10123 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
10124 CHECK(!owner->result_ok);
10125         return ParseError_clone(&*owner->contents.err);
10126 }
10127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10128         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
10129         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
10130         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
10131         int64_t ret_ref = tag_ptr(ret_copy, true);
10132         return ret_ref;
10133 }
10134
10135 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
10136 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
10137 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
10138 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
10139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
10140         LDKParseOrSemanticError_ParseError_class =
10141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
10142         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
10143         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
10144         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
10145         LDKParseOrSemanticError_SemanticError_class =
10146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
10147         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
10148         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
10149         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
10150 }
10151 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10152         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10153         switch(obj->tag) {
10154                 case LDKParseOrSemanticError_ParseError: {
10155                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
10156                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
10157                 }
10158                 case LDKParseOrSemanticError_SemanticError: {
10159                         jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
10160                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
10161                 }
10162                 default: abort();
10163         }
10164 }
10165 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10166         LDKInvoice ret = *owner->contents.result;
10167         ret.is_owned = false;
10168         return ret;
10169 }
10170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10171         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10172         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
10173         int64_t ret_ref = 0;
10174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10176         return ret_ref;
10177 }
10178
10179 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10180 CHECK(!owner->result_ok);
10181         return ParseOrSemanticError_clone(&*owner->contents.err);
10182 }
10183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10184         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10185         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
10186         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
10187         int64_t ret_ref = tag_ptr(ret_copy, true);
10188         return ret_ref;
10189 }
10190
10191 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
10192         LDKSignedRawInvoice ret = *owner->contents.result;
10193         ret.is_owned = false;
10194         return ret;
10195 }
10196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10197         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
10198         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
10199         int64_t ret_ref = 0;
10200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10202         return ret_ref;
10203 }
10204
10205 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
10206 CHECK(!owner->result_ok);
10207         return ParseError_clone(&*owner->contents.err);
10208 }
10209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10210         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
10211         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
10212         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
10213         int64_t ret_ref = tag_ptr(ret_copy, true);
10214         return ret_ref;
10215 }
10216
10217 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
10218         LDKRawInvoice ret = owner->a;
10219         ret.is_owned = false;
10220         return ret;
10221 }
10222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10223         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
10224         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
10225         int64_t ret_ref = 0;
10226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10228         return ret_ref;
10229 }
10230
10231 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
10232         return ThirtyTwoBytes_clone(&owner->b);
10233 }
10234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10235         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
10236         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10237         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
10238         return ret_arr;
10239 }
10240
10241 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
10242         LDKInvoiceSignature ret = owner->c;
10243         ret.is_owned = false;
10244         return ret;
10245 }
10246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
10247         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
10248         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(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 LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
10256         LDKPayeePubKey ret = *owner->contents.result;
10257         ret.is_owned = false;
10258         return ret;
10259 }
10260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10261         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
10262         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
10263         int64_t ret_ref = 0;
10264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10266         return ret_ref;
10267 }
10268
10269 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
10270 CHECK(!owner->result_ok);
10271         return *owner->contents.err;
10272 }
10273 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10274         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
10275         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
10276         return ret_conv;
10277 }
10278
10279 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
10280         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
10281         for (size_t i = 0; i < ret.datalen; i++) {
10282                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
10283         }
10284         return ret;
10285 }
10286 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10287         LDKPositiveTimestamp ret = *owner->contents.result;
10288         ret.is_owned = false;
10289         return ret;
10290 }
10291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10292         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10293         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
10294         int64_t ret_ref = 0;
10295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10297         return ret_ref;
10298 }
10299
10300 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10301 CHECK(!owner->result_ok);
10302         return CreationError_clone(&*owner->contents.err);
10303 }
10304 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10305         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10306         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
10307         return ret_conv;
10308 }
10309
10310 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
10311 CHECK(owner->result_ok);
10312         return *owner->contents.result;
10313 }
10314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10315         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
10316         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
10317 }
10318
10319 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
10320 CHECK(!owner->result_ok);
10321         return SemanticError_clone(&*owner->contents.err);
10322 }
10323 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10324         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
10325         jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
10326         return ret_conv;
10327 }
10328
10329 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
10330         LDKInvoice ret = *owner->contents.result;
10331         ret.is_owned = false;
10332         return ret;
10333 }
10334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10335         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
10336         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
10337         int64_t ret_ref = 0;
10338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10340         return ret_ref;
10341 }
10342
10343 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
10344 CHECK(!owner->result_ok);
10345         return SemanticError_clone(&*owner->contents.err);
10346 }
10347 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10348         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
10349         jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
10350         return ret_conv;
10351 }
10352
10353 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10354         LDKDescription ret = *owner->contents.result;
10355         ret.is_owned = false;
10356         return ret;
10357 }
10358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10359         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10360         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
10361         int64_t ret_ref = 0;
10362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10364         return ret_ref;
10365 }
10366
10367 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10368 CHECK(!owner->result_ok);
10369         return CreationError_clone(&*owner->contents.err);
10370 }
10371 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10372         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10373         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
10374         return ret_conv;
10375 }
10376
10377 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10378         LDKPrivateRoute ret = *owner->contents.result;
10379         ret.is_owned = false;
10380         return ret;
10381 }
10382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10383         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10384         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
10385         int64_t ret_ref = 0;
10386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10388         return ret_ref;
10389 }
10390
10391 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10392 CHECK(!owner->result_ok);
10393         return CreationError_clone(&*owner->contents.err);
10394 }
10395 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10396         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10397         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
10398         return ret_conv;
10399 }
10400
10401 static jclass LDKGraphSyncError_DecodeError_class = NULL;
10402 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
10403 static jclass LDKGraphSyncError_LightningError_class = NULL;
10404 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
10405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
10406         LDKGraphSyncError_DecodeError_class =
10407                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
10408         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
10409         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
10410         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
10411         LDKGraphSyncError_LightningError_class =
10412                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
10413         CHECK(LDKGraphSyncError_LightningError_class != NULL);
10414         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
10415         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
10416 }
10417 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10418         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
10419         switch(obj->tag) {
10420                 case LDKGraphSyncError_DecodeError: {
10421                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
10422                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
10423                 }
10424                 case LDKGraphSyncError_LightningError: {
10425                         LDKLightningError lightning_error_var = obj->lightning_error;
10426                         int64_t lightning_error_ref = 0;
10427                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
10428                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
10429                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
10430                 }
10431                 default: abort();
10432         }
10433 }
10434 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10435 CHECK(owner->result_ok);
10436         return *owner->contents.result;
10437 }
10438 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10439         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10440         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
10441         return ret_conv;
10442 }
10443
10444 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10445 CHECK(!owner->result_ok);
10446         return GraphSyncError_clone(&*owner->contents.err);
10447 }
10448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10449         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10450         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
10451         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
10452         int64_t ret_ref = tag_ptr(ret_copy, true);
10453         return ret_ref;
10454 }
10455
10456 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
10457 CHECK(owner->result_ok);
10458         return NetAddress_clone(&*owner->contents.result);
10459 }
10460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10461         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
10462         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
10463         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
10464         int64_t ret_ref = tag_ptr(ret_copy, true);
10465         return ret_ref;
10466 }
10467
10468 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
10469 CHECK(!owner->result_ok);
10470         return DecodeError_clone(&*owner->contents.err);
10471 }
10472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10473         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
10474         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10475         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
10476         int64_t ret_ref = tag_ptr(ret_copy, true);
10477         return ret_ref;
10478 }
10479
10480 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
10481         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
10482         for (size_t i = 0; i < ret.datalen; i++) {
10483                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
10484         }
10485         return ret;
10486 }
10487 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
10488         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
10489         for (size_t i = 0; i < ret.datalen; i++) {
10490                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
10491         }
10492         return ret;
10493 }
10494 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
10495         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
10496         for (size_t i = 0; i < ret.datalen; i++) {
10497                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
10498         }
10499         return ret;
10500 }
10501 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
10502         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
10503         for (size_t i = 0; i < ret.datalen; i++) {
10504                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
10505         }
10506         return ret;
10507 }
10508 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10509         LDKAcceptChannel ret = *owner->contents.result;
10510         ret.is_owned = false;
10511         return ret;
10512 }
10513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10514         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10515         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
10516         int64_t ret_ref = 0;
10517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10519         return ret_ref;
10520 }
10521
10522 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10523 CHECK(!owner->result_ok);
10524         return DecodeError_clone(&*owner->contents.err);
10525 }
10526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10527         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10529         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
10530         int64_t ret_ref = tag_ptr(ret_copy, true);
10531         return ret_ref;
10532 }
10533
10534 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10535         LDKAnnouncementSignatures ret = *owner->contents.result;
10536         ret.is_owned = false;
10537         return ret;
10538 }
10539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10540         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10541         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
10542         int64_t ret_ref = 0;
10543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10545         return ret_ref;
10546 }
10547
10548 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10549 CHECK(!owner->result_ok);
10550         return DecodeError_clone(&*owner->contents.err);
10551 }
10552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10553         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10555         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
10556         int64_t ret_ref = tag_ptr(ret_copy, true);
10557         return ret_ref;
10558 }
10559
10560 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10561         LDKChannelReestablish ret = *owner->contents.result;
10562         ret.is_owned = false;
10563         return ret;
10564 }
10565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10566         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10567         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
10568         int64_t ret_ref = 0;
10569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10571         return ret_ref;
10572 }
10573
10574 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10575 CHECK(!owner->result_ok);
10576         return DecodeError_clone(&*owner->contents.err);
10577 }
10578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10579         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10581         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
10582         int64_t ret_ref = tag_ptr(ret_copy, true);
10583         return ret_ref;
10584 }
10585
10586 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10587         LDKClosingSigned ret = *owner->contents.result;
10588         ret.is_owned = false;
10589         return ret;
10590 }
10591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10592         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10593         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
10594         int64_t ret_ref = 0;
10595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10597         return ret_ref;
10598 }
10599
10600 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10601 CHECK(!owner->result_ok);
10602         return DecodeError_clone(&*owner->contents.err);
10603 }
10604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10605         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10607         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
10608         int64_t ret_ref = tag_ptr(ret_copy, true);
10609         return ret_ref;
10610 }
10611
10612 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10613         LDKClosingSignedFeeRange ret = *owner->contents.result;
10614         ret.is_owned = false;
10615         return ret;
10616 }
10617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10618         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10619         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
10620         int64_t ret_ref = 0;
10621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10623         return ret_ref;
10624 }
10625
10626 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10627 CHECK(!owner->result_ok);
10628         return DecodeError_clone(&*owner->contents.err);
10629 }
10630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10631         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10633         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
10634         int64_t ret_ref = tag_ptr(ret_copy, true);
10635         return ret_ref;
10636 }
10637
10638 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10639         LDKCommitmentSigned ret = *owner->contents.result;
10640         ret.is_owned = false;
10641         return ret;
10642 }
10643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10644         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10645         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
10646         int64_t ret_ref = 0;
10647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10649         return ret_ref;
10650 }
10651
10652 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10653 CHECK(!owner->result_ok);
10654         return DecodeError_clone(&*owner->contents.err);
10655 }
10656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10657         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10658         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10659         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
10660         int64_t ret_ref = tag_ptr(ret_copy, true);
10661         return ret_ref;
10662 }
10663
10664 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10665         LDKFundingCreated ret = *owner->contents.result;
10666         ret.is_owned = false;
10667         return ret;
10668 }
10669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10670         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10671         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
10672         int64_t ret_ref = 0;
10673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10675         return ret_ref;
10676 }
10677
10678 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10679 CHECK(!owner->result_ok);
10680         return DecodeError_clone(&*owner->contents.err);
10681 }
10682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10683         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10684         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10685         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
10686         int64_t ret_ref = tag_ptr(ret_copy, true);
10687         return ret_ref;
10688 }
10689
10690 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10691         LDKFundingSigned ret = *owner->contents.result;
10692         ret.is_owned = false;
10693         return ret;
10694 }
10695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10696         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10697         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
10698         int64_t ret_ref = 0;
10699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10701         return ret_ref;
10702 }
10703
10704 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10705 CHECK(!owner->result_ok);
10706         return DecodeError_clone(&*owner->contents.err);
10707 }
10708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10709         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10711         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
10712         int64_t ret_ref = tag_ptr(ret_copy, true);
10713         return ret_ref;
10714 }
10715
10716 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10717         LDKChannelReady ret = *owner->contents.result;
10718         ret.is_owned = false;
10719         return ret;
10720 }
10721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10722         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10723         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
10724         int64_t ret_ref = 0;
10725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10727         return ret_ref;
10728 }
10729
10730 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10731 CHECK(!owner->result_ok);
10732         return DecodeError_clone(&*owner->contents.err);
10733 }
10734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10735         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10736         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10737         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
10738         int64_t ret_ref = tag_ptr(ret_copy, true);
10739         return ret_ref;
10740 }
10741
10742 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10743         LDKInit ret = *owner->contents.result;
10744         ret.is_owned = false;
10745         return ret;
10746 }
10747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10748         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10749         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
10750         int64_t ret_ref = 0;
10751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10753         return ret_ref;
10754 }
10755
10756 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10757 CHECK(!owner->result_ok);
10758         return DecodeError_clone(&*owner->contents.err);
10759 }
10760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10761         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10762         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10763         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
10764         int64_t ret_ref = tag_ptr(ret_copy, true);
10765         return ret_ref;
10766 }
10767
10768 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10769         LDKOpenChannel ret = *owner->contents.result;
10770         ret.is_owned = false;
10771         return ret;
10772 }
10773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10774         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10775         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
10776         int64_t ret_ref = 0;
10777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10779         return ret_ref;
10780 }
10781
10782 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10783 CHECK(!owner->result_ok);
10784         return DecodeError_clone(&*owner->contents.err);
10785 }
10786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10787         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10788         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10789         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
10790         int64_t ret_ref = tag_ptr(ret_copy, true);
10791         return ret_ref;
10792 }
10793
10794 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10795         LDKRevokeAndACK ret = *owner->contents.result;
10796         ret.is_owned = false;
10797         return ret;
10798 }
10799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10800         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10801         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
10802         int64_t ret_ref = 0;
10803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10805         return ret_ref;
10806 }
10807
10808 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10809 CHECK(!owner->result_ok);
10810         return DecodeError_clone(&*owner->contents.err);
10811 }
10812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10813         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10814         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10815         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
10816         int64_t ret_ref = tag_ptr(ret_copy, true);
10817         return ret_ref;
10818 }
10819
10820 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10821         LDKShutdown ret = *owner->contents.result;
10822         ret.is_owned = false;
10823         return ret;
10824 }
10825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10826         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10827         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
10828         int64_t ret_ref = 0;
10829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10831         return ret_ref;
10832 }
10833
10834 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10835 CHECK(!owner->result_ok);
10836         return DecodeError_clone(&*owner->contents.err);
10837 }
10838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10839         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10840         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10841         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
10842         int64_t ret_ref = tag_ptr(ret_copy, true);
10843         return ret_ref;
10844 }
10845
10846 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10847         LDKUpdateFailHTLC ret = *owner->contents.result;
10848         ret.is_owned = false;
10849         return ret;
10850 }
10851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10852         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10853         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
10854         int64_t ret_ref = 0;
10855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10857         return ret_ref;
10858 }
10859
10860 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10861 CHECK(!owner->result_ok);
10862         return DecodeError_clone(&*owner->contents.err);
10863 }
10864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10865         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10866         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10867         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
10868         int64_t ret_ref = tag_ptr(ret_copy, true);
10869         return ret_ref;
10870 }
10871
10872 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10873         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
10874         ret.is_owned = false;
10875         return ret;
10876 }
10877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10878         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10879         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
10880         int64_t ret_ref = 0;
10881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10883         return ret_ref;
10884 }
10885
10886 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10887 CHECK(!owner->result_ok);
10888         return DecodeError_clone(&*owner->contents.err);
10889 }
10890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10891         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10892         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10893         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
10894         int64_t ret_ref = tag_ptr(ret_copy, true);
10895         return ret_ref;
10896 }
10897
10898 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10899         LDKUpdateFee ret = *owner->contents.result;
10900         ret.is_owned = false;
10901         return ret;
10902 }
10903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10904         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10905         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
10906         int64_t ret_ref = 0;
10907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10909         return ret_ref;
10910 }
10911
10912 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10913 CHECK(!owner->result_ok);
10914         return DecodeError_clone(&*owner->contents.err);
10915 }
10916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10917         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10918         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10919         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
10920         int64_t ret_ref = tag_ptr(ret_copy, true);
10921         return ret_ref;
10922 }
10923
10924 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10925         LDKUpdateFulfillHTLC ret = *owner->contents.result;
10926         ret.is_owned = false;
10927         return ret;
10928 }
10929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10930         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10931         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
10932         int64_t ret_ref = 0;
10933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10935         return ret_ref;
10936 }
10937
10938 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10939 CHECK(!owner->result_ok);
10940         return DecodeError_clone(&*owner->contents.err);
10941 }
10942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10943         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10944         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10945         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
10946         int64_t ret_ref = tag_ptr(ret_copy, true);
10947         return ret_ref;
10948 }
10949
10950 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10951         LDKUpdateAddHTLC ret = *owner->contents.result;
10952         ret.is_owned = false;
10953         return ret;
10954 }
10955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10956         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10957         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
10958         int64_t ret_ref = 0;
10959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10961         return ret_ref;
10962 }
10963
10964 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10965 CHECK(!owner->result_ok);
10966         return DecodeError_clone(&*owner->contents.err);
10967 }
10968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10969         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10970         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10971         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
10972         int64_t ret_ref = tag_ptr(ret_copy, true);
10973         return ret_ref;
10974 }
10975
10976 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10977         LDKOnionMessage ret = *owner->contents.result;
10978         ret.is_owned = false;
10979         return ret;
10980 }
10981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10982         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10983         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
10984         int64_t ret_ref = 0;
10985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10987         return ret_ref;
10988 }
10989
10990 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10991 CHECK(!owner->result_ok);
10992         return DecodeError_clone(&*owner->contents.err);
10993 }
10994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10995         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10996         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10997         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
10998         int64_t ret_ref = tag_ptr(ret_copy, true);
10999         return ret_ref;
11000 }
11001
11002 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11003         LDKPing ret = *owner->contents.result;
11004         ret.is_owned = false;
11005         return ret;
11006 }
11007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11008         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11009         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
11010         int64_t ret_ref = 0;
11011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11013         return ret_ref;
11014 }
11015
11016 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11017 CHECK(!owner->result_ok);
11018         return DecodeError_clone(&*owner->contents.err);
11019 }
11020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11021         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11022         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11023         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
11024         int64_t ret_ref = tag_ptr(ret_copy, true);
11025         return ret_ref;
11026 }
11027
11028 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11029         LDKPong ret = *owner->contents.result;
11030         ret.is_owned = false;
11031         return ret;
11032 }
11033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11034         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11035         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
11036         int64_t ret_ref = 0;
11037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11039         return ret_ref;
11040 }
11041
11042 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11043 CHECK(!owner->result_ok);
11044         return DecodeError_clone(&*owner->contents.err);
11045 }
11046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11047         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11048         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11049         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
11050         int64_t ret_ref = tag_ptr(ret_copy, true);
11051         return ret_ref;
11052 }
11053
11054 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11055         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
11056         ret.is_owned = false;
11057         return ret;
11058 }
11059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11060         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11061         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11062         int64_t ret_ref = 0;
11063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11065         return ret_ref;
11066 }
11067
11068 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11069 CHECK(!owner->result_ok);
11070         return DecodeError_clone(&*owner->contents.err);
11071 }
11072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11073         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11074         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11075         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11076         int64_t ret_ref = tag_ptr(ret_copy, true);
11077         return ret_ref;
11078 }
11079
11080 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11081         LDKChannelAnnouncement ret = *owner->contents.result;
11082         ret.is_owned = false;
11083         return ret;
11084 }
11085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11086         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11087         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11088         int64_t ret_ref = 0;
11089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11091         return ret_ref;
11092 }
11093
11094 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11095 CHECK(!owner->result_ok);
11096         return DecodeError_clone(&*owner->contents.err);
11097 }
11098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11099         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11100         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11101         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11102         int64_t ret_ref = tag_ptr(ret_copy, true);
11103         return ret_ref;
11104 }
11105
11106 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11107         LDKUnsignedChannelUpdate ret = *owner->contents.result;
11108         ret.is_owned = false;
11109         return ret;
11110 }
11111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11112         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11113         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11114         int64_t ret_ref = 0;
11115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11117         return ret_ref;
11118 }
11119
11120 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11121 CHECK(!owner->result_ok);
11122         return DecodeError_clone(&*owner->contents.err);
11123 }
11124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11125         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11126         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11127         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
11128         int64_t ret_ref = tag_ptr(ret_copy, true);
11129         return ret_ref;
11130 }
11131
11132 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11133         LDKChannelUpdate ret = *owner->contents.result;
11134         ret.is_owned = false;
11135         return ret;
11136 }
11137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11138         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11139         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11140         int64_t ret_ref = 0;
11141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11143         return ret_ref;
11144 }
11145
11146 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11147 CHECK(!owner->result_ok);
11148         return DecodeError_clone(&*owner->contents.err);
11149 }
11150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11151         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11152         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11153         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
11154         int64_t ret_ref = tag_ptr(ret_copy, true);
11155         return ret_ref;
11156 }
11157
11158 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11159         LDKErrorMessage ret = *owner->contents.result;
11160         ret.is_owned = false;
11161         return ret;
11162 }
11163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11164         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11165         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
11166         int64_t ret_ref = 0;
11167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11169         return ret_ref;
11170 }
11171
11172 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11173 CHECK(!owner->result_ok);
11174         return DecodeError_clone(&*owner->contents.err);
11175 }
11176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11177         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11178         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11179         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
11180         int64_t ret_ref = tag_ptr(ret_copy, true);
11181         return ret_ref;
11182 }
11183
11184 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11185         LDKWarningMessage ret = *owner->contents.result;
11186         ret.is_owned = false;
11187         return ret;
11188 }
11189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11190         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11191         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
11192         int64_t ret_ref = 0;
11193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11195         return ret_ref;
11196 }
11197
11198 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11199 CHECK(!owner->result_ok);
11200         return DecodeError_clone(&*owner->contents.err);
11201 }
11202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11203         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11204         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11205         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
11206         int64_t ret_ref = tag_ptr(ret_copy, true);
11207         return ret_ref;
11208 }
11209
11210 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11211         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
11212         ret.is_owned = false;
11213         return ret;
11214 }
11215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11216         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11217         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11218         int64_t ret_ref = 0;
11219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11221         return ret_ref;
11222 }
11223
11224 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11225 CHECK(!owner->result_ok);
11226         return DecodeError_clone(&*owner->contents.err);
11227 }
11228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11229         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11230         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11231         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11232         int64_t ret_ref = tag_ptr(ret_copy, true);
11233         return ret_ref;
11234 }
11235
11236 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11237         LDKNodeAnnouncement ret = *owner->contents.result;
11238         ret.is_owned = false;
11239         return ret;
11240 }
11241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11242         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11243         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11244         int64_t ret_ref = 0;
11245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11247         return ret_ref;
11248 }
11249
11250 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11251 CHECK(!owner->result_ok);
11252         return DecodeError_clone(&*owner->contents.err);
11253 }
11254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11255         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11256         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11257         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11258         int64_t ret_ref = tag_ptr(ret_copy, true);
11259         return ret_ref;
11260 }
11261
11262 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11263         LDKQueryShortChannelIds ret = *owner->contents.result;
11264         ret.is_owned = false;
11265         return ret;
11266 }
11267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11268         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11269         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
11270         int64_t ret_ref = 0;
11271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11273         return ret_ref;
11274 }
11275
11276 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11277 CHECK(!owner->result_ok);
11278         return DecodeError_clone(&*owner->contents.err);
11279 }
11280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11281         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11282         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11283         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
11284         int64_t ret_ref = tag_ptr(ret_copy, true);
11285         return ret_ref;
11286 }
11287
11288 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11289         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
11290         ret.is_owned = false;
11291         return ret;
11292 }
11293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11294         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11295         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
11296         int64_t ret_ref = 0;
11297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11299         return ret_ref;
11300 }
11301
11302 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11303 CHECK(!owner->result_ok);
11304         return DecodeError_clone(&*owner->contents.err);
11305 }
11306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11307         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11308         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11309         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
11310         int64_t ret_ref = tag_ptr(ret_copy, true);
11311         return ret_ref;
11312 }
11313
11314 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11315         LDKQueryChannelRange ret = *owner->contents.result;
11316         ret.is_owned = false;
11317         return ret;
11318 }
11319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11320         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11321         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
11322         int64_t ret_ref = 0;
11323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11325         return ret_ref;
11326 }
11327
11328 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11329 CHECK(!owner->result_ok);
11330         return DecodeError_clone(&*owner->contents.err);
11331 }
11332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11333         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11334         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11335         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
11336         int64_t ret_ref = tag_ptr(ret_copy, true);
11337         return ret_ref;
11338 }
11339
11340 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11341         LDKReplyChannelRange ret = *owner->contents.result;
11342         ret.is_owned = false;
11343         return ret;
11344 }
11345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11346         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11347         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
11348         int64_t ret_ref = 0;
11349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11351         return ret_ref;
11352 }
11353
11354 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11355 CHECK(!owner->result_ok);
11356         return DecodeError_clone(&*owner->contents.err);
11357 }
11358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11359         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11360         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11361         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
11362         int64_t ret_ref = tag_ptr(ret_copy, true);
11363         return ret_ref;
11364 }
11365
11366 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11367         LDKGossipTimestampFilter ret = *owner->contents.result;
11368         ret.is_owned = false;
11369         return ret;
11370 }
11371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11372         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11373         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
11374         int64_t ret_ref = 0;
11375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11377         return ret_ref;
11378 }
11379
11380 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11381 CHECK(!owner->result_ok);
11382         return DecodeError_clone(&*owner->contents.err);
11383 }
11384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11385         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11386         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11387         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
11388         int64_t ret_ref = tag_ptr(ret_copy, true);
11389         return ret_ref;
11390 }
11391
11392 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
11393         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
11394         for (size_t i = 0; i < ret.datalen; i++) {
11395                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
11396         }
11397         return ret;
11398 }
11399 static jclass LDKSignOrCreationError_SignError_class = NULL;
11400 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
11401 static jclass LDKSignOrCreationError_CreationError_class = NULL;
11402 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
11403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
11404         LDKSignOrCreationError_SignError_class =
11405                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
11406         CHECK(LDKSignOrCreationError_SignError_class != NULL);
11407         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
11408         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
11409         LDKSignOrCreationError_CreationError_class =
11410                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
11411         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
11412         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
11413         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
11414 }
11415 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11416         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
11417         switch(obj->tag) {
11418                 case LDKSignOrCreationError_SignError: {
11419                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
11420                 }
11421                 case LDKSignOrCreationError_CreationError: {
11422                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
11423                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
11424                 }
11425                 default: abort();
11426         }
11427 }
11428 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11429         LDKInvoice ret = *owner->contents.result;
11430         ret.is_owned = false;
11431         return ret;
11432 }
11433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11434         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11435         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
11436         int64_t ret_ref = 0;
11437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11439         return ret_ref;
11440 }
11441
11442 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11443 CHECK(!owner->result_ok);
11444         return SignOrCreationError_clone(&*owner->contents.err);
11445 }
11446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11447         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11448         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
11449         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
11450         int64_t ret_ref = tag_ptr(ret_copy, true);
11451         return ret_ref;
11452 }
11453
11454 typedef struct LDKFilter_JCalls {
11455         atomic_size_t refcnt;
11456         JavaVM *vm;
11457         jweak o;
11458         jmethodID register_tx_meth;
11459         jmethodID register_output_meth;
11460 } LDKFilter_JCalls;
11461 static void LDKFilter_JCalls_free(void* this_arg) {
11462         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11463         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11464                 JNIEnv *env;
11465                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11466                 if (get_jenv_res == JNI_EDETACHED) {
11467                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11468                 } else {
11469                         DO_ASSERT(get_jenv_res == JNI_OK);
11470                 }
11471                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11472                 if (get_jenv_res == JNI_EDETACHED) {
11473                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11474                 }
11475                 FREE(j_calls);
11476         }
11477 }
11478 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
11479         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11480         JNIEnv *env;
11481         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11482         if (get_jenv_res == JNI_EDETACHED) {
11483                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11484         } else {
11485                 DO_ASSERT(get_jenv_res == JNI_OK);
11486         }
11487         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
11488         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
11489         LDKu8slice script_pubkey_var = script_pubkey;
11490         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
11491         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
11492         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11493         CHECK(obj != NULL);
11494         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
11495         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11496                 (*env)->ExceptionDescribe(env);
11497                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
11498         }
11499         if (get_jenv_res == JNI_EDETACHED) {
11500                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11501         }
11502 }
11503 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
11504         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
11505         JNIEnv *env;
11506         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11507         if (get_jenv_res == JNI_EDETACHED) {
11508                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11509         } else {
11510                 DO_ASSERT(get_jenv_res == JNI_OK);
11511         }
11512         LDKWatchedOutput output_var = output;
11513         int64_t output_ref = 0;
11514         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
11515         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
11516         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11517         CHECK(obj != NULL);
11518         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
11519         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11520                 (*env)->ExceptionDescribe(env);
11521                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
11522         }
11523         if (get_jenv_res == JNI_EDETACHED) {
11524                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11525         }
11526 }
11527 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
11528         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
11529         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11530 }
11531 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
11532         jclass c = (*env)->GetObjectClass(env, o);
11533         CHECK(c != NULL);
11534         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
11535         atomic_init(&calls->refcnt, 1);
11536         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11537         calls->o = (*env)->NewWeakGlobalRef(env, o);
11538         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
11539         CHECK(calls->register_tx_meth != NULL);
11540         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
11541         CHECK(calls->register_output_meth != NULL);
11542
11543         LDKFilter ret = {
11544                 .this_arg = (void*) calls,
11545                 .register_tx = register_tx_LDKFilter_jcall,
11546                 .register_output = register_output_LDKFilter_jcall,
11547                 .free = LDKFilter_JCalls_free,
11548         };
11549         return ret;
11550 }
11551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
11552         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
11553         *res_ptr = LDKFilter_init(env, clz, o);
11554         return tag_ptr(res_ptr, true);
11555 }
11556 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) {
11557         void* this_arg_ptr = untag_ptr(this_arg);
11558         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11559         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11560         uint8_t txid_arr[32];
11561         CHECK((*env)->GetArrayLength(env, txid) == 32);
11562         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
11563         uint8_t (*txid_ref)[32] = &txid_arr;
11564         LDKu8slice script_pubkey_ref;
11565         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
11566         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
11567         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
11568         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
11569 }
11570
11571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
11572         void* this_arg_ptr = untag_ptr(this_arg);
11573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11574         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
11575         LDKWatchedOutput output_conv;
11576         output_conv.inner = untag_ptr(output);
11577         output_conv.is_owned = ptr_is_owned(output);
11578         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
11579         output_conv = WatchedOutput_clone(&output_conv);
11580         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
11581 }
11582
11583 static jclass LDKCOption_FilterZ_Some_class = NULL;
11584 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
11585 static jclass LDKCOption_FilterZ_None_class = NULL;
11586 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
11587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
11588         LDKCOption_FilterZ_Some_class =
11589                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
11590         CHECK(LDKCOption_FilterZ_Some_class != NULL);
11591         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
11592         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
11593         LDKCOption_FilterZ_None_class =
11594                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
11595         CHECK(LDKCOption_FilterZ_None_class != NULL);
11596         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
11597         CHECK(LDKCOption_FilterZ_None_meth != NULL);
11598 }
11599 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11600         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
11601         switch(obj->tag) {
11602                 case LDKCOption_FilterZ_Some: {
11603                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
11604                         *some_ret = obj->some;
11605                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
11606                         if ((*some_ret).free == LDKFilter_JCalls_free) {
11607                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11608                                 LDKFilter_JCalls_cloned(&(*some_ret));
11609                         }
11610                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
11611                 }
11612                 case LDKCOption_FilterZ_None: {
11613                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
11614                 }
11615                 default: abort();
11616         }
11617 }
11618 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11619         LDKLockedChannelMonitor ret = *owner->contents.result;
11620         ret.is_owned = false;
11621         return ret;
11622 }
11623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11624         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11625         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
11626         int64_t ret_ref = 0;
11627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11629         return ret_ref;
11630 }
11631
11632 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
11633 CHECK(!owner->result_ok);
11634         return *owner->contents.err;
11635 }
11636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11637         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
11638         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
11639 }
11640
11641 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
11642         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
11643         for (size_t i = 0; i < ret.datalen; i++) {
11644                 ret.data[i] = OutPoint_clone(&orig->data[i]);
11645         }
11646         return ret;
11647 }
11648 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
11649         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
11650         for (size_t i = 0; i < ret.datalen; i++) {
11651                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
11652         }
11653         return ret;
11654 }
11655 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11656         LDKOutPoint ret = owner->a;
11657         ret.is_owned = false;
11658         return ret;
11659 }
11660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11661         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11662         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
11663         int64_t ret_ref = 0;
11664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11666         return ret_ref;
11667 }
11668
11669 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
11670         return CVec_MonitorUpdateIdZ_clone(&owner->b);
11671 }
11672 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11673         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
11674         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
11675         int64_tArray ret_arr = NULL;
11676         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11677         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11678         for (size_t r = 0; r < ret_var.datalen; r++) {
11679                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
11680                 int64_t ret_conv_17_ref = 0;
11681                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
11682                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
11683                 ret_arr_ptr[r] = ret_conv_17_ref;
11684         }
11685         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11686         FREE(ret_var.data);
11687         return ret_arr;
11688 }
11689
11690 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
11691         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
11692         for (size_t i = 0; i < ret.datalen; i++) {
11693                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
11694         }
11695         return ret;
11696 }
11697 typedef struct LDKMessageSendEventsProvider_JCalls {
11698         atomic_size_t refcnt;
11699         JavaVM *vm;
11700         jweak o;
11701         jmethodID get_and_clear_pending_msg_events_meth;
11702 } LDKMessageSendEventsProvider_JCalls;
11703 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
11704         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
11705         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11706                 JNIEnv *env;
11707                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11708                 if (get_jenv_res == JNI_EDETACHED) {
11709                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11710                 } else {
11711                         DO_ASSERT(get_jenv_res == JNI_OK);
11712                 }
11713                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11714                 if (get_jenv_res == JNI_EDETACHED) {
11715                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11716                 }
11717                 FREE(j_calls);
11718         }
11719 }
11720 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
11721         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
11722         JNIEnv *env;
11723         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11724         if (get_jenv_res == JNI_EDETACHED) {
11725                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11726         } else {
11727                 DO_ASSERT(get_jenv_res == JNI_OK);
11728         }
11729         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11730         CHECK(obj != NULL);
11731         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
11732         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11733                 (*env)->ExceptionDescribe(env);
11734                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
11735         }
11736         LDKCVec_MessageSendEventZ ret_constr;
11737         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11738         if (ret_constr.datalen > 0)
11739                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11740         else
11741                 ret_constr.data = NULL;
11742         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11743         for (size_t s = 0; s < ret_constr.datalen; s++) {
11744                 int64_t ret_conv_18 = ret_vals[s];
11745                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
11746                 CHECK_ACCESS(ret_conv_18_ptr);
11747                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
11748                 FREE(untag_ptr(ret_conv_18));
11749                 ret_constr.data[s] = ret_conv_18_conv;
11750         }
11751         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11752         if (get_jenv_res == JNI_EDETACHED) {
11753                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11754         }
11755         return ret_constr;
11756 }
11757 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
11758         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
11759         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11760 }
11761 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
11762         jclass c = (*env)->GetObjectClass(env, o);
11763         CHECK(c != NULL);
11764         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
11765         atomic_init(&calls->refcnt, 1);
11766         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11767         calls->o = (*env)->NewWeakGlobalRef(env, o);
11768         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
11769         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
11770
11771         LDKMessageSendEventsProvider ret = {
11772                 .this_arg = (void*) calls,
11773                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
11774                 .free = LDKMessageSendEventsProvider_JCalls_free,
11775         };
11776         return ret;
11777 }
11778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
11779         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11780         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
11781         return tag_ptr(res_ptr, true);
11782 }
11783 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
11784         void* this_arg_ptr = untag_ptr(this_arg);
11785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11786         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
11787         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
11788         int64_tArray ret_arr = NULL;
11789         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11790         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11791         for (size_t s = 0; s < ret_var.datalen; s++) {
11792                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11793                 *ret_conv_18_copy = ret_var.data[s];
11794                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
11795                 ret_arr_ptr[s] = ret_conv_18_ref;
11796         }
11797         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11798         FREE(ret_var.data);
11799         return ret_arr;
11800 }
11801
11802 typedef struct LDKOnionMessageProvider_JCalls {
11803         atomic_size_t refcnt;
11804         JavaVM *vm;
11805         jweak o;
11806         jmethodID next_onion_message_for_peer_meth;
11807 } LDKOnionMessageProvider_JCalls;
11808 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
11809         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
11810         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11811                 JNIEnv *env;
11812                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11813                 if (get_jenv_res == JNI_EDETACHED) {
11814                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11815                 } else {
11816                         DO_ASSERT(get_jenv_res == JNI_OK);
11817                 }
11818                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11819                 if (get_jenv_res == JNI_EDETACHED) {
11820                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11821                 }
11822                 FREE(j_calls);
11823         }
11824 }
11825 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
11826         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
11827         JNIEnv *env;
11828         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11829         if (get_jenv_res == JNI_EDETACHED) {
11830                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11831         } else {
11832                 DO_ASSERT(get_jenv_res == JNI_OK);
11833         }
11834         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
11835         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
11836         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11837         CHECK(obj != NULL);
11838         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
11839         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11840                 (*env)->ExceptionDescribe(env);
11841                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageProvider from rust threw an exception.");
11842         }
11843         LDKOnionMessage ret_conv;
11844         ret_conv.inner = untag_ptr(ret);
11845         ret_conv.is_owned = ptr_is_owned(ret);
11846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11847         if (get_jenv_res == JNI_EDETACHED) {
11848                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11849         }
11850         return ret_conv;
11851 }
11852 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
11853         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
11854         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11855 }
11856 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JNIEnv *env, jclass clz, jobject o) {
11857         jclass c = (*env)->GetObjectClass(env, o);
11858         CHECK(c != NULL);
11859         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
11860         atomic_init(&calls->refcnt, 1);
11861         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11862         calls->o = (*env)->NewWeakGlobalRef(env, o);
11863         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
11864         CHECK(calls->next_onion_message_for_peer_meth != NULL);
11865
11866         LDKOnionMessageProvider ret = {
11867                 .this_arg = (void*) calls,
11868                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
11869                 .free = LDKOnionMessageProvider_JCalls_free,
11870         };
11871         return ret;
11872 }
11873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new(JNIEnv *env, jclass clz, jobject o) {
11874         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
11875         *res_ptr = LDKOnionMessageProvider_init(env, clz, o);
11876         return tag_ptr(res_ptr, true);
11877 }
11878 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) {
11879         void* this_arg_ptr = untag_ptr(this_arg);
11880         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11881         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
11882         LDKPublicKey peer_node_id_ref;
11883         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
11884         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
11885         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
11886         int64_t ret_ref = 0;
11887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11889         return ret_ref;
11890 }
11891
11892 typedef struct LDKEventHandler_JCalls {
11893         atomic_size_t refcnt;
11894         JavaVM *vm;
11895         jweak o;
11896         jmethodID handle_event_meth;
11897 } LDKEventHandler_JCalls;
11898 static void LDKEventHandler_JCalls_free(void* this_arg) {
11899         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
11900         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11901                 JNIEnv *env;
11902                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11903                 if (get_jenv_res == JNI_EDETACHED) {
11904                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11905                 } else {
11906                         DO_ASSERT(get_jenv_res == JNI_OK);
11907                 }
11908                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11909                 if (get_jenv_res == JNI_EDETACHED) {
11910                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11911                 }
11912                 FREE(j_calls);
11913         }
11914 }
11915 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
11916         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
11917         JNIEnv *env;
11918         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11919         if (get_jenv_res == JNI_EDETACHED) {
11920                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11921         } else {
11922                 DO_ASSERT(get_jenv_res == JNI_OK);
11923         }
11924         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11925         *event_copy = event;
11926         int64_t event_ref = tag_ptr(event_copy, true);
11927         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11928         CHECK(obj != NULL);
11929         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
11930         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11931                 (*env)->ExceptionDescribe(env);
11932                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
11933         }
11934         if (get_jenv_res == JNI_EDETACHED) {
11935                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11936         }
11937 }
11938 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
11939         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
11940         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11941 }
11942 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
11943         jclass c = (*env)->GetObjectClass(env, o);
11944         CHECK(c != NULL);
11945         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
11946         atomic_init(&calls->refcnt, 1);
11947         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11948         calls->o = (*env)->NewWeakGlobalRef(env, o);
11949         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
11950         CHECK(calls->handle_event_meth != NULL);
11951
11952         LDKEventHandler ret = {
11953                 .this_arg = (void*) calls,
11954                 .handle_event = handle_event_LDKEventHandler_jcall,
11955                 .free = LDKEventHandler_JCalls_free,
11956         };
11957         return ret;
11958 }
11959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
11960         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
11961         *res_ptr = LDKEventHandler_init(env, clz, o);
11962         return tag_ptr(res_ptr, true);
11963 }
11964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
11965         void* this_arg_ptr = untag_ptr(this_arg);
11966         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11967         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
11968         void* event_ptr = untag_ptr(event);
11969         CHECK_ACCESS(event_ptr);
11970         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
11971         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
11972         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
11973 }
11974
11975 typedef struct LDKEventsProvider_JCalls {
11976         atomic_size_t refcnt;
11977         JavaVM *vm;
11978         jweak o;
11979         jmethodID process_pending_events_meth;
11980 } LDKEventsProvider_JCalls;
11981 static void LDKEventsProvider_JCalls_free(void* this_arg) {
11982         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
11983         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11984                 JNIEnv *env;
11985                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11986                 if (get_jenv_res == JNI_EDETACHED) {
11987                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11988                 } else {
11989                         DO_ASSERT(get_jenv_res == JNI_OK);
11990                 }
11991                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11992                 if (get_jenv_res == JNI_EDETACHED) {
11993                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11994                 }
11995                 FREE(j_calls);
11996         }
11997 }
11998 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
11999         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
12000         JNIEnv *env;
12001         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12002         if (get_jenv_res == JNI_EDETACHED) {
12003                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12004         } else {
12005                 DO_ASSERT(get_jenv_res == JNI_OK);
12006         }
12007         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
12008         *handler_ret = handler;
12009         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12010         CHECK(obj != NULL);
12011         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
12012         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12013                 (*env)->ExceptionDescribe(env);
12014                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
12015         }
12016         if (get_jenv_res == JNI_EDETACHED) {
12017                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12018         }
12019 }
12020 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
12021         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
12022         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12023 }
12024 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
12025         jclass c = (*env)->GetObjectClass(env, o);
12026         CHECK(c != NULL);
12027         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
12028         atomic_init(&calls->refcnt, 1);
12029         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12030         calls->o = (*env)->NewWeakGlobalRef(env, o);
12031         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
12032         CHECK(calls->process_pending_events_meth != NULL);
12033
12034         LDKEventsProvider ret = {
12035                 .this_arg = (void*) calls,
12036                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
12037                 .free = LDKEventsProvider_JCalls_free,
12038         };
12039         return ret;
12040 }
12041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
12042         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
12043         *res_ptr = LDKEventsProvider_init(env, clz, o);
12044         return tag_ptr(res_ptr, true);
12045 }
12046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
12047         void* this_arg_ptr = untag_ptr(this_arg);
12048         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12049         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
12050         void* handler_ptr = untag_ptr(handler);
12051         CHECK_ACCESS(handler_ptr);
12052         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
12053         if (handler_conv.free == LDKEventHandler_JCalls_free) {
12054                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12055                 LDKEventHandler_JCalls_cloned(&handler_conv);
12056         }
12057         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
12058 }
12059
12060 typedef struct LDKPersister_JCalls {
12061         atomic_size_t refcnt;
12062         JavaVM *vm;
12063         jweak o;
12064         jmethodID persist_manager_meth;
12065         jmethodID persist_graph_meth;
12066         jmethodID persist_scorer_meth;
12067 } LDKPersister_JCalls;
12068 static void LDKPersister_JCalls_free(void* this_arg) {
12069         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12070         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12071                 JNIEnv *env;
12072                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12073                 if (get_jenv_res == JNI_EDETACHED) {
12074                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12075                 } else {
12076                         DO_ASSERT(get_jenv_res == JNI_OK);
12077                 }
12078                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12079                 if (get_jenv_res == JNI_EDETACHED) {
12080                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12081                 }
12082                 FREE(j_calls);
12083         }
12084 }
12085 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
12086         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12087         JNIEnv *env;
12088         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12089         if (get_jenv_res == JNI_EDETACHED) {
12090                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12091         } else {
12092                 DO_ASSERT(get_jenv_res == JNI_OK);
12093         }
12094         LDKChannelManager channel_manager_var = *channel_manager;
12095         int64_t channel_manager_ref = 0;
12096         // WARNING: we may need a move here but no clone is available for LDKChannelManager
12097         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
12098         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
12099         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12100         CHECK(obj != NULL);
12101         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
12102         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12103                 (*env)->ExceptionDescribe(env);
12104                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
12105         }
12106         void* ret_ptr = untag_ptr(ret);
12107         CHECK_ACCESS(ret_ptr);
12108         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
12109         FREE(untag_ptr(ret));
12110         if (get_jenv_res == JNI_EDETACHED) {
12111                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12112         }
12113         return ret_conv;
12114 }
12115 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
12116         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12117         JNIEnv *env;
12118         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12119         if (get_jenv_res == JNI_EDETACHED) {
12120                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12121         } else {
12122                 DO_ASSERT(get_jenv_res == JNI_OK);
12123         }
12124         LDKNetworkGraph network_graph_var = *network_graph;
12125         int64_t network_graph_ref = 0;
12126         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
12127         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
12128         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
12129         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12130         CHECK(obj != NULL);
12131         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
12132         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12133                 (*env)->ExceptionDescribe(env);
12134                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
12135         }
12136         void* ret_ptr = untag_ptr(ret);
12137         CHECK_ACCESS(ret_ptr);
12138         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
12139         FREE(untag_ptr(ret));
12140         if (get_jenv_res == JNI_EDETACHED) {
12141                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12142         }
12143         return ret_conv;
12144 }
12145 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
12146         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
12147         JNIEnv *env;
12148         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12149         if (get_jenv_res == JNI_EDETACHED) {
12150                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12151         } else {
12152                 DO_ASSERT(get_jenv_res == JNI_OK);
12153         }
12154         // WARNING: This object doesn't live past this scope, needs clone!
12155         int64_t ret_scorer = tag_ptr(scorer, false);
12156         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12157         CHECK(obj != NULL);
12158         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
12159         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12160                 (*env)->ExceptionDescribe(env);
12161                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
12162         }
12163         void* ret_ptr = untag_ptr(ret);
12164         CHECK_ACCESS(ret_ptr);
12165         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
12166         FREE(untag_ptr(ret));
12167         if (get_jenv_res == JNI_EDETACHED) {
12168                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12169         }
12170         return ret_conv;
12171 }
12172 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
12173         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
12174         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12175 }
12176 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
12177         jclass c = (*env)->GetObjectClass(env, o);
12178         CHECK(c != NULL);
12179         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
12180         atomic_init(&calls->refcnt, 1);
12181         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12182         calls->o = (*env)->NewWeakGlobalRef(env, o);
12183         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
12184         CHECK(calls->persist_manager_meth != NULL);
12185         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
12186         CHECK(calls->persist_graph_meth != NULL);
12187         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
12188         CHECK(calls->persist_scorer_meth != NULL);
12189
12190         LDKPersister ret = {
12191                 .this_arg = (void*) calls,
12192                 .persist_manager = persist_manager_LDKPersister_jcall,
12193                 .persist_graph = persist_graph_LDKPersister_jcall,
12194                 .persist_scorer = persist_scorer_LDKPersister_jcall,
12195                 .free = LDKPersister_JCalls_free,
12196         };
12197         return ret;
12198 }
12199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
12200         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
12201         *res_ptr = LDKPersister_init(env, clz, o);
12202         return tag_ptr(res_ptr, true);
12203 }
12204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
12205         void* this_arg_ptr = untag_ptr(this_arg);
12206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12207         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12208         LDKChannelManager channel_manager_conv;
12209         channel_manager_conv.inner = untag_ptr(channel_manager);
12210         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
12211         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
12212         channel_manager_conv.is_owned = false;
12213         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12214         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
12215         return tag_ptr(ret_conv, true);
12216 }
12217
12218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
12219         void* this_arg_ptr = untag_ptr(this_arg);
12220         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12221         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12222         LDKNetworkGraph network_graph_conv;
12223         network_graph_conv.inner = untag_ptr(network_graph);
12224         network_graph_conv.is_owned = ptr_is_owned(network_graph);
12225         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
12226         network_graph_conv.is_owned = false;
12227         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12228         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
12229         return tag_ptr(ret_conv, true);
12230 }
12231
12232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
12233         void* this_arg_ptr = untag_ptr(this_arg);
12234         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12235         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
12236         void* scorer_ptr = untag_ptr(scorer);
12237         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
12238         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
12239         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12240         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
12241         return tag_ptr(ret_conv, true);
12242 }
12243
12244 typedef struct LDKFutureCallback_JCalls {
12245         atomic_size_t refcnt;
12246         JavaVM *vm;
12247         jweak o;
12248         jmethodID call_meth;
12249 } LDKFutureCallback_JCalls;
12250 static void LDKFutureCallback_JCalls_free(void* this_arg) {
12251         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
12252         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12253                 JNIEnv *env;
12254                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12255                 if (get_jenv_res == JNI_EDETACHED) {
12256                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12257                 } else {
12258                         DO_ASSERT(get_jenv_res == JNI_OK);
12259                 }
12260                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12261                 if (get_jenv_res == JNI_EDETACHED) {
12262                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12263                 }
12264                 FREE(j_calls);
12265         }
12266 }
12267 void call_LDKFutureCallback_jcall(const void* this_arg) {
12268         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
12269         JNIEnv *env;
12270         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12271         if (get_jenv_res == JNI_EDETACHED) {
12272                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12273         } else {
12274                 DO_ASSERT(get_jenv_res == JNI_OK);
12275         }
12276         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12277         CHECK(obj != NULL);
12278         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
12279         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12280                 (*env)->ExceptionDescribe(env);
12281                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
12282         }
12283         if (get_jenv_res == JNI_EDETACHED) {
12284                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12285         }
12286 }
12287 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
12288         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
12289         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12290 }
12291 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
12292         jclass c = (*env)->GetObjectClass(env, o);
12293         CHECK(c != NULL);
12294         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
12295         atomic_init(&calls->refcnt, 1);
12296         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12297         calls->o = (*env)->NewWeakGlobalRef(env, o);
12298         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
12299         CHECK(calls->call_meth != NULL);
12300
12301         LDKFutureCallback ret = {
12302                 .this_arg = (void*) calls,
12303                 .call = call_LDKFutureCallback_jcall,
12304                 .free = LDKFutureCallback_JCalls_free,
12305         };
12306         return ret;
12307 }
12308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
12309         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
12310         *res_ptr = LDKFutureCallback_init(env, clz, o);
12311         return tag_ptr(res_ptr, true);
12312 }
12313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
12314         void* this_arg_ptr = untag_ptr(this_arg);
12315         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12316         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
12317         (this_arg_conv->call)(this_arg_conv->this_arg);
12318 }
12319
12320 typedef struct LDKListen_JCalls {
12321         atomic_size_t refcnt;
12322         JavaVM *vm;
12323         jweak o;
12324         jmethodID filtered_block_connected_meth;
12325         jmethodID block_connected_meth;
12326         jmethodID block_disconnected_meth;
12327 } LDKListen_JCalls;
12328 static void LDKListen_JCalls_free(void* this_arg) {
12329         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12330         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12331                 JNIEnv *env;
12332                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12333                 if (get_jenv_res == JNI_EDETACHED) {
12334                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12335                 } else {
12336                         DO_ASSERT(get_jenv_res == JNI_OK);
12337                 }
12338                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12339                 if (get_jenv_res == JNI_EDETACHED) {
12340                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12341                 }
12342                 FREE(j_calls);
12343         }
12344 }
12345 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12346         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12347         JNIEnv *env;
12348         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12349         if (get_jenv_res == JNI_EDETACHED) {
12350                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12351         } else {
12352                 DO_ASSERT(get_jenv_res == JNI_OK);
12353         }
12354         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
12355         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
12356         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12357         int64_tArray txdata_arr = NULL;
12358         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
12359         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
12360         for (size_t c = 0; c < txdata_var.datalen; c++) {
12361                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12362                 *txdata_conv_28_conv = txdata_var.data[c];
12363                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12364         }
12365         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
12366         FREE(txdata_var.data);
12367         int32_t height_conv = height;
12368         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12369         CHECK(obj != NULL);
12370         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
12371         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12372                 (*env)->ExceptionDescribe(env);
12373                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
12374         }
12375         if (get_jenv_res == JNI_EDETACHED) {
12376                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12377         }
12378 }
12379 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
12380         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12381         JNIEnv *env;
12382         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12383         if (get_jenv_res == JNI_EDETACHED) {
12384                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12385         } else {
12386                 DO_ASSERT(get_jenv_res == JNI_OK);
12387         }
12388         LDKu8slice block_var = block;
12389         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
12390         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
12391         int32_t height_conv = height;
12392         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12393         CHECK(obj != NULL);
12394         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
12395         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12396                 (*env)->ExceptionDescribe(env);
12397                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
12398         }
12399         if (get_jenv_res == JNI_EDETACHED) {
12400                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12401         }
12402 }
12403 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12404         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
12405         JNIEnv *env;
12406         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12407         if (get_jenv_res == JNI_EDETACHED) {
12408                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12409         } else {
12410                 DO_ASSERT(get_jenv_res == JNI_OK);
12411         }
12412         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
12413         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
12414         int32_t height_conv = height;
12415         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12416         CHECK(obj != NULL);
12417         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
12418         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12419                 (*env)->ExceptionDescribe(env);
12420                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
12421         }
12422         if (get_jenv_res == JNI_EDETACHED) {
12423                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12424         }
12425 }
12426 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
12427         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
12428         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12429 }
12430 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
12431         jclass c = (*env)->GetObjectClass(env, o);
12432         CHECK(c != NULL);
12433         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
12434         atomic_init(&calls->refcnt, 1);
12435         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12436         calls->o = (*env)->NewWeakGlobalRef(env, o);
12437         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
12438         CHECK(calls->filtered_block_connected_meth != NULL);
12439         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
12440         CHECK(calls->block_connected_meth != NULL);
12441         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
12442         CHECK(calls->block_disconnected_meth != NULL);
12443
12444         LDKListen ret = {
12445                 .this_arg = (void*) calls,
12446                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
12447                 .block_connected = block_connected_LDKListen_jcall,
12448                 .block_disconnected = block_disconnected_LDKListen_jcall,
12449                 .free = LDKListen_JCalls_free,
12450         };
12451         return ret;
12452 }
12453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
12454         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
12455         *res_ptr = LDKListen_init(env, clz, o);
12456         return tag_ptr(res_ptr, true);
12457 }
12458 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) {
12459         void* this_arg_ptr = untag_ptr(this_arg);
12460         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12461         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12462         uint8_t header_arr[80];
12463         CHECK((*env)->GetArrayLength(env, header) == 80);
12464         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12465         uint8_t (*header_ref)[80] = &header_arr;
12466         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12467         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
12468         if (txdata_constr.datalen > 0)
12469                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12470         else
12471                 txdata_constr.data = NULL;
12472         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
12473         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12474                 int64_t txdata_conv_28 = txdata_vals[c];
12475                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12476                 CHECK_ACCESS(txdata_conv_28_ptr);
12477                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12478                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12479                 txdata_constr.data[c] = txdata_conv_28_conv;
12480         }
12481         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
12482         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12483 }
12484
12485 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) {
12486         void* this_arg_ptr = untag_ptr(this_arg);
12487         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12488         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12489         LDKu8slice block_ref;
12490         block_ref.datalen = (*env)->GetArrayLength(env, block);
12491         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
12492         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
12493         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
12494 }
12495
12496 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) {
12497         void* this_arg_ptr = untag_ptr(this_arg);
12498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12499         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
12500         uint8_t header_arr[80];
12501         CHECK((*env)->GetArrayLength(env, header) == 80);
12502         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12503         uint8_t (*header_ref)[80] = &header_arr;
12504         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
12505 }
12506
12507 typedef struct LDKConfirm_JCalls {
12508         atomic_size_t refcnt;
12509         JavaVM *vm;
12510         jweak o;
12511         jmethodID transactions_confirmed_meth;
12512         jmethodID transaction_unconfirmed_meth;
12513         jmethodID best_block_updated_meth;
12514         jmethodID get_relevant_txids_meth;
12515 } LDKConfirm_JCalls;
12516 static void LDKConfirm_JCalls_free(void* this_arg) {
12517         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12518         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12519                 JNIEnv *env;
12520                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12521                 if (get_jenv_res == JNI_EDETACHED) {
12522                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12523                 } else {
12524                         DO_ASSERT(get_jenv_res == JNI_OK);
12525                 }
12526                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12527                 if (get_jenv_res == JNI_EDETACHED) {
12528                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12529                 }
12530                 FREE(j_calls);
12531         }
12532 }
12533 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
12534         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12535         JNIEnv *env;
12536         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12537         if (get_jenv_res == JNI_EDETACHED) {
12538                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12539         } else {
12540                 DO_ASSERT(get_jenv_res == JNI_OK);
12541         }
12542         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
12543         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
12544         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
12545         int64_tArray txdata_arr = NULL;
12546         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
12547         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
12548         for (size_t c = 0; c < txdata_var.datalen; c++) {
12549                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12550                 *txdata_conv_28_conv = txdata_var.data[c];
12551                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
12552         }
12553         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
12554         FREE(txdata_var.data);
12555         int32_t height_conv = height;
12556         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12557         CHECK(obj != NULL);
12558         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
12559         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12560                 (*env)->ExceptionDescribe(env);
12561                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
12562         }
12563         if (get_jenv_res == JNI_EDETACHED) {
12564                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12565         }
12566 }
12567 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
12568         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12569         JNIEnv *env;
12570         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12571         if (get_jenv_res == JNI_EDETACHED) {
12572                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12573         } else {
12574                 DO_ASSERT(get_jenv_res == JNI_OK);
12575         }
12576         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
12577         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
12578         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12579         CHECK(obj != NULL);
12580         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
12581         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12582                 (*env)->ExceptionDescribe(env);
12583                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
12584         }
12585         if (get_jenv_res == JNI_EDETACHED) {
12586                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12587         }
12588 }
12589 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
12590         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12591         JNIEnv *env;
12592         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12593         if (get_jenv_res == JNI_EDETACHED) {
12594                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12595         } else {
12596                 DO_ASSERT(get_jenv_res == JNI_OK);
12597         }
12598         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
12599         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
12600         int32_t height_conv = height;
12601         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12602         CHECK(obj != NULL);
12603         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
12604         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12605                 (*env)->ExceptionDescribe(env);
12606                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
12607         }
12608         if (get_jenv_res == JNI_EDETACHED) {
12609                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12610         }
12611 }
12612 LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
12613         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
12614         JNIEnv *env;
12615         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12616         if (get_jenv_res == JNI_EDETACHED) {
12617                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12618         } else {
12619                 DO_ASSERT(get_jenv_res == JNI_OK);
12620         }
12621         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12622         CHECK(obj != NULL);
12623         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
12624         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12625                 (*env)->ExceptionDescribe(env);
12626                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
12627         }
12628         LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr;
12629         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12630         if (ret_constr.datalen > 0)
12631                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
12632         else
12633                 ret_constr.data = NULL;
12634         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12635         for (size_t z = 0; z < ret_constr.datalen; z++) {
12636                 int64_t ret_conv_25 = ret_vals[z];
12637                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
12638                 CHECK_ACCESS(ret_conv_25_ptr);
12639                 LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr);
12640                 FREE(untag_ptr(ret_conv_25));
12641                 ret_constr.data[z] = ret_conv_25_conv;
12642         }
12643         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12644         if (get_jenv_res == JNI_EDETACHED) {
12645                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12646         }
12647         return ret_constr;
12648 }
12649 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
12650         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
12651         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12652 }
12653 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
12654         jclass c = (*env)->GetObjectClass(env, o);
12655         CHECK(c != NULL);
12656         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
12657         atomic_init(&calls->refcnt, 1);
12658         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12659         calls->o = (*env)->NewWeakGlobalRef(env, o);
12660         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
12661         CHECK(calls->transactions_confirmed_meth != NULL);
12662         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
12663         CHECK(calls->transaction_unconfirmed_meth != NULL);
12664         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
12665         CHECK(calls->best_block_updated_meth != NULL);
12666         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
12667         CHECK(calls->get_relevant_txids_meth != NULL);
12668
12669         LDKConfirm ret = {
12670                 .this_arg = (void*) calls,
12671                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
12672                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
12673                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
12674                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
12675                 .free = LDKConfirm_JCalls_free,
12676         };
12677         return ret;
12678 }
12679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
12680         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
12681         *res_ptr = LDKConfirm_init(env, clz, o);
12682         return tag_ptr(res_ptr, true);
12683 }
12684 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) {
12685         void* this_arg_ptr = untag_ptr(this_arg);
12686         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12687         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12688         uint8_t header_arr[80];
12689         CHECK((*env)->GetArrayLength(env, header) == 80);
12690         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12691         uint8_t (*header_ref)[80] = &header_arr;
12692         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
12693         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
12694         if (txdata_constr.datalen > 0)
12695                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12696         else
12697                 txdata_constr.data = NULL;
12698         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
12699         for (size_t c = 0; c < txdata_constr.datalen; c++) {
12700                 int64_t txdata_conv_28 = txdata_vals[c];
12701                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
12702                 CHECK_ACCESS(txdata_conv_28_ptr);
12703                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
12704                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
12705                 txdata_constr.data[c] = txdata_conv_28_conv;
12706         }
12707         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
12708         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
12709 }
12710
12711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
12712         void* this_arg_ptr = untag_ptr(this_arg);
12713         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12714         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12715         uint8_t txid_arr[32];
12716         CHECK((*env)->GetArrayLength(env, txid) == 32);
12717         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
12718         uint8_t (*txid_ref)[32] = &txid_arr;
12719         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
12720 }
12721
12722 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) {
12723         void* this_arg_ptr = untag_ptr(this_arg);
12724         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12725         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12726         uint8_t header_arr[80];
12727         CHECK((*env)->GetArrayLength(env, header) == 80);
12728         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
12729         uint8_t (*header_ref)[80] = &header_arr;
12730         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
12731 }
12732
12733 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
12734         void* this_arg_ptr = untag_ptr(this_arg);
12735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12736         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
12737         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
12738         int64_tArray ret_arr = NULL;
12739         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12740         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12741         for (size_t z = 0; z < ret_var.datalen; z++) {
12742                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
12743                 *ret_conv_25_conv = ret_var.data[z];
12744                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
12745         }
12746         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12747         FREE(ret_var.data);
12748         return ret_arr;
12749 }
12750
12751 typedef struct LDKPersist_JCalls {
12752         atomic_size_t refcnt;
12753         JavaVM *vm;
12754         jweak o;
12755         jmethodID persist_new_channel_meth;
12756         jmethodID update_persisted_channel_meth;
12757 } LDKPersist_JCalls;
12758 static void LDKPersist_JCalls_free(void* this_arg) {
12759         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12760         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12761                 JNIEnv *env;
12762                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12763                 if (get_jenv_res == JNI_EDETACHED) {
12764                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12765                 } else {
12766                         DO_ASSERT(get_jenv_res == JNI_OK);
12767                 }
12768                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12769                 if (get_jenv_res == JNI_EDETACHED) {
12770                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12771                 }
12772                 FREE(j_calls);
12773         }
12774 }
12775 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
12776         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12777         JNIEnv *env;
12778         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12779         if (get_jenv_res == JNI_EDETACHED) {
12780                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12781         } else {
12782                 DO_ASSERT(get_jenv_res == JNI_OK);
12783         }
12784         LDKOutPoint channel_id_var = channel_id;
12785         int64_t channel_id_ref = 0;
12786         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12787         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
12788         LDKChannelMonitor data_var = *data;
12789         int64_t data_ref = 0;
12790         data_var = ChannelMonitor_clone(&data_var);
12791         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
12792         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
12793         LDKMonitorUpdateId update_id_var = update_id;
12794         int64_t update_id_ref = 0;
12795         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
12796         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
12797         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12798         CHECK(obj != NULL);
12799         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
12800         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12801                 (*env)->ExceptionDescribe(env);
12802                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
12803         }
12804         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
12805         if (get_jenv_res == JNI_EDETACHED) {
12806                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12807         }
12808         return ret_conv;
12809 }
12810 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
12811         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
12812         JNIEnv *env;
12813         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12814         if (get_jenv_res == JNI_EDETACHED) {
12815                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12816         } else {
12817                 DO_ASSERT(get_jenv_res == JNI_OK);
12818         }
12819         LDKOutPoint channel_id_var = channel_id;
12820         int64_t channel_id_ref = 0;
12821         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12822         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
12823         LDKChannelMonitorUpdate update_var = update;
12824         int64_t update_ref = 0;
12825         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
12826         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
12827         LDKChannelMonitor data_var = *data;
12828         int64_t data_ref = 0;
12829         data_var = ChannelMonitor_clone(&data_var);
12830         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
12831         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
12832         LDKMonitorUpdateId update_id_var = update_id;
12833         int64_t update_id_ref = 0;
12834         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
12835         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
12836         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12837         CHECK(obj != NULL);
12838         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
12839         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12840                 (*env)->ExceptionDescribe(env);
12841                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
12842         }
12843         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
12844         if (get_jenv_res == JNI_EDETACHED) {
12845                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12846         }
12847         return ret_conv;
12848 }
12849 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
12850         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
12851         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12852 }
12853 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
12854         jclass c = (*env)->GetObjectClass(env, o);
12855         CHECK(c != NULL);
12856         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
12857         atomic_init(&calls->refcnt, 1);
12858         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12859         calls->o = (*env)->NewWeakGlobalRef(env, o);
12860         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
12861         CHECK(calls->persist_new_channel_meth != NULL);
12862         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
12863         CHECK(calls->update_persisted_channel_meth != NULL);
12864
12865         LDKPersist ret = {
12866                 .this_arg = (void*) calls,
12867                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
12868                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
12869                 .free = LDKPersist_JCalls_free,
12870         };
12871         return ret;
12872 }
12873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
12874         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
12875         *res_ptr = LDKPersist_init(env, clz, o);
12876         return tag_ptr(res_ptr, true);
12877 }
12878 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) {
12879         void* this_arg_ptr = untag_ptr(this_arg);
12880         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12881         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
12882         LDKOutPoint channel_id_conv;
12883         channel_id_conv.inner = untag_ptr(channel_id);
12884         channel_id_conv.is_owned = ptr_is_owned(channel_id);
12885         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
12886         channel_id_conv = OutPoint_clone(&channel_id_conv);
12887         LDKChannelMonitor data_conv;
12888         data_conv.inner = untag_ptr(data);
12889         data_conv.is_owned = ptr_is_owned(data);
12890         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
12891         data_conv.is_owned = false;
12892         LDKMonitorUpdateId update_id_conv;
12893         update_id_conv.inner = untag_ptr(update_id);
12894         update_id_conv.is_owned = ptr_is_owned(update_id);
12895         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
12896         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
12897         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));
12898         return ret_conv;
12899 }
12900
12901 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) {
12902         void* this_arg_ptr = untag_ptr(this_arg);
12903         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12904         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
12905         LDKOutPoint channel_id_conv;
12906         channel_id_conv.inner = untag_ptr(channel_id);
12907         channel_id_conv.is_owned = ptr_is_owned(channel_id);
12908         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
12909         channel_id_conv = OutPoint_clone(&channel_id_conv);
12910         LDKChannelMonitorUpdate update_conv;
12911         update_conv.inner = untag_ptr(update);
12912         update_conv.is_owned = ptr_is_owned(update);
12913         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
12914         update_conv = ChannelMonitorUpdate_clone(&update_conv);
12915         LDKChannelMonitor data_conv;
12916         data_conv.inner = untag_ptr(data);
12917         data_conv.is_owned = ptr_is_owned(data);
12918         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
12919         data_conv.is_owned = false;
12920         LDKMonitorUpdateId update_id_conv;
12921         update_id_conv.inner = untag_ptr(update_id);
12922         update_id_conv.is_owned = ptr_is_owned(update_id);
12923         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
12924         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
12925         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));
12926         return ret_conv;
12927 }
12928
12929 static jclass LDKRetry_Attempts_class = NULL;
12930 static jmethodID LDKRetry_Attempts_meth = NULL;
12931 static jclass LDKRetry_Timeout_class = NULL;
12932 static jmethodID LDKRetry_Timeout_meth = NULL;
12933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
12934         LDKRetry_Attempts_class =
12935                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
12936         CHECK(LDKRetry_Attempts_class != NULL);
12937         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
12938         CHECK(LDKRetry_Attempts_meth != NULL);
12939         LDKRetry_Timeout_class =
12940                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
12941         CHECK(LDKRetry_Timeout_class != NULL);
12942         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
12943         CHECK(LDKRetry_Timeout_meth != NULL);
12944 }
12945 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12946         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
12947         switch(obj->tag) {
12948                 case LDKRetry_Attempts: {
12949                         int64_t attempts_conv = obj->attempts;
12950                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
12951                 }
12952                 case LDKRetry_Timeout: {
12953                         int64_t timeout_conv = obj->timeout;
12954                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
12955                 }
12956                 default: abort();
12957         }
12958 }
12959 typedef struct LDKChannelMessageHandler_JCalls {
12960         atomic_size_t refcnt;
12961         JavaVM *vm;
12962         jweak o;
12963         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12964         jmethodID handle_open_channel_meth;
12965         jmethodID handle_accept_channel_meth;
12966         jmethodID handle_funding_created_meth;
12967         jmethodID handle_funding_signed_meth;
12968         jmethodID handle_channel_ready_meth;
12969         jmethodID handle_shutdown_meth;
12970         jmethodID handle_closing_signed_meth;
12971         jmethodID handle_update_add_htlc_meth;
12972         jmethodID handle_update_fulfill_htlc_meth;
12973         jmethodID handle_update_fail_htlc_meth;
12974         jmethodID handle_update_fail_malformed_htlc_meth;
12975         jmethodID handle_commitment_signed_meth;
12976         jmethodID handle_revoke_and_ack_meth;
12977         jmethodID handle_update_fee_meth;
12978         jmethodID handle_announcement_signatures_meth;
12979         jmethodID peer_disconnected_meth;
12980         jmethodID peer_connected_meth;
12981         jmethodID handle_channel_reestablish_meth;
12982         jmethodID handle_channel_update_meth;
12983         jmethodID handle_error_meth;
12984         jmethodID provided_node_features_meth;
12985         jmethodID provided_init_features_meth;
12986 } LDKChannelMessageHandler_JCalls;
12987 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
12988         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12989         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12990                 JNIEnv *env;
12991                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12992                 if (get_jenv_res == JNI_EDETACHED) {
12993                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12994                 } else {
12995                         DO_ASSERT(get_jenv_res == JNI_OK);
12996                 }
12997                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12998                 if (get_jenv_res == JNI_EDETACHED) {
12999                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13000                 }
13001                 FREE(j_calls);
13002         }
13003 }
13004 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
13005         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13006         JNIEnv *env;
13007         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13008         if (get_jenv_res == JNI_EDETACHED) {
13009                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13010         } else {
13011                 DO_ASSERT(get_jenv_res == JNI_OK);
13012         }
13013         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13014         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13015         LDKOpenChannel msg_var = *msg;
13016         int64_t msg_ref = 0;
13017         msg_var = OpenChannel_clone(&msg_var);
13018         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13019         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13020         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13021         CHECK(obj != NULL);
13022         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
13023         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13024                 (*env)->ExceptionDescribe(env);
13025                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
13026         }
13027         if (get_jenv_res == JNI_EDETACHED) {
13028                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13029         }
13030 }
13031 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
13032         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13033         JNIEnv *env;
13034         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13035         if (get_jenv_res == JNI_EDETACHED) {
13036                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13037         } else {
13038                 DO_ASSERT(get_jenv_res == JNI_OK);
13039         }
13040         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13041         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13042         LDKAcceptChannel msg_var = *msg;
13043         int64_t msg_ref = 0;
13044         msg_var = AcceptChannel_clone(&msg_var);
13045         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13046         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13047         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13048         CHECK(obj != NULL);
13049         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
13050         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13051                 (*env)->ExceptionDescribe(env);
13052                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
13053         }
13054         if (get_jenv_res == JNI_EDETACHED) {
13055                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13056         }
13057 }
13058 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
13059         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13060         JNIEnv *env;
13061         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13062         if (get_jenv_res == JNI_EDETACHED) {
13063                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13064         } else {
13065                 DO_ASSERT(get_jenv_res == JNI_OK);
13066         }
13067         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13068         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13069         LDKFundingCreated msg_var = *msg;
13070         int64_t msg_ref = 0;
13071         msg_var = FundingCreated_clone(&msg_var);
13072         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13073         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13074         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13075         CHECK(obj != NULL);
13076         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
13077         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13078                 (*env)->ExceptionDescribe(env);
13079                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
13080         }
13081         if (get_jenv_res == JNI_EDETACHED) {
13082                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13083         }
13084 }
13085 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
13086         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13087         JNIEnv *env;
13088         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13089         if (get_jenv_res == JNI_EDETACHED) {
13090                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13091         } else {
13092                 DO_ASSERT(get_jenv_res == JNI_OK);
13093         }
13094         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13095         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13096         LDKFundingSigned msg_var = *msg;
13097         int64_t msg_ref = 0;
13098         msg_var = FundingSigned_clone(&msg_var);
13099         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13100         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13101         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13102         CHECK(obj != NULL);
13103         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
13104         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13105                 (*env)->ExceptionDescribe(env);
13106                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
13107         }
13108         if (get_jenv_res == JNI_EDETACHED) {
13109                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13110         }
13111 }
13112 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
13113         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13114         JNIEnv *env;
13115         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13116         if (get_jenv_res == JNI_EDETACHED) {
13117                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13118         } else {
13119                 DO_ASSERT(get_jenv_res == JNI_OK);
13120         }
13121         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13122         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13123         LDKChannelReady msg_var = *msg;
13124         int64_t msg_ref = 0;
13125         msg_var = ChannelReady_clone(&msg_var);
13126         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13127         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13128         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13129         CHECK(obj != NULL);
13130         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
13131         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13132                 (*env)->ExceptionDescribe(env);
13133                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
13134         }
13135         if (get_jenv_res == JNI_EDETACHED) {
13136                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13137         }
13138 }
13139 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
13140         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13141         JNIEnv *env;
13142         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13143         if (get_jenv_res == JNI_EDETACHED) {
13144                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13145         } else {
13146                 DO_ASSERT(get_jenv_res == JNI_OK);
13147         }
13148         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13149         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13150         LDKShutdown msg_var = *msg;
13151         int64_t msg_ref = 0;
13152         msg_var = Shutdown_clone(&msg_var);
13153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13154         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13155         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13156         CHECK(obj != NULL);
13157         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
13158         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13159                 (*env)->ExceptionDescribe(env);
13160                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
13161         }
13162         if (get_jenv_res == JNI_EDETACHED) {
13163                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13164         }
13165 }
13166 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
13167         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13168         JNIEnv *env;
13169         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13170         if (get_jenv_res == JNI_EDETACHED) {
13171                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13172         } else {
13173                 DO_ASSERT(get_jenv_res == JNI_OK);
13174         }
13175         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13176         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13177         LDKClosingSigned msg_var = *msg;
13178         int64_t msg_ref = 0;
13179         msg_var = ClosingSigned_clone(&msg_var);
13180         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13181         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13182         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13183         CHECK(obj != NULL);
13184         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
13185         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13186                 (*env)->ExceptionDescribe(env);
13187                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
13188         }
13189         if (get_jenv_res == JNI_EDETACHED) {
13190                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13191         }
13192 }
13193 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
13194         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13195         JNIEnv *env;
13196         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13197         if (get_jenv_res == JNI_EDETACHED) {
13198                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13199         } else {
13200                 DO_ASSERT(get_jenv_res == JNI_OK);
13201         }
13202         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13203         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13204         LDKUpdateAddHTLC msg_var = *msg;
13205         int64_t msg_ref = 0;
13206         msg_var = UpdateAddHTLC_clone(&msg_var);
13207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13208         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13209         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13210         CHECK(obj != NULL);
13211         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
13212         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13213                 (*env)->ExceptionDescribe(env);
13214                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
13215         }
13216         if (get_jenv_res == JNI_EDETACHED) {
13217                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13218         }
13219 }
13220 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
13221         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13222         JNIEnv *env;
13223         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13224         if (get_jenv_res == JNI_EDETACHED) {
13225                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13226         } else {
13227                 DO_ASSERT(get_jenv_res == JNI_OK);
13228         }
13229         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13230         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13231         LDKUpdateFulfillHTLC msg_var = *msg;
13232         int64_t msg_ref = 0;
13233         msg_var = UpdateFulfillHTLC_clone(&msg_var);
13234         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13235         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13236         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13237         CHECK(obj != NULL);
13238         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
13239         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13240                 (*env)->ExceptionDescribe(env);
13241                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
13242         }
13243         if (get_jenv_res == JNI_EDETACHED) {
13244                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13245         }
13246 }
13247 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
13248         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13249         JNIEnv *env;
13250         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13251         if (get_jenv_res == JNI_EDETACHED) {
13252                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13253         } else {
13254                 DO_ASSERT(get_jenv_res == JNI_OK);
13255         }
13256         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13257         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13258         LDKUpdateFailHTLC msg_var = *msg;
13259         int64_t msg_ref = 0;
13260         msg_var = UpdateFailHTLC_clone(&msg_var);
13261         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13262         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13263         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13264         CHECK(obj != NULL);
13265         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
13266         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13267                 (*env)->ExceptionDescribe(env);
13268                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
13269         }
13270         if (get_jenv_res == JNI_EDETACHED) {
13271                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13272         }
13273 }
13274 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
13275         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13276         JNIEnv *env;
13277         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13278         if (get_jenv_res == JNI_EDETACHED) {
13279                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13280         } else {
13281                 DO_ASSERT(get_jenv_res == JNI_OK);
13282         }
13283         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13284         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13285         LDKUpdateFailMalformedHTLC msg_var = *msg;
13286         int64_t msg_ref = 0;
13287         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
13288         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13289         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13290         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13291         CHECK(obj != NULL);
13292         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
13293         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13294                 (*env)->ExceptionDescribe(env);
13295                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
13296         }
13297         if (get_jenv_res == JNI_EDETACHED) {
13298                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13299         }
13300 }
13301 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
13302         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13303         JNIEnv *env;
13304         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13305         if (get_jenv_res == JNI_EDETACHED) {
13306                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13307         } else {
13308                 DO_ASSERT(get_jenv_res == JNI_OK);
13309         }
13310         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13311         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13312         LDKCommitmentSigned msg_var = *msg;
13313         int64_t msg_ref = 0;
13314         msg_var = CommitmentSigned_clone(&msg_var);
13315         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13316         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13317         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13318         CHECK(obj != NULL);
13319         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
13320         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13321                 (*env)->ExceptionDescribe(env);
13322                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
13323         }
13324         if (get_jenv_res == JNI_EDETACHED) {
13325                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13326         }
13327 }
13328 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
13329         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13330         JNIEnv *env;
13331         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13332         if (get_jenv_res == JNI_EDETACHED) {
13333                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13334         } else {
13335                 DO_ASSERT(get_jenv_res == JNI_OK);
13336         }
13337         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13338         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13339         LDKRevokeAndACK msg_var = *msg;
13340         int64_t msg_ref = 0;
13341         msg_var = RevokeAndACK_clone(&msg_var);
13342         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13343         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13344         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13345         CHECK(obj != NULL);
13346         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
13347         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13348                 (*env)->ExceptionDescribe(env);
13349                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
13350         }
13351         if (get_jenv_res == JNI_EDETACHED) {
13352                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13353         }
13354 }
13355 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
13356         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13357         JNIEnv *env;
13358         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13359         if (get_jenv_res == JNI_EDETACHED) {
13360                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13361         } else {
13362                 DO_ASSERT(get_jenv_res == JNI_OK);
13363         }
13364         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13365         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13366         LDKUpdateFee msg_var = *msg;
13367         int64_t msg_ref = 0;
13368         msg_var = UpdateFee_clone(&msg_var);
13369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13370         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13371         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13372         CHECK(obj != NULL);
13373         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
13374         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13375                 (*env)->ExceptionDescribe(env);
13376                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
13377         }
13378         if (get_jenv_res == JNI_EDETACHED) {
13379                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13380         }
13381 }
13382 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
13383         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13384         JNIEnv *env;
13385         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13386         if (get_jenv_res == JNI_EDETACHED) {
13387                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13388         } else {
13389                 DO_ASSERT(get_jenv_res == JNI_OK);
13390         }
13391         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13392         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13393         LDKAnnouncementSignatures msg_var = *msg;
13394         int64_t msg_ref = 0;
13395         msg_var = AnnouncementSignatures_clone(&msg_var);
13396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13397         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13398         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13399         CHECK(obj != NULL);
13400         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
13401         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13402                 (*env)->ExceptionDescribe(env);
13403                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
13404         }
13405         if (get_jenv_res == JNI_EDETACHED) {
13406                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13407         }
13408 }
13409 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13410         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13411         JNIEnv *env;
13412         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13413         if (get_jenv_res == JNI_EDETACHED) {
13414                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13415         } else {
13416                 DO_ASSERT(get_jenv_res == JNI_OK);
13417         }
13418         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13419         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13420         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13421         CHECK(obj != NULL);
13422         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
13423         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13424                 (*env)->ExceptionDescribe(env);
13425                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
13426         }
13427         if (get_jenv_res == JNI_EDETACHED) {
13428                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13429         }
13430 }
13431 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
13432         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13433         JNIEnv *env;
13434         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13435         if (get_jenv_res == JNI_EDETACHED) {
13436                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13437         } else {
13438                 DO_ASSERT(get_jenv_res == JNI_OK);
13439         }
13440         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13441         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13442         LDKInit msg_var = *msg;
13443         int64_t msg_ref = 0;
13444         msg_var = Init_clone(&msg_var);
13445         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13446         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13447         jboolean inbound_conv = inbound;
13448         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13449         CHECK(obj != NULL);
13450         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
13451         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13452                 (*env)->ExceptionDescribe(env);
13453                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
13454         }
13455         void* ret_ptr = untag_ptr(ret);
13456         CHECK_ACCESS(ret_ptr);
13457         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13458         FREE(untag_ptr(ret));
13459         if (get_jenv_res == JNI_EDETACHED) {
13460                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13461         }
13462         return ret_conv;
13463 }
13464 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
13465         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13466         JNIEnv *env;
13467         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13468         if (get_jenv_res == JNI_EDETACHED) {
13469                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13470         } else {
13471                 DO_ASSERT(get_jenv_res == JNI_OK);
13472         }
13473         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13474         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13475         LDKChannelReestablish msg_var = *msg;
13476         int64_t msg_ref = 0;
13477         msg_var = ChannelReestablish_clone(&msg_var);
13478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13479         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13480         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13481         CHECK(obj != NULL);
13482         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
13483         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13484                 (*env)->ExceptionDescribe(env);
13485                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
13486         }
13487         if (get_jenv_res == JNI_EDETACHED) {
13488                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13489         }
13490 }
13491 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
13492         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13493         JNIEnv *env;
13494         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13495         if (get_jenv_res == JNI_EDETACHED) {
13496                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13497         } else {
13498                 DO_ASSERT(get_jenv_res == JNI_OK);
13499         }
13500         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13501         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13502         LDKChannelUpdate msg_var = *msg;
13503         int64_t msg_ref = 0;
13504         msg_var = ChannelUpdate_clone(&msg_var);
13505         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13506         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13507         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13508         CHECK(obj != NULL);
13509         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
13510         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13511                 (*env)->ExceptionDescribe(env);
13512                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
13513         }
13514         if (get_jenv_res == JNI_EDETACHED) {
13515                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13516         }
13517 }
13518 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
13519         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13520         JNIEnv *env;
13521         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13522         if (get_jenv_res == JNI_EDETACHED) {
13523                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13524         } else {
13525                 DO_ASSERT(get_jenv_res == JNI_OK);
13526         }
13527         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13528         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13529         LDKErrorMessage msg_var = *msg;
13530         int64_t msg_ref = 0;
13531         msg_var = ErrorMessage_clone(&msg_var);
13532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13533         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13534         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13535         CHECK(obj != NULL);
13536         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
13537         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13538                 (*env)->ExceptionDescribe(env);
13539                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
13540         }
13541         if (get_jenv_res == JNI_EDETACHED) {
13542                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13543         }
13544 }
13545 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
13546         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13547         JNIEnv *env;
13548         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13549         if (get_jenv_res == JNI_EDETACHED) {
13550                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13551         } else {
13552                 DO_ASSERT(get_jenv_res == JNI_OK);
13553         }
13554         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13555         CHECK(obj != NULL);
13556         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
13557         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13558                 (*env)->ExceptionDescribe(env);
13559                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
13560         }
13561         LDKNodeFeatures ret_conv;
13562         ret_conv.inner = untag_ptr(ret);
13563         ret_conv.is_owned = ptr_is_owned(ret);
13564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13565         if (get_jenv_res == JNI_EDETACHED) {
13566                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13567         }
13568         return ret_conv;
13569 }
13570 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13571         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13572         JNIEnv *env;
13573         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13574         if (get_jenv_res == JNI_EDETACHED) {
13575                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13576         } else {
13577                 DO_ASSERT(get_jenv_res == JNI_OK);
13578         }
13579         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13580         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13581         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13582         CHECK(obj != NULL);
13583         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
13584         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13585                 (*env)->ExceptionDescribe(env);
13586                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
13587         }
13588         LDKInitFeatures ret_conv;
13589         ret_conv.inner = untag_ptr(ret);
13590         ret_conv.is_owned = ptr_is_owned(ret);
13591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13592         if (get_jenv_res == JNI_EDETACHED) {
13593                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13594         }
13595         return ret_conv;
13596 }
13597 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
13598         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
13599         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13600         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13601 }
13602 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13603         jclass c = (*env)->GetObjectClass(env, o);
13604         CHECK(c != NULL);
13605         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
13606         atomic_init(&calls->refcnt, 1);
13607         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13608         calls->o = (*env)->NewWeakGlobalRef(env, o);
13609         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
13610         CHECK(calls->handle_open_channel_meth != NULL);
13611         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
13612         CHECK(calls->handle_accept_channel_meth != NULL);
13613         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
13614         CHECK(calls->handle_funding_created_meth != NULL);
13615         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
13616         CHECK(calls->handle_funding_signed_meth != NULL);
13617         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
13618         CHECK(calls->handle_channel_ready_meth != NULL);
13619         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
13620         CHECK(calls->handle_shutdown_meth != NULL);
13621         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
13622         CHECK(calls->handle_closing_signed_meth != NULL);
13623         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
13624         CHECK(calls->handle_update_add_htlc_meth != NULL);
13625         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
13626         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
13627         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
13628         CHECK(calls->handle_update_fail_htlc_meth != NULL);
13629         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
13630         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
13631         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
13632         CHECK(calls->handle_commitment_signed_meth != NULL);
13633         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
13634         CHECK(calls->handle_revoke_and_ack_meth != NULL);
13635         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
13636         CHECK(calls->handle_update_fee_meth != NULL);
13637         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
13638         CHECK(calls->handle_announcement_signatures_meth != NULL);
13639         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
13640         CHECK(calls->peer_disconnected_meth != NULL);
13641         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
13642         CHECK(calls->peer_connected_meth != NULL);
13643         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
13644         CHECK(calls->handle_channel_reestablish_meth != NULL);
13645         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
13646         CHECK(calls->handle_channel_update_meth != NULL);
13647         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
13648         CHECK(calls->handle_error_meth != NULL);
13649         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
13650         CHECK(calls->provided_node_features_meth != NULL);
13651         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
13652         CHECK(calls->provided_init_features_meth != NULL);
13653
13654         LDKChannelMessageHandler ret = {
13655                 .this_arg = (void*) calls,
13656                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
13657                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
13658                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
13659                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
13660                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
13661                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
13662                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
13663                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
13664                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
13665                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
13666                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
13667                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
13668                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
13669                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
13670                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
13671                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
13672                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
13673                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
13674                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
13675                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
13676                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
13677                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
13678                 .free = LDKChannelMessageHandler_JCalls_free,
13679                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
13680         };
13681         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13682         return ret;
13683 }
13684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13685         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
13686         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
13687         return tag_ptr(res_ptr, true);
13688 }
13689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
13690         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
13691         return tag_ptr(&inp->MessageSendEventsProvider, false);
13692 }
13693 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) {
13694         void* this_arg_ptr = untag_ptr(this_arg);
13695         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13696         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13697         LDKPublicKey their_node_id_ref;
13698         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13699         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13700         LDKOpenChannel msg_conv;
13701         msg_conv.inner = untag_ptr(msg);
13702         msg_conv.is_owned = ptr_is_owned(msg);
13703         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13704         msg_conv.is_owned = false;
13705         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13706 }
13707
13708 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) {
13709         void* this_arg_ptr = untag_ptr(this_arg);
13710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13711         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13712         LDKPublicKey their_node_id_ref;
13713         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13714         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13715         LDKAcceptChannel msg_conv;
13716         msg_conv.inner = untag_ptr(msg);
13717         msg_conv.is_owned = ptr_is_owned(msg);
13718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13719         msg_conv.is_owned = false;
13720         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13721 }
13722
13723 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) {
13724         void* this_arg_ptr = untag_ptr(this_arg);
13725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13726         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13727         LDKPublicKey their_node_id_ref;
13728         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13729         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13730         LDKFundingCreated msg_conv;
13731         msg_conv.inner = untag_ptr(msg);
13732         msg_conv.is_owned = ptr_is_owned(msg);
13733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13734         msg_conv.is_owned = false;
13735         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13736 }
13737
13738 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) {
13739         void* this_arg_ptr = untag_ptr(this_arg);
13740         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13741         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13742         LDKPublicKey their_node_id_ref;
13743         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13744         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13745         LDKFundingSigned msg_conv;
13746         msg_conv.inner = untag_ptr(msg);
13747         msg_conv.is_owned = ptr_is_owned(msg);
13748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13749         msg_conv.is_owned = false;
13750         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13751 }
13752
13753 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) {
13754         void* this_arg_ptr = untag_ptr(this_arg);
13755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13756         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13757         LDKPublicKey their_node_id_ref;
13758         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13759         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13760         LDKChannelReady msg_conv;
13761         msg_conv.inner = untag_ptr(msg);
13762         msg_conv.is_owned = ptr_is_owned(msg);
13763         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13764         msg_conv.is_owned = false;
13765         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13766 }
13767
13768 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) {
13769         void* this_arg_ptr = untag_ptr(this_arg);
13770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13771         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13772         LDKPublicKey their_node_id_ref;
13773         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13774         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13775         LDKShutdown msg_conv;
13776         msg_conv.inner = untag_ptr(msg);
13777         msg_conv.is_owned = ptr_is_owned(msg);
13778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13779         msg_conv.is_owned = false;
13780         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13781 }
13782
13783 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) {
13784         void* this_arg_ptr = untag_ptr(this_arg);
13785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13786         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13787         LDKPublicKey their_node_id_ref;
13788         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13789         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13790         LDKClosingSigned msg_conv;
13791         msg_conv.inner = untag_ptr(msg);
13792         msg_conv.is_owned = ptr_is_owned(msg);
13793         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13794         msg_conv.is_owned = false;
13795         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13796 }
13797
13798 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) {
13799         void* this_arg_ptr = untag_ptr(this_arg);
13800         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13801         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13802         LDKPublicKey their_node_id_ref;
13803         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13804         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13805         LDKUpdateAddHTLC msg_conv;
13806         msg_conv.inner = untag_ptr(msg);
13807         msg_conv.is_owned = ptr_is_owned(msg);
13808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13809         msg_conv.is_owned = false;
13810         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13811 }
13812
13813 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) {
13814         void* this_arg_ptr = untag_ptr(this_arg);
13815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13816         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13817         LDKPublicKey their_node_id_ref;
13818         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13819         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13820         LDKUpdateFulfillHTLC msg_conv;
13821         msg_conv.inner = untag_ptr(msg);
13822         msg_conv.is_owned = ptr_is_owned(msg);
13823         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13824         msg_conv.is_owned = false;
13825         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13826 }
13827
13828 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) {
13829         void* this_arg_ptr = untag_ptr(this_arg);
13830         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13831         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13832         LDKPublicKey their_node_id_ref;
13833         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13834         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13835         LDKUpdateFailHTLC msg_conv;
13836         msg_conv.inner = untag_ptr(msg);
13837         msg_conv.is_owned = ptr_is_owned(msg);
13838         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13839         msg_conv.is_owned = false;
13840         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13841 }
13842
13843 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) {
13844         void* this_arg_ptr = untag_ptr(this_arg);
13845         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13846         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13847         LDKPublicKey their_node_id_ref;
13848         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13849         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13850         LDKUpdateFailMalformedHTLC msg_conv;
13851         msg_conv.inner = untag_ptr(msg);
13852         msg_conv.is_owned = ptr_is_owned(msg);
13853         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13854         msg_conv.is_owned = false;
13855         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13856 }
13857
13858 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) {
13859         void* this_arg_ptr = untag_ptr(this_arg);
13860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13861         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13862         LDKPublicKey their_node_id_ref;
13863         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13864         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13865         LDKCommitmentSigned msg_conv;
13866         msg_conv.inner = untag_ptr(msg);
13867         msg_conv.is_owned = ptr_is_owned(msg);
13868         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13869         msg_conv.is_owned = false;
13870         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13871 }
13872
13873 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) {
13874         void* this_arg_ptr = untag_ptr(this_arg);
13875         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13876         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13877         LDKPublicKey their_node_id_ref;
13878         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13879         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13880         LDKRevokeAndACK msg_conv;
13881         msg_conv.inner = untag_ptr(msg);
13882         msg_conv.is_owned = ptr_is_owned(msg);
13883         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13884         msg_conv.is_owned = false;
13885         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13886 }
13887
13888 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) {
13889         void* this_arg_ptr = untag_ptr(this_arg);
13890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13891         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13892         LDKPublicKey their_node_id_ref;
13893         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13894         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13895         LDKUpdateFee msg_conv;
13896         msg_conv.inner = untag_ptr(msg);
13897         msg_conv.is_owned = ptr_is_owned(msg);
13898         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13899         msg_conv.is_owned = false;
13900         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13901 }
13902
13903 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) {
13904         void* this_arg_ptr = untag_ptr(this_arg);
13905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13906         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13907         LDKPublicKey their_node_id_ref;
13908         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13909         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13910         LDKAnnouncementSignatures msg_conv;
13911         msg_conv.inner = untag_ptr(msg);
13912         msg_conv.is_owned = ptr_is_owned(msg);
13913         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13914         msg_conv.is_owned = false;
13915         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13916 }
13917
13918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
13919         void* this_arg_ptr = untag_ptr(this_arg);
13920         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13921         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13922         LDKPublicKey their_node_id_ref;
13923         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13924         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13925         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13926 }
13927
13928 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) {
13929         void* this_arg_ptr = untag_ptr(this_arg);
13930         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13931         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13932         LDKPublicKey their_node_id_ref;
13933         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13934         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13935         LDKInit msg_conv;
13936         msg_conv.inner = untag_ptr(msg);
13937         msg_conv.is_owned = ptr_is_owned(msg);
13938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13939         msg_conv.is_owned = false;
13940         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13941         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
13942         return tag_ptr(ret_conv, true);
13943 }
13944
13945 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) {
13946         void* this_arg_ptr = untag_ptr(this_arg);
13947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13948         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13949         LDKPublicKey their_node_id_ref;
13950         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13951         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13952         LDKChannelReestablish msg_conv;
13953         msg_conv.inner = untag_ptr(msg);
13954         msg_conv.is_owned = ptr_is_owned(msg);
13955         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13956         msg_conv.is_owned = false;
13957         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13958 }
13959
13960 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) {
13961         void* this_arg_ptr = untag_ptr(this_arg);
13962         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13963         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13964         LDKPublicKey their_node_id_ref;
13965         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13966         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13967         LDKChannelUpdate msg_conv;
13968         msg_conv.inner = untag_ptr(msg);
13969         msg_conv.is_owned = ptr_is_owned(msg);
13970         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13971         msg_conv.is_owned = false;
13972         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13973 }
13974
13975 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) {
13976         void* this_arg_ptr = untag_ptr(this_arg);
13977         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13978         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13979         LDKPublicKey their_node_id_ref;
13980         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13981         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13982         LDKErrorMessage msg_conv;
13983         msg_conv.inner = untag_ptr(msg);
13984         msg_conv.is_owned = ptr_is_owned(msg);
13985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13986         msg_conv.is_owned = false;
13987         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
13988 }
13989
13990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
13991         void* this_arg_ptr = untag_ptr(this_arg);
13992         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13993         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
13994         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13995         int64_t ret_ref = 0;
13996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13998         return ret_ref;
13999 }
14000
14001 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) {
14002         void* this_arg_ptr = untag_ptr(this_arg);
14003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14004         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14005         LDKPublicKey their_node_id_ref;
14006         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14007         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14008         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14009         int64_t ret_ref = 0;
14010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14012         return ret_ref;
14013 }
14014
14015 typedef struct LDKRoutingMessageHandler_JCalls {
14016         atomic_size_t refcnt;
14017         JavaVM *vm;
14018         jweak o;
14019         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
14020         jmethodID handle_node_announcement_meth;
14021         jmethodID handle_channel_announcement_meth;
14022         jmethodID handle_channel_update_meth;
14023         jmethodID get_next_channel_announcement_meth;
14024         jmethodID get_next_node_announcement_meth;
14025         jmethodID peer_connected_meth;
14026         jmethodID handle_reply_channel_range_meth;
14027         jmethodID handle_reply_short_channel_ids_end_meth;
14028         jmethodID handle_query_channel_range_meth;
14029         jmethodID handle_query_short_channel_ids_meth;
14030         jmethodID processing_queue_high_meth;
14031         jmethodID provided_node_features_meth;
14032         jmethodID provided_init_features_meth;
14033 } LDKRoutingMessageHandler_JCalls;
14034 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
14035         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14036         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14037                 JNIEnv *env;
14038                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14039                 if (get_jenv_res == JNI_EDETACHED) {
14040                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14041                 } else {
14042                         DO_ASSERT(get_jenv_res == JNI_OK);
14043                 }
14044                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14045                 if (get_jenv_res == JNI_EDETACHED) {
14046                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14047                 }
14048                 FREE(j_calls);
14049         }
14050 }
14051 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
14052         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14053         JNIEnv *env;
14054         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14055         if (get_jenv_res == JNI_EDETACHED) {
14056                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14057         } else {
14058                 DO_ASSERT(get_jenv_res == JNI_OK);
14059         }
14060         LDKNodeAnnouncement msg_var = *msg;
14061         int64_t msg_ref = 0;
14062         msg_var = NodeAnnouncement_clone(&msg_var);
14063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14064         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14065         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14066         CHECK(obj != NULL);
14067         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
14068         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14069                 (*env)->ExceptionDescribe(env);
14070                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
14071         }
14072         void* ret_ptr = untag_ptr(ret);
14073         CHECK_ACCESS(ret_ptr);
14074         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14075         FREE(untag_ptr(ret));
14076         if (get_jenv_res == JNI_EDETACHED) {
14077                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14078         }
14079         return ret_conv;
14080 }
14081 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
14082         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14083         JNIEnv *env;
14084         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14085         if (get_jenv_res == JNI_EDETACHED) {
14086                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14087         } else {
14088                 DO_ASSERT(get_jenv_res == JNI_OK);
14089         }
14090         LDKChannelAnnouncement msg_var = *msg;
14091         int64_t msg_ref = 0;
14092         msg_var = ChannelAnnouncement_clone(&msg_var);
14093         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14094         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14095         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14096         CHECK(obj != NULL);
14097         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
14098         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14099                 (*env)->ExceptionDescribe(env);
14100                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
14101         }
14102         void* ret_ptr = untag_ptr(ret);
14103         CHECK_ACCESS(ret_ptr);
14104         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14105         FREE(untag_ptr(ret));
14106         if (get_jenv_res == JNI_EDETACHED) {
14107                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14108         }
14109         return ret_conv;
14110 }
14111 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
14112         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14113         JNIEnv *env;
14114         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14115         if (get_jenv_res == JNI_EDETACHED) {
14116                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14117         } else {
14118                 DO_ASSERT(get_jenv_res == JNI_OK);
14119         }
14120         LDKChannelUpdate msg_var = *msg;
14121         int64_t msg_ref = 0;
14122         msg_var = ChannelUpdate_clone(&msg_var);
14123         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14124         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14125         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14126         CHECK(obj != NULL);
14127         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
14128         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14129                 (*env)->ExceptionDescribe(env);
14130                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
14131         }
14132         void* ret_ptr = untag_ptr(ret);
14133         CHECK_ACCESS(ret_ptr);
14134         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
14135         FREE(untag_ptr(ret));
14136         if (get_jenv_res == JNI_EDETACHED) {
14137                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14138         }
14139         return ret_conv;
14140 }
14141 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
14142         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14143         JNIEnv *env;
14144         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14145         if (get_jenv_res == JNI_EDETACHED) {
14146                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14147         } else {
14148                 DO_ASSERT(get_jenv_res == JNI_OK);
14149         }
14150         int64_t starting_point_conv = starting_point;
14151         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14152         CHECK(obj != NULL);
14153         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
14154         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14155                 (*env)->ExceptionDescribe(env);
14156                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
14157         }
14158         void* ret_ptr = untag_ptr(ret);
14159         CHECK_ACCESS(ret_ptr);
14160         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
14161         FREE(untag_ptr(ret));
14162         if (get_jenv_res == JNI_EDETACHED) {
14163                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14164         }
14165         return ret_conv;
14166 }
14167 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
14168         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14169         JNIEnv *env;
14170         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14171         if (get_jenv_res == JNI_EDETACHED) {
14172                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14173         } else {
14174                 DO_ASSERT(get_jenv_res == JNI_OK);
14175         }
14176         LDKNodeId starting_point_var = starting_point;
14177         int64_t starting_point_ref = 0;
14178         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
14179         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
14180         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14181         CHECK(obj != NULL);
14182         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
14183         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14184                 (*env)->ExceptionDescribe(env);
14185                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
14186         }
14187         LDKNodeAnnouncement ret_conv;
14188         ret_conv.inner = untag_ptr(ret);
14189         ret_conv.is_owned = ptr_is_owned(ret);
14190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14191         if (get_jenv_res == JNI_EDETACHED) {
14192                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14193         }
14194         return ret_conv;
14195 }
14196 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
14197         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14198         JNIEnv *env;
14199         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14200         if (get_jenv_res == JNI_EDETACHED) {
14201                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14202         } else {
14203                 DO_ASSERT(get_jenv_res == JNI_OK);
14204         }
14205         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14206         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14207         LDKInit init_var = *init;
14208         int64_t init_ref = 0;
14209         init_var = Init_clone(&init_var);
14210         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
14211         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
14212         jboolean inbound_conv = inbound;
14213         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14214         CHECK(obj != NULL);
14215         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
14216         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14217                 (*env)->ExceptionDescribe(env);
14218                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
14219         }
14220         void* ret_ptr = untag_ptr(ret);
14221         CHECK_ACCESS(ret_ptr);
14222         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14223         FREE(untag_ptr(ret));
14224         if (get_jenv_res == JNI_EDETACHED) {
14225                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14226         }
14227         return ret_conv;
14228 }
14229 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
14230         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14231         JNIEnv *env;
14232         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14233         if (get_jenv_res == JNI_EDETACHED) {
14234                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14235         } else {
14236                 DO_ASSERT(get_jenv_res == JNI_OK);
14237         }
14238         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14239         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14240         LDKReplyChannelRange msg_var = msg;
14241         int64_t msg_ref = 0;
14242         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14243         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14244         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14245         CHECK(obj != NULL);
14246         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
14247         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14248                 (*env)->ExceptionDescribe(env);
14249                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
14250         }
14251         void* ret_ptr = untag_ptr(ret);
14252         CHECK_ACCESS(ret_ptr);
14253         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14254         FREE(untag_ptr(ret));
14255         if (get_jenv_res == JNI_EDETACHED) {
14256                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14257         }
14258         return ret_conv;
14259 }
14260 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
14261         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14262         JNIEnv *env;
14263         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14264         if (get_jenv_res == JNI_EDETACHED) {
14265                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14266         } else {
14267                 DO_ASSERT(get_jenv_res == JNI_OK);
14268         }
14269         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14270         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14271         LDKReplyShortChannelIdsEnd msg_var = msg;
14272         int64_t msg_ref = 0;
14273         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14274         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14275         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14276         CHECK(obj != NULL);
14277         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
14278         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14279                 (*env)->ExceptionDescribe(env);
14280                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
14281         }
14282         void* ret_ptr = untag_ptr(ret);
14283         CHECK_ACCESS(ret_ptr);
14284         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14285         FREE(untag_ptr(ret));
14286         if (get_jenv_res == JNI_EDETACHED) {
14287                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14288         }
14289         return ret_conv;
14290 }
14291 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
14292         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14293         JNIEnv *env;
14294         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14295         if (get_jenv_res == JNI_EDETACHED) {
14296                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14297         } else {
14298                 DO_ASSERT(get_jenv_res == JNI_OK);
14299         }
14300         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14301         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14302         LDKQueryChannelRange msg_var = msg;
14303         int64_t msg_ref = 0;
14304         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14305         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14306         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14307         CHECK(obj != NULL);
14308         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
14309         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14310                 (*env)->ExceptionDescribe(env);
14311                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
14312         }
14313         void* ret_ptr = untag_ptr(ret);
14314         CHECK_ACCESS(ret_ptr);
14315         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14316         FREE(untag_ptr(ret));
14317         if (get_jenv_res == JNI_EDETACHED) {
14318                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14319         }
14320         return ret_conv;
14321 }
14322 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
14323         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14324         JNIEnv *env;
14325         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14326         if (get_jenv_res == JNI_EDETACHED) {
14327                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14328         } else {
14329                 DO_ASSERT(get_jenv_res == JNI_OK);
14330         }
14331         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14332         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14333         LDKQueryShortChannelIds msg_var = msg;
14334         int64_t msg_ref = 0;
14335         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14336         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14337         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14338         CHECK(obj != NULL);
14339         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
14340         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14341                 (*env)->ExceptionDescribe(env);
14342                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
14343         }
14344         void* ret_ptr = untag_ptr(ret);
14345         CHECK_ACCESS(ret_ptr);
14346         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
14347         FREE(untag_ptr(ret));
14348         if (get_jenv_res == JNI_EDETACHED) {
14349                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14350         }
14351         return ret_conv;
14352 }
14353 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
14354         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14355         JNIEnv *env;
14356         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14357         if (get_jenv_res == JNI_EDETACHED) {
14358                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14359         } else {
14360                 DO_ASSERT(get_jenv_res == JNI_OK);
14361         }
14362         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14363         CHECK(obj != NULL);
14364         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
14365         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14366                 (*env)->ExceptionDescribe(env);
14367                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
14368         }
14369         if (get_jenv_res == JNI_EDETACHED) {
14370                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14371         }
14372         return ret;
14373 }
14374 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
14375         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14376         JNIEnv *env;
14377         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14378         if (get_jenv_res == JNI_EDETACHED) {
14379                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14380         } else {
14381                 DO_ASSERT(get_jenv_res == JNI_OK);
14382         }
14383         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14384         CHECK(obj != NULL);
14385         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
14386         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14387                 (*env)->ExceptionDescribe(env);
14388                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
14389         }
14390         LDKNodeFeatures ret_conv;
14391         ret_conv.inner = untag_ptr(ret);
14392         ret_conv.is_owned = ptr_is_owned(ret);
14393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14394         if (get_jenv_res == JNI_EDETACHED) {
14395                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14396         }
14397         return ret_conv;
14398 }
14399 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14400         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
14401         JNIEnv *env;
14402         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14403         if (get_jenv_res == JNI_EDETACHED) {
14404                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14405         } else {
14406                 DO_ASSERT(get_jenv_res == JNI_OK);
14407         }
14408         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14409         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14410         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14411         CHECK(obj != NULL);
14412         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
14413         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14414                 (*env)->ExceptionDescribe(env);
14415                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
14416         }
14417         LDKInitFeatures ret_conv;
14418         ret_conv.inner = untag_ptr(ret);
14419         ret_conv.is_owned = ptr_is_owned(ret);
14420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14421         if (get_jenv_res == JNI_EDETACHED) {
14422                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14423         }
14424         return ret_conv;
14425 }
14426 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
14427         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
14428         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14429         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
14430 }
14431 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
14432         jclass c = (*env)->GetObjectClass(env, o);
14433         CHECK(c != NULL);
14434         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
14435         atomic_init(&calls->refcnt, 1);
14436         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14437         calls->o = (*env)->NewWeakGlobalRef(env, o);
14438         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
14439         CHECK(calls->handle_node_announcement_meth != NULL);
14440         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
14441         CHECK(calls->handle_channel_announcement_meth != NULL);
14442         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
14443         CHECK(calls->handle_channel_update_meth != NULL);
14444         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
14445         CHECK(calls->get_next_channel_announcement_meth != NULL);
14446         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
14447         CHECK(calls->get_next_node_announcement_meth != NULL);
14448         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
14449         CHECK(calls->peer_connected_meth != NULL);
14450         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
14451         CHECK(calls->handle_reply_channel_range_meth != NULL);
14452         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
14453         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
14454         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
14455         CHECK(calls->handle_query_channel_range_meth != NULL);
14456         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
14457         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
14458         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
14459         CHECK(calls->processing_queue_high_meth != NULL);
14460         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
14461         CHECK(calls->provided_node_features_meth != NULL);
14462         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
14463         CHECK(calls->provided_init_features_meth != NULL);
14464
14465         LDKRoutingMessageHandler ret = {
14466                 .this_arg = (void*) calls,
14467                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
14468                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
14469                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
14470                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
14471                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
14472                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
14473                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
14474                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
14475                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
14476                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
14477                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
14478                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
14479                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
14480                 .free = LDKRoutingMessageHandler_JCalls_free,
14481                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
14482         };
14483         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
14484         return ret;
14485 }
14486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
14487         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
14488         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
14489         return tag_ptr(res_ptr, true);
14490 }
14491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
14492         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
14493         return tag_ptr(&inp->MessageSendEventsProvider, false);
14494 }
14495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
14496         void* this_arg_ptr = untag_ptr(this_arg);
14497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14498         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14499         LDKNodeAnnouncement msg_conv;
14500         msg_conv.inner = untag_ptr(msg);
14501         msg_conv.is_owned = ptr_is_owned(msg);
14502         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14503         msg_conv.is_owned = false;
14504         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14505         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
14506         return tag_ptr(ret_conv, true);
14507 }
14508
14509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
14510         void* this_arg_ptr = untag_ptr(this_arg);
14511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14512         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14513         LDKChannelAnnouncement msg_conv;
14514         msg_conv.inner = untag_ptr(msg);
14515         msg_conv.is_owned = ptr_is_owned(msg);
14516         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14517         msg_conv.is_owned = false;
14518         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14519         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
14520         return tag_ptr(ret_conv, true);
14521 }
14522
14523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
14524         void* this_arg_ptr = untag_ptr(this_arg);
14525         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14526         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14527         LDKChannelUpdate msg_conv;
14528         msg_conv.inner = untag_ptr(msg);
14529         msg_conv.is_owned = ptr_is_owned(msg);
14530         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14531         msg_conv.is_owned = false;
14532         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14533         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
14534         return tag_ptr(ret_conv, true);
14535 }
14536
14537 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) {
14538         void* this_arg_ptr = untag_ptr(this_arg);
14539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14540         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14541         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14542         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
14543         int64_t ret_ref = tag_ptr(ret_copy, true);
14544         return ret_ref;
14545 }
14546
14547 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) {
14548         void* this_arg_ptr = untag_ptr(this_arg);
14549         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14550         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14551         LDKNodeId starting_point_conv;
14552         starting_point_conv.inner = untag_ptr(starting_point);
14553         starting_point_conv.is_owned = ptr_is_owned(starting_point);
14554         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
14555         starting_point_conv = NodeId_clone(&starting_point_conv);
14556         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
14557         int64_t ret_ref = 0;
14558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14560         return ret_ref;
14561 }
14562
14563 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) {
14564         void* this_arg_ptr = untag_ptr(this_arg);
14565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14566         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14567         LDKPublicKey their_node_id_ref;
14568         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14569         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14570         LDKInit init_conv;
14571         init_conv.inner = untag_ptr(init);
14572         init_conv.is_owned = ptr_is_owned(init);
14573         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
14574         init_conv.is_owned = false;
14575         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14576         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
14577         return tag_ptr(ret_conv, true);
14578 }
14579
14580 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) {
14581         void* this_arg_ptr = untag_ptr(this_arg);
14582         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14583         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14584         LDKPublicKey their_node_id_ref;
14585         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14586         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14587         LDKReplyChannelRange msg_conv;
14588         msg_conv.inner = untag_ptr(msg);
14589         msg_conv.is_owned = ptr_is_owned(msg);
14590         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14591         msg_conv = ReplyChannelRange_clone(&msg_conv);
14592         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14593         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14594         return tag_ptr(ret_conv, true);
14595 }
14596
14597 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) {
14598         void* this_arg_ptr = untag_ptr(this_arg);
14599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14600         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14601         LDKPublicKey their_node_id_ref;
14602         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14603         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14604         LDKReplyShortChannelIdsEnd msg_conv;
14605         msg_conv.inner = untag_ptr(msg);
14606         msg_conv.is_owned = ptr_is_owned(msg);
14607         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14608         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
14609         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14610         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14611         return tag_ptr(ret_conv, true);
14612 }
14613
14614 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) {
14615         void* this_arg_ptr = untag_ptr(this_arg);
14616         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14617         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14618         LDKPublicKey their_node_id_ref;
14619         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14620         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14621         LDKQueryChannelRange msg_conv;
14622         msg_conv.inner = untag_ptr(msg);
14623         msg_conv.is_owned = ptr_is_owned(msg);
14624         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14625         msg_conv = QueryChannelRange_clone(&msg_conv);
14626         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14627         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14628         return tag_ptr(ret_conv, true);
14629 }
14630
14631 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) {
14632         void* this_arg_ptr = untag_ptr(this_arg);
14633         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14634         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14635         LDKPublicKey their_node_id_ref;
14636         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14637         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14638         LDKQueryShortChannelIds msg_conv;
14639         msg_conv.inner = untag_ptr(msg);
14640         msg_conv.is_owned = ptr_is_owned(msg);
14641         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14642         msg_conv = QueryShortChannelIds_clone(&msg_conv);
14643         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14644         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
14645         return tag_ptr(ret_conv, true);
14646 }
14647
14648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
14649         void* this_arg_ptr = untag_ptr(this_arg);
14650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14651         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14652         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
14653         return ret_conv;
14654 }
14655
14656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
14657         void* this_arg_ptr = untag_ptr(this_arg);
14658         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14659         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14660         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14661         int64_t ret_ref = 0;
14662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14664         return ret_ref;
14665 }
14666
14667 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) {
14668         void* this_arg_ptr = untag_ptr(this_arg);
14669         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14670         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
14671         LDKPublicKey their_node_id_ref;
14672         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14673         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14674         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14675         int64_t ret_ref = 0;
14676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14678         return ret_ref;
14679 }
14680
14681 typedef struct LDKOnionMessageHandler_JCalls {
14682         atomic_size_t refcnt;
14683         JavaVM *vm;
14684         jweak o;
14685         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
14686         jmethodID handle_onion_message_meth;
14687         jmethodID peer_connected_meth;
14688         jmethodID peer_disconnected_meth;
14689         jmethodID provided_node_features_meth;
14690         jmethodID provided_init_features_meth;
14691 } LDKOnionMessageHandler_JCalls;
14692 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
14693         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14694         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14695                 JNIEnv *env;
14696                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14697                 if (get_jenv_res == JNI_EDETACHED) {
14698                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14699                 } else {
14700                         DO_ASSERT(get_jenv_res == JNI_OK);
14701                 }
14702                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14703                 if (get_jenv_res == JNI_EDETACHED) {
14704                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14705                 }
14706                 FREE(j_calls);
14707         }
14708 }
14709 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
14710         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14711         JNIEnv *env;
14712         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14713         if (get_jenv_res == JNI_EDETACHED) {
14714                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14715         } else {
14716                 DO_ASSERT(get_jenv_res == JNI_OK);
14717         }
14718         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
14719         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
14720         LDKOnionMessage msg_var = *msg;
14721         int64_t msg_ref = 0;
14722         msg_var = OnionMessage_clone(&msg_var);
14723         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14724         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14725         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14726         CHECK(obj != NULL);
14727         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
14728         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14729                 (*env)->ExceptionDescribe(env);
14730                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
14731         }
14732         if (get_jenv_res == JNI_EDETACHED) {
14733                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14734         }
14735 }
14736 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
14737         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14738         JNIEnv *env;
14739         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14740         if (get_jenv_res == JNI_EDETACHED) {
14741                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14742         } else {
14743                 DO_ASSERT(get_jenv_res == JNI_OK);
14744         }
14745         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14746         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14747         LDKInit init_var = *init;
14748         int64_t init_ref = 0;
14749         init_var = Init_clone(&init_var);
14750         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
14751         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
14752         jboolean inbound_conv = inbound;
14753         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14754         CHECK(obj != NULL);
14755         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
14756         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14757                 (*env)->ExceptionDescribe(env);
14758                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
14759         }
14760         void* ret_ptr = untag_ptr(ret);
14761         CHECK_ACCESS(ret_ptr);
14762         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14763         FREE(untag_ptr(ret));
14764         if (get_jenv_res == JNI_EDETACHED) {
14765                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14766         }
14767         return ret_conv;
14768 }
14769 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14770         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14771         JNIEnv *env;
14772         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14773         if (get_jenv_res == JNI_EDETACHED) {
14774                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14775         } else {
14776                 DO_ASSERT(get_jenv_res == JNI_OK);
14777         }
14778         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14779         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14780         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14781         CHECK(obj != NULL);
14782         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
14783         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14784                 (*env)->ExceptionDescribe(env);
14785                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
14786         }
14787         if (get_jenv_res == JNI_EDETACHED) {
14788                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14789         }
14790 }
14791 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
14792         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14793         JNIEnv *env;
14794         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14795         if (get_jenv_res == JNI_EDETACHED) {
14796                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14797         } else {
14798                 DO_ASSERT(get_jenv_res == JNI_OK);
14799         }
14800         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14801         CHECK(obj != NULL);
14802         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
14803         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14804                 (*env)->ExceptionDescribe(env);
14805                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
14806         }
14807         LDKNodeFeatures ret_conv;
14808         ret_conv.inner = untag_ptr(ret);
14809         ret_conv.is_owned = ptr_is_owned(ret);
14810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14811         if (get_jenv_res == JNI_EDETACHED) {
14812                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14813         }
14814         return ret_conv;
14815 }
14816 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14817         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
14818         JNIEnv *env;
14819         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14820         if (get_jenv_res == JNI_EDETACHED) {
14821                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14822         } else {
14823                 DO_ASSERT(get_jenv_res == JNI_OK);
14824         }
14825         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
14826         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
14827         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14828         CHECK(obj != NULL);
14829         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
14830         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14831                 (*env)->ExceptionDescribe(env);
14832                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
14833         }
14834         LDKInitFeatures ret_conv;
14835         ret_conv.inner = untag_ptr(ret);
14836         ret_conv.is_owned = ptr_is_owned(ret);
14837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14838         if (get_jenv_res == JNI_EDETACHED) {
14839                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14840         }
14841         return ret_conv;
14842 }
14843 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
14844         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
14845         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14846         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
14847 }
14848 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
14849         jclass c = (*env)->GetObjectClass(env, o);
14850         CHECK(c != NULL);
14851         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
14852         atomic_init(&calls->refcnt, 1);
14853         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14854         calls->o = (*env)->NewWeakGlobalRef(env, o);
14855         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
14856         CHECK(calls->handle_onion_message_meth != NULL);
14857         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
14858         CHECK(calls->peer_connected_meth != NULL);
14859         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
14860         CHECK(calls->peer_disconnected_meth != NULL);
14861         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
14862         CHECK(calls->provided_node_features_meth != NULL);
14863         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
14864         CHECK(calls->provided_init_features_meth != NULL);
14865
14866         LDKOnionMessageHandler ret = {
14867                 .this_arg = (void*) calls,
14868                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
14869                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
14870                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
14871                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
14872                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
14873                 .free = LDKOnionMessageHandler_JCalls_free,
14874                 .OnionMessageProvider = LDKOnionMessageProvider_init(env, clz, OnionMessageProvider),
14875         };
14876         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
14877         return ret;
14878 }
14879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
14880         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
14881         *res_ptr = LDKOnionMessageHandler_init(env, clz, o, OnionMessageProvider);
14882         return tag_ptr(res_ptr, true);
14883 }
14884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t arg) {
14885         LDKOnionMessageHandler *inp = (LDKOnionMessageHandler *)untag_ptr(arg);
14886         return tag_ptr(&inp->OnionMessageProvider, false);
14887 }
14888 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) {
14889         void* this_arg_ptr = untag_ptr(this_arg);
14890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14891         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14892         LDKPublicKey peer_node_id_ref;
14893         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
14894         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
14895         LDKOnionMessage msg_conv;
14896         msg_conv.inner = untag_ptr(msg);
14897         msg_conv.is_owned = ptr_is_owned(msg);
14898         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14899         msg_conv.is_owned = false;
14900         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
14901 }
14902
14903 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) {
14904         void* this_arg_ptr = untag_ptr(this_arg);
14905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14906         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14907         LDKPublicKey their_node_id_ref;
14908         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14909         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14910         LDKInit init_conv;
14911         init_conv.inner = untag_ptr(init);
14912         init_conv.is_owned = ptr_is_owned(init);
14913         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
14914         init_conv.is_owned = false;
14915         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14916         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
14917         return tag_ptr(ret_conv, true);
14918 }
14919
14920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
14921         void* this_arg_ptr = untag_ptr(this_arg);
14922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14923         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14924         LDKPublicKey their_node_id_ref;
14925         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14926         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14927         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
14928 }
14929
14930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
14931         void* this_arg_ptr = untag_ptr(this_arg);
14932         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14933         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14934         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14935         int64_t ret_ref = 0;
14936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14938         return ret_ref;
14939 }
14940
14941 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) {
14942         void* this_arg_ptr = untag_ptr(this_arg);
14943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14944         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
14945         LDKPublicKey their_node_id_ref;
14946         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14947         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14948         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14949         int64_t ret_ref = 0;
14950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14952         return ret_ref;
14953 }
14954
14955 typedef struct LDKCustomMessageReader_JCalls {
14956         atomic_size_t refcnt;
14957         JavaVM *vm;
14958         jweak o;
14959         jmethodID read_meth;
14960 } LDKCustomMessageReader_JCalls;
14961 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
14962         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
14963         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14964                 JNIEnv *env;
14965                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14966                 if (get_jenv_res == JNI_EDETACHED) {
14967                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14968                 } else {
14969                         DO_ASSERT(get_jenv_res == JNI_OK);
14970                 }
14971                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14972                 if (get_jenv_res == JNI_EDETACHED) {
14973                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14974                 }
14975                 FREE(j_calls);
14976         }
14977 }
14978 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
14979         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
14980         JNIEnv *env;
14981         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14982         if (get_jenv_res == JNI_EDETACHED) {
14983                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14984         } else {
14985                 DO_ASSERT(get_jenv_res == JNI_OK);
14986         }
14987         int16_t message_type_conv = message_type;
14988         LDKu8slice buffer_var = buffer;
14989         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
14990         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
14991         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14992         CHECK(obj != NULL);
14993         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
14994         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14995                 (*env)->ExceptionDescribe(env);
14996                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
14997         }
14998         void* ret_ptr = untag_ptr(ret);
14999         CHECK_ACCESS(ret_ptr);
15000         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
15001         FREE(untag_ptr(ret));
15002         if (get_jenv_res == JNI_EDETACHED) {
15003                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15004         }
15005         return ret_conv;
15006 }
15007 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
15008         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
15009         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15010 }
15011 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
15012         jclass c = (*env)->GetObjectClass(env, o);
15013         CHECK(c != NULL);
15014         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
15015         atomic_init(&calls->refcnt, 1);
15016         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15017         calls->o = (*env)->NewWeakGlobalRef(env, o);
15018         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
15019         CHECK(calls->read_meth != NULL);
15020
15021         LDKCustomMessageReader ret = {
15022                 .this_arg = (void*) calls,
15023                 .read = read_LDKCustomMessageReader_jcall,
15024                 .free = LDKCustomMessageReader_JCalls_free,
15025         };
15026         return ret;
15027 }
15028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
15029         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
15030         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
15031         return tag_ptr(res_ptr, true);
15032 }
15033 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) {
15034         void* this_arg_ptr = untag_ptr(this_arg);
15035         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15036         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
15037         LDKu8slice buffer_ref;
15038         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
15039         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
15040         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15041         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
15042         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
15043         return tag_ptr(ret_conv, true);
15044 }
15045
15046 typedef struct LDKCustomMessageHandler_JCalls {
15047         atomic_size_t refcnt;
15048         JavaVM *vm;
15049         jweak o;
15050         LDKCustomMessageReader_JCalls* CustomMessageReader;
15051         jmethodID handle_custom_message_meth;
15052         jmethodID get_and_clear_pending_msg_meth;
15053 } LDKCustomMessageHandler_JCalls;
15054 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
15055         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15056         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15057                 JNIEnv *env;
15058                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15059                 if (get_jenv_res == JNI_EDETACHED) {
15060                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15061                 } else {
15062                         DO_ASSERT(get_jenv_res == JNI_OK);
15063                 }
15064                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15065                 if (get_jenv_res == JNI_EDETACHED) {
15066                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15067                 }
15068                 FREE(j_calls);
15069         }
15070 }
15071 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
15072         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15073         JNIEnv *env;
15074         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15075         if (get_jenv_res == JNI_EDETACHED) {
15076                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15077         } else {
15078                 DO_ASSERT(get_jenv_res == JNI_OK);
15079         }
15080         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
15081         *msg_ret = msg;
15082         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
15083         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
15084         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15085         CHECK(obj != NULL);
15086         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
15087         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15088                 (*env)->ExceptionDescribe(env);
15089                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
15090         }
15091         void* ret_ptr = untag_ptr(ret);
15092         CHECK_ACCESS(ret_ptr);
15093         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15094         FREE(untag_ptr(ret));
15095         if (get_jenv_res == JNI_EDETACHED) {
15096                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15097         }
15098         return ret_conv;
15099 }
15100 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
15101         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_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         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15110         CHECK(obj != NULL);
15111         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
15112         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15113                 (*env)->ExceptionDescribe(env);
15114                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
15115         }
15116         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
15117         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
15118         if (ret_constr.datalen > 0)
15119                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
15120         else
15121                 ret_constr.data = NULL;
15122         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
15123         for (size_t z = 0; z < ret_constr.datalen; z++) {
15124                 int64_t ret_conv_25 = ret_vals[z];
15125                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
15126                 CHECK_ACCESS(ret_conv_25_ptr);
15127                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
15128                 FREE(untag_ptr(ret_conv_25));
15129                 ret_constr.data[z] = ret_conv_25_conv;
15130         }
15131         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
15132         if (get_jenv_res == JNI_EDETACHED) {
15133                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15134         }
15135         return ret_constr;
15136 }
15137 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
15138         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
15139         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15140         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
15141 }
15142 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
15143         jclass c = (*env)->GetObjectClass(env, o);
15144         CHECK(c != NULL);
15145         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
15146         atomic_init(&calls->refcnt, 1);
15147         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15148         calls->o = (*env)->NewWeakGlobalRef(env, o);
15149         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
15150         CHECK(calls->handle_custom_message_meth != NULL);
15151         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
15152         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
15153
15154         LDKCustomMessageHandler ret = {
15155                 .this_arg = (void*) calls,
15156                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
15157                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
15158                 .free = LDKCustomMessageHandler_JCalls_free,
15159                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
15160         };
15161         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
15162         return ret;
15163 }
15164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
15165         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
15166         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
15167         return tag_ptr(res_ptr, true);
15168 }
15169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
15170         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
15171         return tag_ptr(&inp->CustomMessageReader, false);
15172 }
15173 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) {
15174         void* this_arg_ptr = untag_ptr(this_arg);
15175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15176         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15177         void* msg_ptr = untag_ptr(msg);
15178         CHECK_ACCESS(msg_ptr);
15179         LDKType msg_conv = *(LDKType*)(msg_ptr);
15180         if (msg_conv.free == LDKType_JCalls_free) {
15181                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15182                 LDKType_JCalls_cloned(&msg_conv);
15183         }
15184         LDKPublicKey sender_node_id_ref;
15185         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
15186         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
15187         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15188         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
15189         return tag_ptr(ret_conv, true);
15190 }
15191
15192 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
15193         void* this_arg_ptr = untag_ptr(this_arg);
15194         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15195         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15196         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
15197         int64_tArray ret_arr = NULL;
15198         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15199         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15200         for (size_t z = 0; z < ret_var.datalen; z++) {
15201                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
15202                 *ret_conv_25_conv = ret_var.data[z];
15203                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
15204         }
15205         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15206         FREE(ret_var.data);
15207         return ret_arr;
15208 }
15209
15210 typedef struct LDKCustomOnionMessageHandler_JCalls {
15211         atomic_size_t refcnt;
15212         JavaVM *vm;
15213         jweak o;
15214         jmethodID handle_custom_message_meth;
15215         jmethodID read_custom_message_meth;
15216 } LDKCustomOnionMessageHandler_JCalls;
15217 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
15218         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15219         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15220                 JNIEnv *env;
15221                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15222                 if (get_jenv_res == JNI_EDETACHED) {
15223                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15224                 } else {
15225                         DO_ASSERT(get_jenv_res == JNI_OK);
15226                 }
15227                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15228                 if (get_jenv_res == JNI_EDETACHED) {
15229                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15230                 }
15231                 FREE(j_calls);
15232         }
15233 }
15234 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
15235         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15236         JNIEnv *env;
15237         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15238         if (get_jenv_res == JNI_EDETACHED) {
15239                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15240         } else {
15241                 DO_ASSERT(get_jenv_res == JNI_OK);
15242         }
15243         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
15244         *msg_ret = msg;
15245         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15246         CHECK(obj != NULL);
15247         (*env)->CallVoidMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
15248         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15249                 (*env)->ExceptionDescribe(env);
15250                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
15251         }
15252         if (get_jenv_res == JNI_EDETACHED) {
15253                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15254         }
15255 }
15256 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
15257         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15258         JNIEnv *env;
15259         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15260         if (get_jenv_res == JNI_EDETACHED) {
15261                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15262         } else {
15263                 DO_ASSERT(get_jenv_res == JNI_OK);
15264         }
15265         int64_t message_type_conv = message_type;
15266         LDKu8slice buffer_var = buffer;
15267         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
15268         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
15269         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15270         CHECK(obj != NULL);
15271         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
15272         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15273                 (*env)->ExceptionDescribe(env);
15274                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
15275         }
15276         void* ret_ptr = untag_ptr(ret);
15277         CHECK_ACCESS(ret_ptr);
15278         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
15279         FREE(untag_ptr(ret));
15280         if (get_jenv_res == JNI_EDETACHED) {
15281                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15282         }
15283         return ret_conv;
15284 }
15285 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
15286         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
15287         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15288 }
15289 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
15290         jclass c = (*env)->GetObjectClass(env, o);
15291         CHECK(c != NULL);
15292         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
15293         atomic_init(&calls->refcnt, 1);
15294         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15295         calls->o = (*env)->NewWeakGlobalRef(env, o);
15296         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)V");
15297         CHECK(calls->handle_custom_message_meth != NULL);
15298         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
15299         CHECK(calls->read_custom_message_meth != NULL);
15300
15301         LDKCustomOnionMessageHandler ret = {
15302                 .this_arg = (void*) calls,
15303                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
15304                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
15305                 .free = LDKCustomOnionMessageHandler_JCalls_free,
15306         };
15307         return ret;
15308 }
15309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
15310         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
15311         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
15312         return tag_ptr(res_ptr, true);
15313 }
15314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
15315         void* this_arg_ptr = untag_ptr(this_arg);
15316         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15317         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15318         void* msg_ptr = untag_ptr(msg);
15319         CHECK_ACCESS(msg_ptr);
15320         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
15321         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
15322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15323                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
15324         }
15325         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
15326 }
15327
15328 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) {
15329         void* this_arg_ptr = untag_ptr(this_arg);
15330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15331         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15332         LDKu8slice buffer_ref;
15333         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
15334         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
15335         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
15336         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
15337         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
15338         return tag_ptr(ret_conv, true);
15339 }
15340
15341 typedef struct LDKSocketDescriptor_JCalls {
15342         atomic_size_t refcnt;
15343         JavaVM *vm;
15344         jweak o;
15345         jmethodID send_data_meth;
15346         jmethodID disconnect_socket_meth;
15347         jmethodID eq_meth;
15348         jmethodID hash_meth;
15349 } LDKSocketDescriptor_JCalls;
15350 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
15351         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15352         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15353                 JNIEnv *env;
15354                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15355                 if (get_jenv_res == JNI_EDETACHED) {
15356                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15357                 } else {
15358                         DO_ASSERT(get_jenv_res == JNI_OK);
15359                 }
15360                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15361                 if (get_jenv_res == JNI_EDETACHED) {
15362                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15363                 }
15364                 FREE(j_calls);
15365         }
15366 }
15367 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
15368         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15369         JNIEnv *env;
15370         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15371         if (get_jenv_res == JNI_EDETACHED) {
15372                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15373         } else {
15374                 DO_ASSERT(get_jenv_res == JNI_OK);
15375         }
15376         LDKu8slice data_var = data;
15377         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
15378         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
15379         jboolean resume_read_conv = resume_read;
15380         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15381         CHECK(obj != NULL);
15382         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
15383         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15384                 (*env)->ExceptionDescribe(env);
15385                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
15386         }
15387         if (get_jenv_res == JNI_EDETACHED) {
15388                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15389         }
15390         return ret;
15391 }
15392 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
15393         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15394         JNIEnv *env;
15395         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15396         if (get_jenv_res == JNI_EDETACHED) {
15397                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15398         } else {
15399                 DO_ASSERT(get_jenv_res == JNI_OK);
15400         }
15401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15402         CHECK(obj != NULL);
15403         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
15404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15405                 (*env)->ExceptionDescribe(env);
15406                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
15407         }
15408         if (get_jenv_res == JNI_EDETACHED) {
15409                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15410         }
15411 }
15412 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
15413         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15414         JNIEnv *env;
15415         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15416         if (get_jenv_res == JNI_EDETACHED) {
15417                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15418         } else {
15419                 DO_ASSERT(get_jenv_res == JNI_OK);
15420         }
15421         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15422         *other_arg_clone = SocketDescriptor_clone(other_arg);
15423         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15424         CHECK(obj != NULL);
15425         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
15426         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15427                 (*env)->ExceptionDescribe(env);
15428                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
15429         }
15430         if (get_jenv_res == JNI_EDETACHED) {
15431                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15432         }
15433         return ret;
15434 }
15435 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
15436         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
15437         JNIEnv *env;
15438         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15439         if (get_jenv_res == JNI_EDETACHED) {
15440                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15441         } else {
15442                 DO_ASSERT(get_jenv_res == JNI_OK);
15443         }
15444         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15445         CHECK(obj != NULL);
15446         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
15447         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15448                 (*env)->ExceptionDescribe(env);
15449                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
15450         }
15451         if (get_jenv_res == JNI_EDETACHED) {
15452                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15453         }
15454         return ret;
15455 }
15456 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
15457         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
15458         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15459 }
15460 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
15461         jclass c = (*env)->GetObjectClass(env, o);
15462         CHECK(c != NULL);
15463         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
15464         atomic_init(&calls->refcnt, 1);
15465         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15466         calls->o = (*env)->NewWeakGlobalRef(env, o);
15467         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
15468         CHECK(calls->send_data_meth != NULL);
15469         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
15470         CHECK(calls->disconnect_socket_meth != NULL);
15471         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
15472         CHECK(calls->eq_meth != NULL);
15473         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
15474         CHECK(calls->hash_meth != NULL);
15475
15476         LDKSocketDescriptor ret = {
15477                 .this_arg = (void*) calls,
15478                 .send_data = send_data_LDKSocketDescriptor_jcall,
15479                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
15480                 .eq = eq_LDKSocketDescriptor_jcall,
15481                 .hash = hash_LDKSocketDescriptor_jcall,
15482                 .cloned = LDKSocketDescriptor_JCalls_cloned,
15483                 .free = LDKSocketDescriptor_JCalls_free,
15484         };
15485         return ret;
15486 }
15487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
15488         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
15489         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
15490         return tag_ptr(res_ptr, true);
15491 }
15492 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) {
15493         void* this_arg_ptr = untag_ptr(this_arg);
15494         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15495         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15496         LDKu8slice data_ref;
15497         data_ref.datalen = (*env)->GetArrayLength(env, data);
15498         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
15499         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
15500         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
15501         return ret_conv;
15502 }
15503
15504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
15505         void* this_arg_ptr = untag_ptr(this_arg);
15506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15507         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15508         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
15509 }
15510
15511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15512         void* this_arg_ptr = untag_ptr(this_arg);
15513         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15514         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
15515         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
15516         return ret_conv;
15517 }
15518
15519 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
15520 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
15521 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
15522 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
15523 static jclass LDKEffectiveCapacity_Total_class = NULL;
15524 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
15525 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
15526 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
15527 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
15528 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
15529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
15530         LDKEffectiveCapacity_ExactLiquidity_class =
15531                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
15532         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
15533         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
15534         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
15535         LDKEffectiveCapacity_MaximumHTLC_class =
15536                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
15537         CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
15538         LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
15539         CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
15540         LDKEffectiveCapacity_Total_class =
15541                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
15542         CHECK(LDKEffectiveCapacity_Total_class != NULL);
15543         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
15544         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
15545         LDKEffectiveCapacity_Infinite_class =
15546                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
15547         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
15548         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
15549         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
15550         LDKEffectiveCapacity_Unknown_class =
15551                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
15552         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
15553         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
15554         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
15555 }
15556 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15557         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
15558         switch(obj->tag) {
15559                 case LDKEffectiveCapacity_ExactLiquidity: {
15560                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
15561                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
15562                 }
15563                 case LDKEffectiveCapacity_MaximumHTLC: {
15564                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
15565                         return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
15566                 }
15567                 case LDKEffectiveCapacity_Total: {
15568                         int64_t capacity_msat_conv = obj->total.capacity_msat;
15569                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
15570                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
15571                 }
15572                 case LDKEffectiveCapacity_Infinite: {
15573                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
15574                 }
15575                 case LDKEffectiveCapacity_Unknown: {
15576                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
15577                 }
15578                 default: abort();
15579         }
15580 }
15581 static jclass LDKDestination_Node_class = NULL;
15582 static jmethodID LDKDestination_Node_meth = NULL;
15583 static jclass LDKDestination_BlindedPath_class = NULL;
15584 static jmethodID LDKDestination_BlindedPath_meth = NULL;
15585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
15586         LDKDestination_Node_class =
15587                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
15588         CHECK(LDKDestination_Node_class != NULL);
15589         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
15590         CHECK(LDKDestination_Node_meth != NULL);
15591         LDKDestination_BlindedPath_class =
15592                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
15593         CHECK(LDKDestination_BlindedPath_class != NULL);
15594         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
15595         CHECK(LDKDestination_BlindedPath_meth != NULL);
15596 }
15597 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15598         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
15599         switch(obj->tag) {
15600                 case LDKDestination_Node: {
15601                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
15602                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
15603                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
15604                 }
15605                 case LDKDestination_BlindedPath: {
15606                         LDKBlindedPath blinded_path_var = obj->blinded_path;
15607                         int64_t blinded_path_ref = 0;
15608                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
15609                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
15610                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
15611                 }
15612                 default: abort();
15613         }
15614 }
15615 static jclass LDKOnionMessageContents_Custom_class = NULL;
15616 static jmethodID LDKOnionMessageContents_Custom_meth = NULL;
15617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOnionMessageContents_init (JNIEnv *env, jclass clz) {
15618         LDKOnionMessageContents_Custom_class =
15619                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Custom"));
15620         CHECK(LDKOnionMessageContents_Custom_class != NULL);
15621         LDKOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Custom_class, "<init>", "(J)V");
15622         CHECK(LDKOnionMessageContents_Custom_meth != NULL);
15623 }
15624 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15625         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
15626         switch(obj->tag) {
15627                 case LDKOnionMessageContents_Custom: {
15628                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
15629                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
15630                         return (*env)->NewObject(env, LDKOnionMessageContents_Custom_class, LDKOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
15631                 }
15632                 default: abort();
15633         }
15634 }
15635 static jclass LDKGossipSync_P2P_class = NULL;
15636 static jmethodID LDKGossipSync_P2P_meth = NULL;
15637 static jclass LDKGossipSync_Rapid_class = NULL;
15638 static jmethodID LDKGossipSync_Rapid_meth = NULL;
15639 static jclass LDKGossipSync_None_class = NULL;
15640 static jmethodID LDKGossipSync_None_meth = NULL;
15641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
15642         LDKGossipSync_P2P_class =
15643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
15644         CHECK(LDKGossipSync_P2P_class != NULL);
15645         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
15646         CHECK(LDKGossipSync_P2P_meth != NULL);
15647         LDKGossipSync_Rapid_class =
15648                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
15649         CHECK(LDKGossipSync_Rapid_class != NULL);
15650         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
15651         CHECK(LDKGossipSync_Rapid_meth != NULL);
15652         LDKGossipSync_None_class =
15653                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
15654         CHECK(LDKGossipSync_None_class != NULL);
15655         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
15656         CHECK(LDKGossipSync_None_meth != NULL);
15657 }
15658 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15659         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
15660         switch(obj->tag) {
15661                 case LDKGossipSync_P2P: {
15662                         LDKP2PGossipSync p2p_var = obj->p2p;
15663                         int64_t p2p_ref = 0;
15664                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
15665                         p2p_ref = tag_ptr(p2p_var.inner, false);
15666                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
15667                 }
15668                 case LDKGossipSync_Rapid: {
15669                         LDKRapidGossipSync rapid_var = obj->rapid;
15670                         int64_t rapid_ref = 0;
15671                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
15672                         rapid_ref = tag_ptr(rapid_var.inner, false);
15673                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
15674                 }
15675                 case LDKGossipSync_None: {
15676                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
15677                 }
15678                 default: abort();
15679         }
15680 }
15681 static jclass LDKFallback_SegWitProgram_class = NULL;
15682 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
15683 static jclass LDKFallback_PubKeyHash_class = NULL;
15684 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
15685 static jclass LDKFallback_ScriptHash_class = NULL;
15686 static jmethodID LDKFallback_ScriptHash_meth = NULL;
15687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
15688         LDKFallback_SegWitProgram_class =
15689                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
15690         CHECK(LDKFallback_SegWitProgram_class != NULL);
15691         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
15692         CHECK(LDKFallback_SegWitProgram_meth != NULL);
15693         LDKFallback_PubKeyHash_class =
15694                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
15695         CHECK(LDKFallback_PubKeyHash_class != NULL);
15696         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
15697         CHECK(LDKFallback_PubKeyHash_meth != NULL);
15698         LDKFallback_ScriptHash_class =
15699                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
15700         CHECK(LDKFallback_ScriptHash_class != NULL);
15701         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
15702         CHECK(LDKFallback_ScriptHash_meth != NULL);
15703 }
15704 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15705         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
15706         switch(obj->tag) {
15707                 case LDKFallback_SegWitProgram: {
15708                         uint8_t version_val = obj->seg_wit_program.version._0;
15709                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
15710                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
15711                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
15712                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
15713                 }
15714                 case LDKFallback_PubKeyHash: {
15715                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
15716                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
15717                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
15718                 }
15719                 case LDKFallback_ScriptHash: {
15720                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
15721                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
15722                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
15723                 }
15724                 default: abort();
15725         }
15726 }
15727 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
15728         LDKStr ret_str = _ldk_get_compiled_version();
15729         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
15730         Str_free(ret_str);
15731         return ret_conv;
15732 }
15733
15734 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
15735         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
15736         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
15737         Str_free(ret_str);
15738         return ret_conv;
15739 }
15740
15741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
15742         LDKU128 val_ref;
15743         CHECK((*env)->GetArrayLength(env, val) == 16);
15744         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
15745         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
15746         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
15747         return ret_arr;
15748 }
15749
15750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
15751         LDKSixteenBytes le_bytes_ref;
15752         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
15753         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
15754         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
15755         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
15756         return ret_arr;
15757 }
15758
15759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
15760         LDKThirtyTwoBytes big_endian_bytes_ref;
15761         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
15762         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
15763         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
15764         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
15765         return tag_ptr(ret_ref, true);
15766 }
15767
15768 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
15769         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15770         *ret_copy = Bech32Error_clone(arg);
15771         int64_t ret_ref = tag_ptr(ret_copy, true);
15772         return ret_ref;
15773 }
15774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15775         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
15776         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
15777         return ret_conv;
15778 }
15779
15780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15781         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
15782         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15783         *ret_copy = Bech32Error_clone(orig_conv);
15784         int64_t ret_ref = tag_ptr(ret_copy, true);
15785         return ret_ref;
15786 }
15787
15788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
15789         if (!ptr_is_owned(o)) return;
15790         void* o_ptr = untag_ptr(o);
15791         CHECK_ACCESS(o_ptr);
15792         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
15793         FREE(untag_ptr(o));
15794         Bech32Error_free(o_conv);
15795 }
15796
15797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
15798         LDKTransaction _res_ref;
15799         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
15800         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
15801         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
15802         _res_ref.data_is_owned = true;
15803         Transaction_free(_res_ref);
15804 }
15805
15806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
15807         LDKWitness _res_ref;
15808         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
15809         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
15810         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
15811         _res_ref.data_is_owned = true;
15812         Witness_free(_res_ref);
15813 }
15814
15815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
15816         LDKCVec_u8Z script_pubkey_ref;
15817         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
15818         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
15819         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
15820         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15821         *ret_ref = TxOut_new(script_pubkey_ref, value);
15822         return tag_ptr(ret_ref, true);
15823 }
15824
15825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
15826         if (!ptr_is_owned(_res)) return;
15827         void* _res_ptr = untag_ptr(_res);
15828         CHECK_ACCESS(_res_ptr);
15829         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
15830         FREE(untag_ptr(_res));
15831         TxOut_free(_res_conv);
15832 }
15833
15834 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
15835         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15836         *ret_ref = TxOut_clone(arg);
15837         return tag_ptr(ret_ref, true);
15838 }
15839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15840         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
15841         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
15842         return ret_conv;
15843 }
15844
15845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15846         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
15847         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15848         *ret_ref = TxOut_clone(orig_conv);
15849         return tag_ptr(ret_ref, true);
15850 }
15851
15852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
15853         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
15854         Str_free(dummy);
15855 }
15856
15857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
15858         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15859         *ret_conv = CResult_NoneAPIErrorZ_ok();
15860         return tag_ptr(ret_conv, true);
15861 }
15862
15863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15864         void* e_ptr = untag_ptr(e);
15865         CHECK_ACCESS(e_ptr);
15866         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15867         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15868         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15869         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15870         return tag_ptr(ret_conv, true);
15871 }
15872
15873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15874         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15875         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15876         return ret_conv;
15877 }
15878
15879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15880         if (!ptr_is_owned(_res)) return;
15881         void* _res_ptr = untag_ptr(_res);
15882         CHECK_ACCESS(_res_ptr);
15883         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15884         FREE(untag_ptr(_res));
15885         CResult_NoneAPIErrorZ_free(_res_conv);
15886 }
15887
15888 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15889         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15890         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15891         return tag_ptr(ret_conv, true);
15892 }
15893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15894         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15895         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15896         return ret_conv;
15897 }
15898
15899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15900         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15901         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15902         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15903         return tag_ptr(ret_conv, true);
15904 }
15905
15906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15907         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15908         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15909         if (_res_constr.datalen > 0)
15910                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15911         else
15912                 _res_constr.data = NULL;
15913         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15914         for (size_t w = 0; w < _res_constr.datalen; w++) {
15915                 int64_t _res_conv_22 = _res_vals[w];
15916                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15917                 CHECK_ACCESS(_res_conv_22_ptr);
15918                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15919                 FREE(untag_ptr(_res_conv_22));
15920                 _res_constr.data[w] = _res_conv_22_conv;
15921         }
15922         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15923         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15924 }
15925
15926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15927         LDKCVec_APIErrorZ _res_constr;
15928         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15929         if (_res_constr.datalen > 0)
15930                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15931         else
15932                 _res_constr.data = NULL;
15933         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15934         for (size_t k = 0; k < _res_constr.datalen; k++) {
15935                 int64_t _res_conv_10 = _res_vals[k];
15936                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15937                 CHECK_ACCESS(_res_conv_10_ptr);
15938                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15939                 FREE(untag_ptr(_res_conv_10));
15940                 _res_constr.data[k] = _res_conv_10_conv;
15941         }
15942         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15943         CVec_APIErrorZ_free(_res_constr);
15944 }
15945
15946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
15947         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
15948         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
15949         *ret_copy = COption_HTLCClaimZ_some(o_conv);
15950         int64_t ret_ref = tag_ptr(ret_copy, true);
15951         return ret_ref;
15952 }
15953
15954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
15955         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
15956         *ret_copy = COption_HTLCClaimZ_none();
15957         int64_t ret_ref = tag_ptr(ret_copy, true);
15958         return ret_ref;
15959 }
15960
15961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15962         if (!ptr_is_owned(_res)) return;
15963         void* _res_ptr = untag_ptr(_res);
15964         CHECK_ACCESS(_res_ptr);
15965         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
15966         FREE(untag_ptr(_res));
15967         COption_HTLCClaimZ_free(_res_conv);
15968 }
15969
15970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
15971         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15972         *ret_conv = CResult_NoneNoneZ_ok();
15973         return tag_ptr(ret_conv, true);
15974 }
15975
15976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
15977         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15978         *ret_conv = CResult_NoneNoneZ_err();
15979         return tag_ptr(ret_conv, true);
15980 }
15981
15982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15983         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
15984         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
15985         return ret_conv;
15986 }
15987
15988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15989         if (!ptr_is_owned(_res)) return;
15990         void* _res_ptr = untag_ptr(_res);
15991         CHECK_ACCESS(_res_ptr);
15992         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
15993         FREE(untag_ptr(_res));
15994         CResult_NoneNoneZ_free(_res_conv);
15995 }
15996
15997 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
15998         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15999         *ret_conv = CResult_NoneNoneZ_clone(arg);
16000         return tag_ptr(ret_conv, true);
16001 }
16002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16003         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
16004         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
16005         return ret_conv;
16006 }
16007
16008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16009         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
16010         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16011         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
16012         return tag_ptr(ret_conv, true);
16013 }
16014
16015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16016         LDKCounterpartyCommitmentSecrets o_conv;
16017         o_conv.inner = untag_ptr(o);
16018         o_conv.is_owned = ptr_is_owned(o);
16019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16020         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
16021         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
16022         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
16023         return tag_ptr(ret_conv, true);
16024 }
16025
16026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16027         void* e_ptr = untag_ptr(e);
16028         CHECK_ACCESS(e_ptr);
16029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16031         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
16032         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
16033         return tag_ptr(ret_conv, true);
16034 }
16035
16036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16037         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
16038         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
16039         return ret_conv;
16040 }
16041
16042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16043         if (!ptr_is_owned(_res)) return;
16044         void* _res_ptr = untag_ptr(_res);
16045         CHECK_ACCESS(_res_ptr);
16046         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
16047         FREE(untag_ptr(_res));
16048         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
16049 }
16050
16051 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
16052         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
16053         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
16054         return tag_ptr(ret_conv, true);
16055 }
16056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16057         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
16058         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
16059         return ret_conv;
16060 }
16061
16062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16063         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
16064         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
16065         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
16066         return tag_ptr(ret_conv, true);
16067 }
16068
16069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16070         LDKTxCreationKeys o_conv;
16071         o_conv.inner = untag_ptr(o);
16072         o_conv.is_owned = ptr_is_owned(o);
16073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16074         o_conv = TxCreationKeys_clone(&o_conv);
16075         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
16076         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
16077         return tag_ptr(ret_conv, true);
16078 }
16079
16080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16081         void* e_ptr = untag_ptr(e);
16082         CHECK_ACCESS(e_ptr);
16083         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16084         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16085         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
16086         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
16087         return tag_ptr(ret_conv, true);
16088 }
16089
16090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16091         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
16092         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
16093         return ret_conv;
16094 }
16095
16096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16097         if (!ptr_is_owned(_res)) return;
16098         void* _res_ptr = untag_ptr(_res);
16099         CHECK_ACCESS(_res_ptr);
16100         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
16101         FREE(untag_ptr(_res));
16102         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
16103 }
16104
16105 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
16106         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
16107         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
16108         return tag_ptr(ret_conv, true);
16109 }
16110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16111         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
16112         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
16113         return ret_conv;
16114 }
16115
16116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16117         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
16118         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
16119         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
16120         return tag_ptr(ret_conv, true);
16121 }
16122
16123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16124         LDKChannelPublicKeys o_conv;
16125         o_conv.inner = untag_ptr(o);
16126         o_conv.is_owned = ptr_is_owned(o);
16127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16128         o_conv = ChannelPublicKeys_clone(&o_conv);
16129         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16130         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
16131         return tag_ptr(ret_conv, true);
16132 }
16133
16134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16135         void* e_ptr = untag_ptr(e);
16136         CHECK_ACCESS(e_ptr);
16137         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16138         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16139         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16140         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
16141         return tag_ptr(ret_conv, true);
16142 }
16143
16144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16145         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
16146         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
16147         return ret_conv;
16148 }
16149
16150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16151         if (!ptr_is_owned(_res)) return;
16152         void* _res_ptr = untag_ptr(_res);
16153         CHECK_ACCESS(_res_ptr);
16154         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
16155         FREE(untag_ptr(_res));
16156         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
16157 }
16158
16159 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
16160         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16161         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
16162         return tag_ptr(ret_conv, true);
16163 }
16164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16165         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
16166         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
16167         return ret_conv;
16168 }
16169
16170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16171         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
16172         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16173         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
16174         return tag_ptr(ret_conv, true);
16175 }
16176
16177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
16178         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16179         *ret_copy = COption_u32Z_some(o);
16180         int64_t ret_ref = tag_ptr(ret_copy, true);
16181         return ret_ref;
16182 }
16183
16184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
16185         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16186         *ret_copy = COption_u32Z_none();
16187         int64_t ret_ref = tag_ptr(ret_copy, true);
16188         return ret_ref;
16189 }
16190
16191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16192         if (!ptr_is_owned(_res)) return;
16193         void* _res_ptr = untag_ptr(_res);
16194         CHECK_ACCESS(_res_ptr);
16195         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
16196         FREE(untag_ptr(_res));
16197         COption_u32Z_free(_res_conv);
16198 }
16199
16200 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
16201         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16202         *ret_copy = COption_u32Z_clone(arg);
16203         int64_t ret_ref = tag_ptr(ret_copy, true);
16204         return ret_ref;
16205 }
16206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16207         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
16208         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
16209         return ret_conv;
16210 }
16211
16212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16213         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
16214         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16215         *ret_copy = COption_u32Z_clone(orig_conv);
16216         int64_t ret_ref = tag_ptr(ret_copy, true);
16217         return ret_ref;
16218 }
16219
16220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16221         LDKHTLCOutputInCommitment o_conv;
16222         o_conv.inner = untag_ptr(o);
16223         o_conv.is_owned = ptr_is_owned(o);
16224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16225         o_conv = HTLCOutputInCommitment_clone(&o_conv);
16226         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16227         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
16228         return tag_ptr(ret_conv, true);
16229 }
16230
16231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16232         void* e_ptr = untag_ptr(e);
16233         CHECK_ACCESS(e_ptr);
16234         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16235         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16236         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16237         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
16238         return tag_ptr(ret_conv, true);
16239 }
16240
16241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16242         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
16243         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
16244         return ret_conv;
16245 }
16246
16247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16248         if (!ptr_is_owned(_res)) return;
16249         void* _res_ptr = untag_ptr(_res);
16250         CHECK_ACCESS(_res_ptr);
16251         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
16252         FREE(untag_ptr(_res));
16253         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
16254 }
16255
16256 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
16257         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16258         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
16259         return tag_ptr(ret_conv, true);
16260 }
16261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16262         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
16263         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
16264         return ret_conv;
16265 }
16266
16267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16268         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
16269         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16270         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
16271         return tag_ptr(ret_conv, true);
16272 }
16273
16274 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
16275         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
16276         return ret_conv;
16277 }
16278
16279 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
16280         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
16281         return ret_conv;
16282 }
16283
16284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
16285         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
16286         COption_NoneZ_free(_res_conv);
16287 }
16288
16289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16290         LDKCounterpartyChannelTransactionParameters o_conv;
16291         o_conv.inner = untag_ptr(o);
16292         o_conv.is_owned = ptr_is_owned(o);
16293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16294         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
16295         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16296         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
16297         return tag_ptr(ret_conv, true);
16298 }
16299
16300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16301         void* e_ptr = untag_ptr(e);
16302         CHECK_ACCESS(e_ptr);
16303         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16304         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16305         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16306         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
16307         return tag_ptr(ret_conv, true);
16308 }
16309
16310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16311         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
16312         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
16313         return ret_conv;
16314 }
16315
16316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16317         if (!ptr_is_owned(_res)) return;
16318         void* _res_ptr = untag_ptr(_res);
16319         CHECK_ACCESS(_res_ptr);
16320         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
16321         FREE(untag_ptr(_res));
16322         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
16323 }
16324
16325 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
16326         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16327         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
16328         return tag_ptr(ret_conv, true);
16329 }
16330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16331         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
16332         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
16333         return ret_conv;
16334 }
16335
16336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16337         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
16338         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
16339         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
16340         return tag_ptr(ret_conv, true);
16341 }
16342
16343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16344         LDKChannelTransactionParameters o_conv;
16345         o_conv.inner = untag_ptr(o);
16346         o_conv.is_owned = ptr_is_owned(o);
16347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16348         o_conv = ChannelTransactionParameters_clone(&o_conv);
16349         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16350         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
16351         return tag_ptr(ret_conv, true);
16352 }
16353
16354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16355         void* e_ptr = untag_ptr(e);
16356         CHECK_ACCESS(e_ptr);
16357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16359         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16360         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
16361         return tag_ptr(ret_conv, true);
16362 }
16363
16364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16365         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
16366         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
16367         return ret_conv;
16368 }
16369
16370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16371         if (!ptr_is_owned(_res)) return;
16372         void* _res_ptr = untag_ptr(_res);
16373         CHECK_ACCESS(_res_ptr);
16374         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
16375         FREE(untag_ptr(_res));
16376         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
16377 }
16378
16379 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
16380         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16381         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
16382         return tag_ptr(ret_conv, true);
16383 }
16384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16385         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
16386         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
16387         return ret_conv;
16388 }
16389
16390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16391         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
16392         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
16393         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
16394         return tag_ptr(ret_conv, true);
16395 }
16396
16397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16398         LDKCVec_SignatureZ _res_constr;
16399         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16400         if (_res_constr.datalen > 0)
16401                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16402         else
16403                 _res_constr.data = NULL;
16404         for (size_t i = 0; i < _res_constr.datalen; i++) {
16405                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16406                 LDKSignature _res_conv_8_ref;
16407                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
16408                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
16409                 _res_constr.data[i] = _res_conv_8_ref;
16410         }
16411         CVec_SignatureZ_free(_res_constr);
16412 }
16413
16414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16415         LDKHolderCommitmentTransaction o_conv;
16416         o_conv.inner = untag_ptr(o);
16417         o_conv.is_owned = ptr_is_owned(o);
16418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16419         o_conv = HolderCommitmentTransaction_clone(&o_conv);
16420         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
16421         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
16422         return tag_ptr(ret_conv, true);
16423 }
16424
16425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16426         void* e_ptr = untag_ptr(e);
16427         CHECK_ACCESS(e_ptr);
16428         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16429         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16430         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
16431         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
16432         return tag_ptr(ret_conv, true);
16433 }
16434
16435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16436         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
16437         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
16438         return ret_conv;
16439 }
16440
16441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16442         if (!ptr_is_owned(_res)) return;
16443         void* _res_ptr = untag_ptr(_res);
16444         CHECK_ACCESS(_res_ptr);
16445         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
16446         FREE(untag_ptr(_res));
16447         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
16448 }
16449
16450 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
16451         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
16452         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
16453         return tag_ptr(ret_conv, true);
16454 }
16455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16456         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
16457         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
16458         return ret_conv;
16459 }
16460
16461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16462         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
16463         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
16464         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
16465         return tag_ptr(ret_conv, true);
16466 }
16467
16468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16469         LDKBuiltCommitmentTransaction o_conv;
16470         o_conv.inner = untag_ptr(o);
16471         o_conv.is_owned = ptr_is_owned(o);
16472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16473         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
16474         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
16475         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
16476         return tag_ptr(ret_conv, true);
16477 }
16478
16479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16480         void* e_ptr = untag_ptr(e);
16481         CHECK_ACCESS(e_ptr);
16482         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16483         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16484         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
16485         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
16486         return tag_ptr(ret_conv, true);
16487 }
16488
16489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16490         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
16491         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
16492         return ret_conv;
16493 }
16494
16495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16496         if (!ptr_is_owned(_res)) return;
16497         void* _res_ptr = untag_ptr(_res);
16498         CHECK_ACCESS(_res_ptr);
16499         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
16500         FREE(untag_ptr(_res));
16501         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
16502 }
16503
16504 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
16505         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
16506         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
16507         return tag_ptr(ret_conv, true);
16508 }
16509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16510         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
16511         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
16512         return ret_conv;
16513 }
16514
16515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16516         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
16517         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
16518         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
16519         return tag_ptr(ret_conv, true);
16520 }
16521
16522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16523         LDKTrustedClosingTransaction o_conv;
16524         o_conv.inner = untag_ptr(o);
16525         o_conv.is_owned = ptr_is_owned(o);
16526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16527         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
16528         
16529         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
16530         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
16531         return tag_ptr(ret_conv, true);
16532 }
16533
16534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
16535         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
16536         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
16537         return tag_ptr(ret_conv, true);
16538 }
16539
16540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16541         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
16542         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
16543         return ret_conv;
16544 }
16545
16546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16547         if (!ptr_is_owned(_res)) return;
16548         void* _res_ptr = untag_ptr(_res);
16549         CHECK_ACCESS(_res_ptr);
16550         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
16551         FREE(untag_ptr(_res));
16552         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
16553 }
16554
16555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16556         LDKCommitmentTransaction o_conv;
16557         o_conv.inner = untag_ptr(o);
16558         o_conv.is_owned = ptr_is_owned(o);
16559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16560         o_conv = CommitmentTransaction_clone(&o_conv);
16561         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16562         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
16563         return tag_ptr(ret_conv, true);
16564 }
16565
16566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16567         void* e_ptr = untag_ptr(e);
16568         CHECK_ACCESS(e_ptr);
16569         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16570         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16571         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16572         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
16573         return tag_ptr(ret_conv, true);
16574 }
16575
16576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16577         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
16578         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
16579         return ret_conv;
16580 }
16581
16582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16583         if (!ptr_is_owned(_res)) return;
16584         void* _res_ptr = untag_ptr(_res);
16585         CHECK_ACCESS(_res_ptr);
16586         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
16587         FREE(untag_ptr(_res));
16588         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
16589 }
16590
16591 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
16592         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16593         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
16594         return tag_ptr(ret_conv, true);
16595 }
16596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16597         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
16598         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
16599         return ret_conv;
16600 }
16601
16602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16603         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
16604         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16605         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
16606         return tag_ptr(ret_conv, true);
16607 }
16608
16609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16610         LDKTrustedCommitmentTransaction o_conv;
16611         o_conv.inner = untag_ptr(o);
16612         o_conv.is_owned = ptr_is_owned(o);
16613         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16614         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
16615         
16616         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
16617         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
16618         return tag_ptr(ret_conv, true);
16619 }
16620
16621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
16622         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
16623         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
16624         return tag_ptr(ret_conv, true);
16625 }
16626
16627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16628         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
16629         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
16630         return ret_conv;
16631 }
16632
16633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16634         if (!ptr_is_owned(_res)) return;
16635         void* _res_ptr = untag_ptr(_res);
16636         CHECK_ACCESS(_res_ptr);
16637         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
16638         FREE(untag_ptr(_res));
16639         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
16640 }
16641
16642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
16643         LDKCVec_SignatureZ o_constr;
16644         o_constr.datalen = (*env)->GetArrayLength(env, o);
16645         if (o_constr.datalen > 0)
16646                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16647         else
16648                 o_constr.data = NULL;
16649         for (size_t i = 0; i < o_constr.datalen; i++) {
16650                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
16651                 LDKSignature o_conv_8_ref;
16652                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
16653                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
16654                 o_constr.data[i] = o_conv_8_ref;
16655         }
16656         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16657         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
16658         return tag_ptr(ret_conv, true);
16659 }
16660
16661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
16662         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16663         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
16664         return tag_ptr(ret_conv, true);
16665 }
16666
16667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16668         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
16669         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
16670         return ret_conv;
16671 }
16672
16673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16674         if (!ptr_is_owned(_res)) return;
16675         void* _res_ptr = untag_ptr(_res);
16676         CHECK_ACCESS(_res_ptr);
16677         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
16678         FREE(untag_ptr(_res));
16679         CResult_CVec_SignatureZNoneZ_free(_res_conv);
16680 }
16681
16682 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
16683         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16684         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
16685         return tag_ptr(ret_conv, true);
16686 }
16687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16688         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
16689         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
16690         return ret_conv;
16691 }
16692
16693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16694         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
16695         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16696         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
16697         return tag_ptr(ret_conv, true);
16698 }
16699
16700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16701         LDKShutdownScript o_conv;
16702         o_conv.inner = untag_ptr(o);
16703         o_conv.is_owned = ptr_is_owned(o);
16704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16705         o_conv = ShutdownScript_clone(&o_conv);
16706         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16707         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
16708         return tag_ptr(ret_conv, true);
16709 }
16710
16711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16712         void* e_ptr = untag_ptr(e);
16713         CHECK_ACCESS(e_ptr);
16714         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16715         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16716         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16717         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
16718         return tag_ptr(ret_conv, true);
16719 }
16720
16721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16722         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
16723         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
16724         return ret_conv;
16725 }
16726
16727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16728         if (!ptr_is_owned(_res)) return;
16729         void* _res_ptr = untag_ptr(_res);
16730         CHECK_ACCESS(_res_ptr);
16731         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
16732         FREE(untag_ptr(_res));
16733         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
16734 }
16735
16736 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
16737         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16738         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
16739         return tag_ptr(ret_conv, true);
16740 }
16741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16742         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
16743         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
16744         return ret_conv;
16745 }
16746
16747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16748         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
16749         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16750         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
16751         return tag_ptr(ret_conv, true);
16752 }
16753
16754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16755         LDKShutdownScript o_conv;
16756         o_conv.inner = untag_ptr(o);
16757         o_conv.is_owned = ptr_is_owned(o);
16758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16759         o_conv = ShutdownScript_clone(&o_conv);
16760         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16761         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
16762         return tag_ptr(ret_conv, true);
16763 }
16764
16765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16766         LDKInvalidShutdownScript e_conv;
16767         e_conv.inner = untag_ptr(e);
16768         e_conv.is_owned = ptr_is_owned(e);
16769         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16770         e_conv = InvalidShutdownScript_clone(&e_conv);
16771         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16772         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
16773         return tag_ptr(ret_conv, true);
16774 }
16775
16776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16777         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
16778         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
16779         return ret_conv;
16780 }
16781
16782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16783         if (!ptr_is_owned(_res)) return;
16784         void* _res_ptr = untag_ptr(_res);
16785         CHECK_ACCESS(_res_ptr);
16786         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
16787         FREE(untag_ptr(_res));
16788         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
16789 }
16790
16791 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
16792         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16793         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
16794         return tag_ptr(ret_conv, true);
16795 }
16796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16797         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
16798         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
16799         return ret_conv;
16800 }
16801
16802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16803         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
16804         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16805         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
16806         return tag_ptr(ret_conv, true);
16807 }
16808
16809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16810         LDKCVec_PublicKeyZ _res_constr;
16811         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16812         if (_res_constr.datalen > 0)
16813                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
16814         else
16815                 _res_constr.data = NULL;
16816         for (size_t i = 0; i < _res_constr.datalen; i++) {
16817                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16818                 LDKPublicKey _res_conv_8_ref;
16819                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
16820                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
16821                 _res_constr.data[i] = _res_conv_8_ref;
16822         }
16823         CVec_PublicKeyZ_free(_res_constr);
16824 }
16825
16826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16827         LDKBlindedPath o_conv;
16828         o_conv.inner = untag_ptr(o);
16829         o_conv.is_owned = ptr_is_owned(o);
16830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16831         o_conv = BlindedPath_clone(&o_conv);
16832         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
16833         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
16834         return tag_ptr(ret_conv, true);
16835 }
16836
16837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
16838         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
16839         *ret_conv = CResult_BlindedPathNoneZ_err();
16840         return tag_ptr(ret_conv, true);
16841 }
16842
16843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16844         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
16845         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
16846         return ret_conv;
16847 }
16848
16849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16850         if (!ptr_is_owned(_res)) return;
16851         void* _res_ptr = untag_ptr(_res);
16852         CHECK_ACCESS(_res_ptr);
16853         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
16854         FREE(untag_ptr(_res));
16855         CResult_BlindedPathNoneZ_free(_res_conv);
16856 }
16857
16858 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
16859         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
16860         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
16861         return tag_ptr(ret_conv, true);
16862 }
16863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16864         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
16865         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
16866         return ret_conv;
16867 }
16868
16869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16870         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
16871         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
16872         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
16873         return tag_ptr(ret_conv, true);
16874 }
16875
16876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16877         LDKBlindedPath o_conv;
16878         o_conv.inner = untag_ptr(o);
16879         o_conv.is_owned = ptr_is_owned(o);
16880         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16881         o_conv = BlindedPath_clone(&o_conv);
16882         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
16883         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
16884         return tag_ptr(ret_conv, true);
16885 }
16886
16887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16888         void* e_ptr = untag_ptr(e);
16889         CHECK_ACCESS(e_ptr);
16890         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16891         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16892         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
16893         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
16894         return tag_ptr(ret_conv, true);
16895 }
16896
16897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16898         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
16899         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
16900         return ret_conv;
16901 }
16902
16903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16904         if (!ptr_is_owned(_res)) return;
16905         void* _res_ptr = untag_ptr(_res);
16906         CHECK_ACCESS(_res_ptr);
16907         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
16908         FREE(untag_ptr(_res));
16909         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
16910 }
16911
16912 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
16913         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
16914         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
16915         return tag_ptr(ret_conv, true);
16916 }
16917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16918         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
16919         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
16920         return ret_conv;
16921 }
16922
16923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16924         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
16925         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
16926         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
16927         return tag_ptr(ret_conv, true);
16928 }
16929
16930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16931         LDKBlindedHop o_conv;
16932         o_conv.inner = untag_ptr(o);
16933         o_conv.is_owned = ptr_is_owned(o);
16934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16935         o_conv = BlindedHop_clone(&o_conv);
16936         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
16937         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
16938         return tag_ptr(ret_conv, true);
16939 }
16940
16941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16942         void* e_ptr = untag_ptr(e);
16943         CHECK_ACCESS(e_ptr);
16944         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16945         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16946         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
16947         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
16948         return tag_ptr(ret_conv, true);
16949 }
16950
16951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16952         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
16953         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
16954         return ret_conv;
16955 }
16956
16957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16958         if (!ptr_is_owned(_res)) return;
16959         void* _res_ptr = untag_ptr(_res);
16960         CHECK_ACCESS(_res_ptr);
16961         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
16962         FREE(untag_ptr(_res));
16963         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
16964 }
16965
16966 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
16967         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
16968         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
16969         return tag_ptr(ret_conv, true);
16970 }
16971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16972         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
16973         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
16974         return ret_conv;
16975 }
16976
16977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16978         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
16979         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
16980         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
16981         return tag_ptr(ret_conv, true);
16982 }
16983
16984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16985         void* o_ptr = untag_ptr(o);
16986         CHECK_ACCESS(o_ptr);
16987         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
16988         if (o_conv.free == LDKWriteableScore_JCalls_free) {
16989                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16990                 LDKWriteableScore_JCalls_cloned(&o_conv);
16991         }
16992         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
16993         *ret_copy = COption_WriteableScoreZ_some(o_conv);
16994         int64_t ret_ref = tag_ptr(ret_copy, true);
16995         return ret_ref;
16996 }
16997
16998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
16999         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
17000         *ret_copy = COption_WriteableScoreZ_none();
17001         int64_t ret_ref = tag_ptr(ret_copy, true);
17002         return ret_ref;
17003 }
17004
17005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17006         if (!ptr_is_owned(_res)) return;
17007         void* _res_ptr = untag_ptr(_res);
17008         CHECK_ACCESS(_res_ptr);
17009         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
17010         FREE(untag_ptr(_res));
17011         COption_WriteableScoreZ_free(_res_conv);
17012 }
17013
17014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
17015         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17016         *ret_conv = CResult_NoneErrorZ_ok();
17017         return tag_ptr(ret_conv, true);
17018 }
17019
17020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17021         LDKIOError e_conv = LDKIOError_from_java(env, e);
17022         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17023         *ret_conv = CResult_NoneErrorZ_err(e_conv);
17024         return tag_ptr(ret_conv, true);
17025 }
17026
17027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17028         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
17029         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
17030         return ret_conv;
17031 }
17032
17033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17034         if (!ptr_is_owned(_res)) return;
17035         void* _res_ptr = untag_ptr(_res);
17036         CHECK_ACCESS(_res_ptr);
17037         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
17038         FREE(untag_ptr(_res));
17039         CResult_NoneErrorZ_free(_res_conv);
17040 }
17041
17042 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
17043         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17044         *ret_conv = CResult_NoneErrorZ_clone(arg);
17045         return tag_ptr(ret_conv, true);
17046 }
17047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17048         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
17049         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
17050         return ret_conv;
17051 }
17052
17053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17054         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
17055         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
17056         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
17057         return tag_ptr(ret_conv, true);
17058 }
17059
17060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17061         LDKCVec_ChannelDetailsZ _res_constr;
17062         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17063         if (_res_constr.datalen > 0)
17064                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17065         else
17066                 _res_constr.data = NULL;
17067         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17068         for (size_t q = 0; q < _res_constr.datalen; q++) {
17069                 int64_t _res_conv_16 = _res_vals[q];
17070                 LDKChannelDetails _res_conv_16_conv;
17071                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17072                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17073                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17074                 _res_constr.data[q] = _res_conv_16_conv;
17075         }
17076         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17077         CVec_ChannelDetailsZ_free(_res_constr);
17078 }
17079
17080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17081         LDKRoute o_conv;
17082         o_conv.inner = untag_ptr(o);
17083         o_conv.is_owned = ptr_is_owned(o);
17084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17085         o_conv = Route_clone(&o_conv);
17086         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17087         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
17088         return tag_ptr(ret_conv, true);
17089 }
17090
17091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17092         LDKLightningError e_conv;
17093         e_conv.inner = untag_ptr(e);
17094         e_conv.is_owned = ptr_is_owned(e);
17095         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17096         e_conv = LightningError_clone(&e_conv);
17097         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17098         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
17099         return tag_ptr(ret_conv, true);
17100 }
17101
17102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17103         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
17104         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
17105         return ret_conv;
17106 }
17107
17108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17109         if (!ptr_is_owned(_res)) return;
17110         void* _res_ptr = untag_ptr(_res);
17111         CHECK_ACCESS(_res_ptr);
17112         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
17113         FREE(untag_ptr(_res));
17114         CResult_RouteLightningErrorZ_free(_res_conv);
17115 }
17116
17117 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
17118         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17119         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
17120         return tag_ptr(ret_conv, true);
17121 }
17122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17123         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
17124         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
17125         return ret_conv;
17126 }
17127
17128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17129         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
17130         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
17131         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
17132         return tag_ptr(ret_conv, true);
17133 }
17134
17135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17136         LDKCVec_RouteHopZ _res_constr;
17137         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17138         if (_res_constr.datalen > 0)
17139                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17140         else
17141                 _res_constr.data = NULL;
17142         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17143         for (size_t k = 0; k < _res_constr.datalen; k++) {
17144                 int64_t _res_conv_10 = _res_vals[k];
17145                 LDKRouteHop _res_conv_10_conv;
17146                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
17147                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
17148                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
17149                 _res_constr.data[k] = _res_conv_10_conv;
17150         }
17151         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17152         CVec_RouteHopZ_free(_res_constr);
17153 }
17154
17155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
17156         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
17157         *ret_copy = COption_u64Z_some(o);
17158         int64_t ret_ref = tag_ptr(ret_copy, true);
17159         return ret_ref;
17160 }
17161
17162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
17163         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
17164         *ret_copy = COption_u64Z_none();
17165         int64_t ret_ref = tag_ptr(ret_copy, true);
17166         return ret_ref;
17167 }
17168
17169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17170         if (!ptr_is_owned(_res)) return;
17171         void* _res_ptr = untag_ptr(_res);
17172         CHECK_ACCESS(_res_ptr);
17173         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
17174         FREE(untag_ptr(_res));
17175         COption_u64Z_free(_res_conv);
17176 }
17177
17178 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
17179         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
17180         *ret_copy = COption_u64Z_clone(arg);
17181         int64_t ret_ref = tag_ptr(ret_copy, true);
17182         return ret_ref;
17183 }
17184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17185         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
17186         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
17187         return ret_conv;
17188 }
17189
17190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17191         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
17192         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
17193         *ret_copy = COption_u64Z_clone(orig_conv);
17194         int64_t ret_ref = tag_ptr(ret_copy, true);
17195         return ret_ref;
17196 }
17197
17198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17199         LDKInFlightHtlcs o_conv;
17200         o_conv.inner = untag_ptr(o);
17201         o_conv.is_owned = ptr_is_owned(o);
17202         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17203         o_conv = InFlightHtlcs_clone(&o_conv);
17204         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17205         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
17206         return tag_ptr(ret_conv, true);
17207 }
17208
17209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17210         void* e_ptr = untag_ptr(e);
17211         CHECK_ACCESS(e_ptr);
17212         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17213         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17214         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17215         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
17216         return tag_ptr(ret_conv, true);
17217 }
17218
17219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17220         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
17221         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
17222         return ret_conv;
17223 }
17224
17225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17226         if (!ptr_is_owned(_res)) return;
17227         void* _res_ptr = untag_ptr(_res);
17228         CHECK_ACCESS(_res_ptr);
17229         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17230         FREE(untag_ptr(_res));
17231         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17232 }
17233
17234 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
17235         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17236         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
17237         return tag_ptr(ret_conv, true);
17238 }
17239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17240         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
17241         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
17242         return ret_conv;
17243 }
17244
17245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17246         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
17247         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17248         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
17249         return tag_ptr(ret_conv, true);
17250 }
17251
17252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17253         LDKRouteHop o_conv;
17254         o_conv.inner = untag_ptr(o);
17255         o_conv.is_owned = ptr_is_owned(o);
17256         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17257         o_conv = RouteHop_clone(&o_conv);
17258         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17259         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
17260         return tag_ptr(ret_conv, true);
17261 }
17262
17263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17264         void* e_ptr = untag_ptr(e);
17265         CHECK_ACCESS(e_ptr);
17266         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17267         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17268         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17269         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
17270         return tag_ptr(ret_conv, true);
17271 }
17272
17273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17274         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
17275         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
17276         return ret_conv;
17277 }
17278
17279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17280         if (!ptr_is_owned(_res)) return;
17281         void* _res_ptr = untag_ptr(_res);
17282         CHECK_ACCESS(_res_ptr);
17283         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
17284         FREE(untag_ptr(_res));
17285         CResult_RouteHopDecodeErrorZ_free(_res_conv);
17286 }
17287
17288 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
17289         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17290         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
17291         return tag_ptr(ret_conv, true);
17292 }
17293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17294         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
17295         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
17296         return ret_conv;
17297 }
17298
17299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17300         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
17301         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17302         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
17303         return tag_ptr(ret_conv, true);
17304 }
17305
17306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17307         LDKCVec_CVec_RouteHopZZ _res_constr;
17308         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17309         if (_res_constr.datalen > 0)
17310                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
17311         else
17312                 _res_constr.data = NULL;
17313         for (size_t m = 0; m < _res_constr.datalen; m++) {
17314                 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
17315                 LDKCVec_RouteHopZ _res_conv_12_constr;
17316                 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
17317                 if (_res_conv_12_constr.datalen > 0)
17318                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17319                 else
17320                         _res_conv_12_constr.data = NULL;
17321                 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
17322                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
17323                         int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
17324                         LDKRouteHop _res_conv_12_conv_10_conv;
17325                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
17326                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
17327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
17328                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
17329                 }
17330                 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
17331                 _res_constr.data[m] = _res_conv_12_constr;
17332         }
17333         CVec_CVec_RouteHopZZ_free(_res_constr);
17334 }
17335
17336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17337         LDKRoute o_conv;
17338         o_conv.inner = untag_ptr(o);
17339         o_conv.is_owned = ptr_is_owned(o);
17340         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17341         o_conv = Route_clone(&o_conv);
17342         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17343         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
17344         return tag_ptr(ret_conv, true);
17345 }
17346
17347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17348         void* e_ptr = untag_ptr(e);
17349         CHECK_ACCESS(e_ptr);
17350         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17351         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17352         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17353         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
17354         return tag_ptr(ret_conv, true);
17355 }
17356
17357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17358         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
17359         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
17360         return ret_conv;
17361 }
17362
17363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17364         if (!ptr_is_owned(_res)) return;
17365         void* _res_ptr = untag_ptr(_res);
17366         CHECK_ACCESS(_res_ptr);
17367         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
17368         FREE(untag_ptr(_res));
17369         CResult_RouteDecodeErrorZ_free(_res_conv);
17370 }
17371
17372 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
17373         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17374         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
17375         return tag_ptr(ret_conv, true);
17376 }
17377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17378         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
17379         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
17380         return ret_conv;
17381 }
17382
17383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17384         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
17385         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17386         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
17387         return tag_ptr(ret_conv, true);
17388 }
17389
17390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17391         LDKRouteParameters o_conv;
17392         o_conv.inner = untag_ptr(o);
17393         o_conv.is_owned = ptr_is_owned(o);
17394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17395         o_conv = RouteParameters_clone(&o_conv);
17396         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17397         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
17398         return tag_ptr(ret_conv, true);
17399 }
17400
17401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17402         void* e_ptr = untag_ptr(e);
17403         CHECK_ACCESS(e_ptr);
17404         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17405         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17406         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17407         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
17408         return tag_ptr(ret_conv, true);
17409 }
17410
17411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17412         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
17413         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
17414         return ret_conv;
17415 }
17416
17417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17418         if (!ptr_is_owned(_res)) return;
17419         void* _res_ptr = untag_ptr(_res);
17420         CHECK_ACCESS(_res_ptr);
17421         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
17422         FREE(untag_ptr(_res));
17423         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
17424 }
17425
17426 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
17427         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17428         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
17429         return tag_ptr(ret_conv, true);
17430 }
17431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17432         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
17433         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
17434         return ret_conv;
17435 }
17436
17437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17438         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
17439         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17440         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
17441         return tag_ptr(ret_conv, true);
17442 }
17443
17444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17445         LDKCVec_RouteHintZ _res_constr;
17446         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17447         if (_res_constr.datalen > 0)
17448                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17449         else
17450                 _res_constr.data = NULL;
17451         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17452         for (size_t l = 0; l < _res_constr.datalen; l++) {
17453                 int64_t _res_conv_11 = _res_vals[l];
17454                 LDKRouteHint _res_conv_11_conv;
17455                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
17456                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
17457                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
17458                 _res_constr.data[l] = _res_conv_11_conv;
17459         }
17460         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17461         CVec_RouteHintZ_free(_res_constr);
17462 }
17463
17464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17465         LDKCVec_u64Z _res_constr;
17466         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17467         if (_res_constr.datalen > 0)
17468                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17469         else
17470                 _res_constr.data = NULL;
17471         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17472         for (size_t g = 0; g < _res_constr.datalen; g++) {
17473                 int64_t _res_conv_6 = _res_vals[g];
17474                 _res_constr.data[g] = _res_conv_6;
17475         }
17476         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17477         CVec_u64Z_free(_res_constr);
17478 }
17479
17480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17481         LDKPaymentParameters o_conv;
17482         o_conv.inner = untag_ptr(o);
17483         o_conv.is_owned = ptr_is_owned(o);
17484         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17485         o_conv = PaymentParameters_clone(&o_conv);
17486         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17487         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
17488         return tag_ptr(ret_conv, true);
17489 }
17490
17491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17492         void* e_ptr = untag_ptr(e);
17493         CHECK_ACCESS(e_ptr);
17494         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17495         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17496         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17497         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
17498         return tag_ptr(ret_conv, true);
17499 }
17500
17501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17502         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
17503         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
17504         return ret_conv;
17505 }
17506
17507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17508         if (!ptr_is_owned(_res)) return;
17509         void* _res_ptr = untag_ptr(_res);
17510         CHECK_ACCESS(_res_ptr);
17511         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
17512         FREE(untag_ptr(_res));
17513         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
17514 }
17515
17516 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
17517         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17518         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
17519         return tag_ptr(ret_conv, true);
17520 }
17521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17522         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
17523         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
17524         return ret_conv;
17525 }
17526
17527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17528         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
17529         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17530         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
17531         return tag_ptr(ret_conv, true);
17532 }
17533
17534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17535         LDKCVec_RouteHintHopZ _res_constr;
17536         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17537         if (_res_constr.datalen > 0)
17538                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
17539         else
17540                 _res_constr.data = NULL;
17541         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17542         for (size_t o = 0; o < _res_constr.datalen; o++) {
17543                 int64_t _res_conv_14 = _res_vals[o];
17544                 LDKRouteHintHop _res_conv_14_conv;
17545                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17546                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17547                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17548                 _res_constr.data[o] = _res_conv_14_conv;
17549         }
17550         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17551         CVec_RouteHintHopZ_free(_res_constr);
17552 }
17553
17554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17555         LDKRouteHint o_conv;
17556         o_conv.inner = untag_ptr(o);
17557         o_conv.is_owned = ptr_is_owned(o);
17558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17559         o_conv = RouteHint_clone(&o_conv);
17560         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17561         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
17562         return tag_ptr(ret_conv, true);
17563 }
17564
17565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17566         void* e_ptr = untag_ptr(e);
17567         CHECK_ACCESS(e_ptr);
17568         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17569         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17570         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17571         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
17572         return tag_ptr(ret_conv, true);
17573 }
17574
17575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17576         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
17577         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
17578         return ret_conv;
17579 }
17580
17581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17582         if (!ptr_is_owned(_res)) return;
17583         void* _res_ptr = untag_ptr(_res);
17584         CHECK_ACCESS(_res_ptr);
17585         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
17586         FREE(untag_ptr(_res));
17587         CResult_RouteHintDecodeErrorZ_free(_res_conv);
17588 }
17589
17590 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
17591         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17592         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
17593         return tag_ptr(ret_conv, true);
17594 }
17595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17596         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
17597         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
17598         return ret_conv;
17599 }
17600
17601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17602         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
17603         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17604         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
17605         return tag_ptr(ret_conv, true);
17606 }
17607
17608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17609         LDKRouteHintHop o_conv;
17610         o_conv.inner = untag_ptr(o);
17611         o_conv.is_owned = ptr_is_owned(o);
17612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17613         o_conv = RouteHintHop_clone(&o_conv);
17614         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17615         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
17616         return tag_ptr(ret_conv, true);
17617 }
17618
17619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17620         void* e_ptr = untag_ptr(e);
17621         CHECK_ACCESS(e_ptr);
17622         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17623         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17624         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17625         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
17626         return tag_ptr(ret_conv, true);
17627 }
17628
17629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17630         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
17631         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
17632         return ret_conv;
17633 }
17634
17635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17636         if (!ptr_is_owned(_res)) return;
17637         void* _res_ptr = untag_ptr(_res);
17638         CHECK_ACCESS(_res_ptr);
17639         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
17640         FREE(untag_ptr(_res));
17641         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
17642 }
17643
17644 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
17645         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17646         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
17647         return tag_ptr(ret_conv, true);
17648 }
17649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17650         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
17651         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
17652         return ret_conv;
17653 }
17654
17655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17656         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
17657         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17658         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
17659         return tag_ptr(ret_conv, true);
17660 }
17661
17662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17663         void* o_ptr = untag_ptr(o);
17664         CHECK_ACCESS(o_ptr);
17665         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
17666         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
17667         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
17668         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
17669         return tag_ptr(ret_conv, true);
17670 }
17671
17672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17673         void* e_ptr = untag_ptr(e);
17674         CHECK_ACCESS(e_ptr);
17675         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17676         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17677         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
17678         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
17679         return tag_ptr(ret_conv, true);
17680 }
17681
17682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17683         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
17684         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
17685         return ret_conv;
17686 }
17687
17688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17689         if (!ptr_is_owned(_res)) return;
17690         void* _res_ptr = untag_ptr(_res);
17691         CHECK_ACCESS(_res_ptr);
17692         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
17693         FREE(untag_ptr(_res));
17694         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
17695 }
17696
17697 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
17698         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
17699         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
17700         return tag_ptr(ret_conv, true);
17701 }
17702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17703         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
17704         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
17705         return ret_conv;
17706 }
17707
17708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17709         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
17710         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
17711         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
17712         return tag_ptr(ret_conv, true);
17713 }
17714
17715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17716         void* o_ptr = untag_ptr(o);
17717         CHECK_ACCESS(o_ptr);
17718         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
17719         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
17720         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17721         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
17722         int64_t ret_ref = tag_ptr(ret_copy, true);
17723         return ret_ref;
17724 }
17725
17726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
17727         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17728         *ret_copy = COption_NetworkUpdateZ_none();
17729         int64_t ret_ref = tag_ptr(ret_copy, true);
17730         return ret_ref;
17731 }
17732
17733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17734         if (!ptr_is_owned(_res)) return;
17735         void* _res_ptr = untag_ptr(_res);
17736         CHECK_ACCESS(_res_ptr);
17737         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
17738         FREE(untag_ptr(_res));
17739         COption_NetworkUpdateZ_free(_res_conv);
17740 }
17741
17742 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
17743         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17744         *ret_copy = COption_NetworkUpdateZ_clone(arg);
17745         int64_t ret_ref = tag_ptr(ret_copy, true);
17746         return ret_ref;
17747 }
17748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17749         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
17750         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
17751         return ret_conv;
17752 }
17753
17754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17755         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
17756         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17757         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
17758         int64_t ret_ref = tag_ptr(ret_copy, true);
17759         return ret_ref;
17760 }
17761
17762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17763         void* o_ptr = untag_ptr(o);
17764         CHECK_ACCESS(o_ptr);
17765         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
17766         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
17767         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
17768         *ret_copy = COption_PathFailureZ_some(o_conv);
17769         int64_t ret_ref = tag_ptr(ret_copy, true);
17770         return ret_ref;
17771 }
17772
17773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
17774         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
17775         *ret_copy = COption_PathFailureZ_none();
17776         int64_t ret_ref = tag_ptr(ret_copy, true);
17777         return ret_ref;
17778 }
17779
17780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17781         if (!ptr_is_owned(_res)) return;
17782         void* _res_ptr = untag_ptr(_res);
17783         CHECK_ACCESS(_res_ptr);
17784         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
17785         FREE(untag_ptr(_res));
17786         COption_PathFailureZ_free(_res_conv);
17787 }
17788
17789 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
17790         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
17791         *ret_copy = COption_PathFailureZ_clone(arg);
17792         int64_t ret_ref = tag_ptr(ret_copy, true);
17793         return ret_ref;
17794 }
17795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17796         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
17797         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
17798         return ret_conv;
17799 }
17800
17801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17802         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
17803         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
17804         *ret_copy = COption_PathFailureZ_clone(orig_conv);
17805         int64_t ret_ref = tag_ptr(ret_copy, true);
17806         return ret_ref;
17807 }
17808
17809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17810         void* o_ptr = untag_ptr(o);
17811         CHECK_ACCESS(o_ptr);
17812         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
17813         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
17814         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
17815         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
17816         return tag_ptr(ret_conv, true);
17817 }
17818
17819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17820         void* e_ptr = untag_ptr(e);
17821         CHECK_ACCESS(e_ptr);
17822         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17823         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17824         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
17825         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
17826         return tag_ptr(ret_conv, true);
17827 }
17828
17829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17830         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
17831         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
17832         return ret_conv;
17833 }
17834
17835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17836         if (!ptr_is_owned(_res)) return;
17837         void* _res_ptr = untag_ptr(_res);
17838         CHECK_ACCESS(_res_ptr);
17839         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
17840         FREE(untag_ptr(_res));
17841         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
17842 }
17843
17844 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
17845         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
17846         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
17847         return tag_ptr(ret_conv, true);
17848 }
17849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17850         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
17851         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
17852         return ret_conv;
17853 }
17854
17855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17856         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
17857         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
17858         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
17859         return tag_ptr(ret_conv, true);
17860 }
17861
17862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17863         void* o_ptr = untag_ptr(o);
17864         CHECK_ACCESS(o_ptr);
17865         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
17866         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
17867         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
17868         *ret_copy = COption_ClosureReasonZ_some(o_conv);
17869         int64_t ret_ref = tag_ptr(ret_copy, true);
17870         return ret_ref;
17871 }
17872
17873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
17874         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
17875         *ret_copy = COption_ClosureReasonZ_none();
17876         int64_t ret_ref = tag_ptr(ret_copy, true);
17877         return ret_ref;
17878 }
17879
17880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17881         if (!ptr_is_owned(_res)) return;
17882         void* _res_ptr = untag_ptr(_res);
17883         CHECK_ACCESS(_res_ptr);
17884         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
17885         FREE(untag_ptr(_res));
17886         COption_ClosureReasonZ_free(_res_conv);
17887 }
17888
17889 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
17890         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
17891         *ret_copy = COption_ClosureReasonZ_clone(arg);
17892         int64_t ret_ref = tag_ptr(ret_copy, true);
17893         return ret_ref;
17894 }
17895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17896         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
17897         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
17898         return ret_conv;
17899 }
17900
17901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17902         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
17903         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
17904         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
17905         int64_t ret_ref = tag_ptr(ret_copy, true);
17906         return ret_ref;
17907 }
17908
17909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17910         void* o_ptr = untag_ptr(o);
17911         CHECK_ACCESS(o_ptr);
17912         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
17913         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
17914         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
17915         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
17916         return tag_ptr(ret_conv, true);
17917 }
17918
17919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17920         void* e_ptr = untag_ptr(e);
17921         CHECK_ACCESS(e_ptr);
17922         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17923         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17924         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
17925         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
17926         return tag_ptr(ret_conv, true);
17927 }
17928
17929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17930         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
17931         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
17932         return ret_conv;
17933 }
17934
17935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17936         if (!ptr_is_owned(_res)) return;
17937         void* _res_ptr = untag_ptr(_res);
17938         CHECK_ACCESS(_res_ptr);
17939         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
17940         FREE(untag_ptr(_res));
17941         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
17942 }
17943
17944 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
17945         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
17946         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
17947         return tag_ptr(ret_conv, true);
17948 }
17949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17950         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
17951         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
17952         return ret_conv;
17953 }
17954
17955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17956         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
17957         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
17958         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
17959         return tag_ptr(ret_conv, true);
17960 }
17961
17962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17963         void* o_ptr = untag_ptr(o);
17964         CHECK_ACCESS(o_ptr);
17965         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
17966         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
17967         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
17968         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
17969         int64_t ret_ref = tag_ptr(ret_copy, true);
17970         return ret_ref;
17971 }
17972
17973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
17974         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
17975         *ret_copy = COption_HTLCDestinationZ_none();
17976         int64_t ret_ref = tag_ptr(ret_copy, true);
17977         return ret_ref;
17978 }
17979
17980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17981         if (!ptr_is_owned(_res)) return;
17982         void* _res_ptr = untag_ptr(_res);
17983         CHECK_ACCESS(_res_ptr);
17984         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
17985         FREE(untag_ptr(_res));
17986         COption_HTLCDestinationZ_free(_res_conv);
17987 }
17988
17989 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
17990         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
17991         *ret_copy = COption_HTLCDestinationZ_clone(arg);
17992         int64_t ret_ref = tag_ptr(ret_copy, true);
17993         return ret_ref;
17994 }
17995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17996         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
17997         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
17998         return ret_conv;
17999 }
18000
18001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18002         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
18003         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18004         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
18005         int64_t ret_ref = tag_ptr(ret_copy, true);
18006         return ret_ref;
18007 }
18008
18009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18010         void* o_ptr = untag_ptr(o);
18011         CHECK_ACCESS(o_ptr);
18012         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
18013         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
18014         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18015         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
18016         return tag_ptr(ret_conv, true);
18017 }
18018
18019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18020         void* e_ptr = untag_ptr(e);
18021         CHECK_ACCESS(e_ptr);
18022         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18023         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18024         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18025         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
18026         return tag_ptr(ret_conv, true);
18027 }
18028
18029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18030         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
18031         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
18032         return ret_conv;
18033 }
18034
18035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18036         if (!ptr_is_owned(_res)) return;
18037         void* _res_ptr = untag_ptr(_res);
18038         CHECK_ACCESS(_res_ptr);
18039         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
18040         FREE(untag_ptr(_res));
18041         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
18042 }
18043
18044 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
18045         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18046         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
18047         return tag_ptr(ret_conv, true);
18048 }
18049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18050         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
18051         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
18052         return ret_conv;
18053 }
18054
18055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18056         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
18057         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18058         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
18059         return tag_ptr(ret_conv, true);
18060 }
18061
18062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
18063         LDKU128 o_ref;
18064         CHECK((*env)->GetArrayLength(env, o) == 16);
18065         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
18066         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18067         *ret_copy = COption_u128Z_some(o_ref);
18068         int64_t ret_ref = tag_ptr(ret_copy, true);
18069         return ret_ref;
18070 }
18071
18072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1none(JNIEnv *env, jclass clz) {
18073         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18074         *ret_copy = COption_u128Z_none();
18075         int64_t ret_ref = tag_ptr(ret_copy, true);
18076         return ret_ref;
18077 }
18078
18079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18080         if (!ptr_is_owned(_res)) return;
18081         void* _res_ptr = untag_ptr(_res);
18082         CHECK_ACCESS(_res_ptr);
18083         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
18084         FREE(untag_ptr(_res));
18085         COption_u128Z_free(_res_conv);
18086 }
18087
18088 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
18089         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18090         *ret_copy = COption_u128Z_clone(arg);
18091         int64_t ret_ref = tag_ptr(ret_copy, true);
18092         return ret_ref;
18093 }
18094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18095         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
18096         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
18097         return ret_conv;
18098 }
18099
18100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18101         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
18102         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18103         *ret_copy = COption_u128Z_clone(orig_conv);
18104         int64_t ret_ref = tag_ptr(ret_copy, true);
18105         return ret_ref;
18106 }
18107
18108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18109         LDKCVec_SpendableOutputDescriptorZ _res_constr;
18110         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18111         if (_res_constr.datalen > 0)
18112                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
18113         else
18114                 _res_constr.data = NULL;
18115         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18116         for (size_t b = 0; b < _res_constr.datalen; b++) {
18117                 int64_t _res_conv_27 = _res_vals[b];
18118                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
18119                 CHECK_ACCESS(_res_conv_27_ptr);
18120                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
18121                 FREE(untag_ptr(_res_conv_27));
18122                 _res_constr.data[b] = _res_conv_27_conv;
18123         }
18124         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18125         CVec_SpendableOutputDescriptorZ_free(_res_constr);
18126 }
18127
18128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18129         void* o_ptr = untag_ptr(o);
18130         CHECK_ACCESS(o_ptr);
18131         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
18132         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
18133         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
18134         *ret_copy = COption_EventZ_some(o_conv);
18135         int64_t ret_ref = tag_ptr(ret_copy, true);
18136         return ret_ref;
18137 }
18138
18139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
18140         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
18141         *ret_copy = COption_EventZ_none();
18142         int64_t ret_ref = tag_ptr(ret_copy, true);
18143         return ret_ref;
18144 }
18145
18146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18147         if (!ptr_is_owned(_res)) return;
18148         void* _res_ptr = untag_ptr(_res);
18149         CHECK_ACCESS(_res_ptr);
18150         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
18151         FREE(untag_ptr(_res));
18152         COption_EventZ_free(_res_conv);
18153 }
18154
18155 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
18156         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
18157         *ret_copy = COption_EventZ_clone(arg);
18158         int64_t ret_ref = tag_ptr(ret_copy, true);
18159         return ret_ref;
18160 }
18161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18162         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
18163         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
18164         return ret_conv;
18165 }
18166
18167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18168         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
18169         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
18170         *ret_copy = COption_EventZ_clone(orig_conv);
18171         int64_t ret_ref = tag_ptr(ret_copy, true);
18172         return ret_ref;
18173 }
18174
18175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18176         void* o_ptr = untag_ptr(o);
18177         CHECK_ACCESS(o_ptr);
18178         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
18179         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
18180         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
18181         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
18182         return tag_ptr(ret_conv, true);
18183 }
18184
18185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18186         void* e_ptr = untag_ptr(e);
18187         CHECK_ACCESS(e_ptr);
18188         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18189         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18190         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
18191         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
18192         return tag_ptr(ret_conv, true);
18193 }
18194
18195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18196         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
18197         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
18198         return ret_conv;
18199 }
18200
18201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18202         if (!ptr_is_owned(_res)) return;
18203         void* _res_ptr = untag_ptr(_res);
18204         CHECK_ACCESS(_res_ptr);
18205         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
18206         FREE(untag_ptr(_res));
18207         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
18208 }
18209
18210 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
18211         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
18212         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
18213         return tag_ptr(ret_conv, true);
18214 }
18215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18216         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
18217         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
18218         return ret_conv;
18219 }
18220
18221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18222         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
18223         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
18224         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
18225         return tag_ptr(ret_conv, true);
18226 }
18227
18228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18229         LDKCVec_MessageSendEventZ _res_constr;
18230         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18231         if (_res_constr.datalen > 0)
18232                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
18233         else
18234                 _res_constr.data = NULL;
18235         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18236         for (size_t s = 0; s < _res_constr.datalen; s++) {
18237                 int64_t _res_conv_18 = _res_vals[s];
18238                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
18239                 CHECK_ACCESS(_res_conv_18_ptr);
18240                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
18241                 FREE(untag_ptr(_res_conv_18));
18242                 _res_constr.data[s] = _res_conv_18_conv;
18243         }
18244         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18245         CVec_MessageSendEventZ_free(_res_constr);
18246 }
18247
18248 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
18249         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18250         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
18251         return tag_ptr(ret_conv, true);
18252 }
18253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18254         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
18255         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
18256         return ret_conv;
18257 }
18258
18259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18260         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
18261         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18262         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
18263         return tag_ptr(ret_conv, true);
18264 }
18265
18266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
18267         LDKTransaction b_ref;
18268         b_ref.datalen = (*env)->GetArrayLength(env, b);
18269         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
18270         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
18271         b_ref.data_is_owned = true;
18272         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18273         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
18274         return tag_ptr(ret_conv, true);
18275 }
18276
18277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18278         if (!ptr_is_owned(_res)) return;
18279         void* _res_ptr = untag_ptr(_res);
18280         CHECK_ACCESS(_res_ptr);
18281         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
18282         FREE(untag_ptr(_res));
18283         C2Tuple_usizeTransactionZ_free(_res_conv);
18284 }
18285
18286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18287         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
18288         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18289         if (_res_constr.datalen > 0)
18290                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18291         else
18292                 _res_constr.data = NULL;
18293         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18294         for (size_t c = 0; c < _res_constr.datalen; c++) {
18295                 int64_t _res_conv_28 = _res_vals[c];
18296                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
18297                 CHECK_ACCESS(_res_conv_28_ptr);
18298                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
18299                 FREE(untag_ptr(_res_conv_28));
18300                 _res_constr.data[c] = _res_conv_28_conv;
18301         }
18302         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18303         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
18304 }
18305
18306 static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) {
18307         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
18308         *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg);
18309         return tag_ptr(ret_conv, true);
18310 }
18311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidBlockHashZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18312         LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg);
18313         int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv);
18314         return ret_conv;
18315 }
18316
18317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidBlockHashZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18318         LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig);
18319         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
18320         *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv);
18321         return tag_ptr(ret_conv, true);
18322 }
18323
18324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidBlockHashZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18325         LDKThirtyTwoBytes a_ref;
18326         CHECK((*env)->GetArrayLength(env, a) == 32);
18327         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18328         LDKThirtyTwoBytes b_ref;
18329         CHECK((*env)->GetArrayLength(env, b) == 32);
18330         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18331         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
18332         *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref);
18333         return tag_ptr(ret_conv, true);
18334 }
18335
18336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidBlockHashZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18337         if (!ptr_is_owned(_res)) return;
18338         void* _res_ptr = untag_ptr(_res);
18339         CHECK_ACCESS(_res_ptr);
18340         LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr);
18341         FREE(untag_ptr(_res));
18342         C2Tuple_TxidBlockHashZ_free(_res_conv);
18343 }
18344
18345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidBlockHashZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18346         LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr;
18347         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18348         if (_res_constr.datalen > 0)
18349                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
18350         else
18351                 _res_constr.data = NULL;
18352         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18353         for (size_t z = 0; z < _res_constr.datalen; z++) {
18354                 int64_t _res_conv_25 = _res_vals[z];
18355                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18356                 CHECK_ACCESS(_res_conv_25_ptr);
18357                 LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr);
18358                 FREE(untag_ptr(_res_conv_25));
18359                 _res_constr.data[z] = _res_conv_25_conv;
18360         }
18361         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18362         CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr);
18363 }
18364
18365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18366         LDKCVec_MonitorEventZ _res_constr;
18367         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18368         if (_res_constr.datalen > 0)
18369                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18370         else
18371                 _res_constr.data = NULL;
18372         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18373         for (size_t o = 0; o < _res_constr.datalen; o++) {
18374                 int64_t _res_conv_14 = _res_vals[o];
18375                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
18376                 CHECK_ACCESS(_res_conv_14_ptr);
18377                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
18378                 FREE(untag_ptr(_res_conv_14));
18379                 _res_constr.data[o] = _res_conv_14_conv;
18380         }
18381         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18382         CVec_MonitorEventZ_free(_res_constr);
18383 }
18384
18385 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
18386         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18387         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
18388         return tag_ptr(ret_conv, true);
18389 }
18390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18391         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
18392         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
18393         return ret_conv;
18394 }
18395
18396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18397         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
18398         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18399         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
18400         return tag_ptr(ret_conv, true);
18401 }
18402
18403 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) {
18404         LDKOutPoint a_conv;
18405         a_conv.inner = untag_ptr(a);
18406         a_conv.is_owned = ptr_is_owned(a);
18407         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18408         a_conv = OutPoint_clone(&a_conv);
18409         LDKCVec_MonitorEventZ b_constr;
18410         b_constr.datalen = (*env)->GetArrayLength(env, b);
18411         if (b_constr.datalen > 0)
18412                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
18413         else
18414                 b_constr.data = NULL;
18415         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
18416         for (size_t o = 0; o < b_constr.datalen; o++) {
18417                 int64_t b_conv_14 = b_vals[o];
18418                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
18419                 CHECK_ACCESS(b_conv_14_ptr);
18420                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
18421                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
18422                 b_constr.data[o] = b_conv_14_conv;
18423         }
18424         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
18425         LDKPublicKey c_ref;
18426         CHECK((*env)->GetArrayLength(env, c) == 33);
18427         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
18428         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
18429         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
18430         return tag_ptr(ret_conv, true);
18431 }
18432
18433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18434         if (!ptr_is_owned(_res)) return;
18435         void* _res_ptr = untag_ptr(_res);
18436         CHECK_ACCESS(_res_ptr);
18437         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
18438         FREE(untag_ptr(_res));
18439         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
18440 }
18441
18442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18443         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
18444         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18445         if (_res_constr.datalen > 0)
18446                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
18447         else
18448                 _res_constr.data = NULL;
18449         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18450         for (size_t x = 0; x < _res_constr.datalen; x++) {
18451                 int64_t _res_conv_49 = _res_vals[x];
18452                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
18453                 CHECK_ACCESS(_res_conv_49_ptr);
18454                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
18455                 FREE(untag_ptr(_res_conv_49));
18456                 _res_constr.data[x] = _res_conv_49_conv;
18457         }
18458         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18459         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
18460 }
18461
18462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18463         LDKFixedPenaltyScorer o_conv;
18464         o_conv.inner = untag_ptr(o);
18465         o_conv.is_owned = ptr_is_owned(o);
18466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18467         o_conv = FixedPenaltyScorer_clone(&o_conv);
18468         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18469         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
18470         return tag_ptr(ret_conv, true);
18471 }
18472
18473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18474         void* e_ptr = untag_ptr(e);
18475         CHECK_ACCESS(e_ptr);
18476         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18477         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18478         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18479         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
18480         return tag_ptr(ret_conv, true);
18481 }
18482
18483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18484         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
18485         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
18486         return ret_conv;
18487 }
18488
18489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18490         if (!ptr_is_owned(_res)) return;
18491         void* _res_ptr = untag_ptr(_res);
18492         CHECK_ACCESS(_res_ptr);
18493         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
18494         FREE(untag_ptr(_res));
18495         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
18496 }
18497
18498 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
18499         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18500         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
18501         return tag_ptr(ret_conv, true);
18502 }
18503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18504         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
18505         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
18506         return ret_conv;
18507 }
18508
18509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18510         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
18511         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
18512         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
18513         return tag_ptr(ret_conv, true);
18514 }
18515
18516 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
18517         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18518         *ret_conv = C2Tuple_u64u64Z_clone(arg);
18519         return tag_ptr(ret_conv, true);
18520 }
18521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18522         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
18523         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
18524         return ret_conv;
18525 }
18526
18527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18528         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
18529         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18530         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
18531         return tag_ptr(ret_conv, true);
18532 }
18533
18534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
18535         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
18536         *ret_conv = C2Tuple_u64u64Z_new(a, b);
18537         return tag_ptr(ret_conv, true);
18538 }
18539
18540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18541         if (!ptr_is_owned(_res)) return;
18542         void* _res_ptr = untag_ptr(_res);
18543         CHECK_ACCESS(_res_ptr);
18544         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
18545         FREE(untag_ptr(_res));
18546         C2Tuple_u64u64Z_free(_res_conv);
18547 }
18548
18549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18550         void* o_ptr = untag_ptr(o);
18551         CHECK_ACCESS(o_ptr);
18552         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
18553         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
18554         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18555         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
18556         int64_t ret_ref = tag_ptr(ret_copy, true);
18557         return ret_ref;
18558 }
18559
18560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
18561         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18562         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
18563         int64_t ret_ref = tag_ptr(ret_copy, true);
18564         return ret_ref;
18565 }
18566
18567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18568         if (!ptr_is_owned(_res)) return;
18569         void* _res_ptr = untag_ptr(_res);
18570         CHECK_ACCESS(_res_ptr);
18571         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
18572         FREE(untag_ptr(_res));
18573         COption_C2Tuple_u64u64ZZ_free(_res_conv);
18574 }
18575
18576 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
18577         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18578         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
18579         int64_t ret_ref = tag_ptr(ret_copy, true);
18580         return ret_ref;
18581 }
18582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18583         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
18584         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
18585         return ret_conv;
18586 }
18587
18588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18589         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
18590         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
18591         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
18592         int64_t ret_ref = tag_ptr(ret_copy, true);
18593         return ret_ref;
18594 }
18595
18596 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
18597         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18598         *ret_conv = C2Tuple_Z_clone(arg);
18599         return tag_ptr(ret_conv, true);
18600 }
18601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18602         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
18603         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
18604         return ret_conv;
18605 }
18606
18607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18608         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
18609         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18610         *ret_conv = C2Tuple_Z_clone(orig_conv);
18611         return tag_ptr(ret_conv, true);
18612 }
18613
18614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
18615         LDKEightU16s a_ref;
18616         CHECK((*env)->GetArrayLength(env, a) == 8);
18617         (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data);
18618         LDKEightU16s b_ref;
18619         CHECK((*env)->GetArrayLength(env, b) == 8);
18620         (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data);
18621         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18622         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
18623         return tag_ptr(ret_conv, true);
18624 }
18625
18626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18627         if (!ptr_is_owned(_res)) return;
18628         void* _res_ptr = untag_ptr(_res);
18629         CHECK_ACCESS(_res_ptr);
18630         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
18631         FREE(untag_ptr(_res));
18632         C2Tuple_Z_free(_res_conv);
18633 }
18634
18635 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
18636         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18637         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
18638         return tag_ptr(ret_conv, true);
18639 }
18640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18641         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
18642         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
18643         return ret_conv;
18644 }
18645
18646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18647         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
18648         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18649         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
18650         return tag_ptr(ret_conv, true);
18651 }
18652
18653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
18654         LDKEightU16s a_ref;
18655         CHECK((*env)->GetArrayLength(env, a) == 8);
18656         (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data);
18657         LDKEightU16s b_ref;
18658         CHECK((*env)->GetArrayLength(env, b) == 8);
18659         (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data);
18660         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18661         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
18662         return tag_ptr(ret_conv, true);
18663 }
18664
18665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18666         if (!ptr_is_owned(_res)) return;
18667         void* _res_ptr = untag_ptr(_res);
18668         CHECK_ACCESS(_res_ptr);
18669         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
18670         FREE(untag_ptr(_res));
18671         C2Tuple__u168_u168Z_free(_res_conv);
18672 }
18673
18674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18675         void* o_ptr = untag_ptr(o);
18676         CHECK_ACCESS(o_ptr);
18677         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
18678         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
18679         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18680         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
18681         int64_t ret_ref = tag_ptr(ret_copy, true);
18682         return ret_ref;
18683 }
18684
18685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1none(JNIEnv *env, jclass clz) {
18686         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18687         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
18688         int64_t ret_ref = tag_ptr(ret_copy, true);
18689         return ret_ref;
18690 }
18691
18692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18693         if (!ptr_is_owned(_res)) return;
18694         void* _res_ptr = untag_ptr(_res);
18695         CHECK_ACCESS(_res_ptr);
18696         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
18697         FREE(untag_ptr(_res));
18698         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
18699 }
18700
18701 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
18702         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18703         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
18704         int64_t ret_ref = tag_ptr(ret_copy, true);
18705         return ret_ref;
18706 }
18707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18708         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
18709         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
18710         return ret_conv;
18711 }
18712
18713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18714         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
18715         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18716         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
18717         int64_t ret_ref = tag_ptr(ret_copy, true);
18718         return ret_ref;
18719 }
18720
18721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18722         LDKCVec_NodeIdZ _res_constr;
18723         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18724         if (_res_constr.datalen > 0)
18725                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
18726         else
18727                 _res_constr.data = NULL;
18728         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18729         for (size_t i = 0; i < _res_constr.datalen; i++) {
18730                 int64_t _res_conv_8 = _res_vals[i];
18731                 LDKNodeId _res_conv_8_conv;
18732                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
18733                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
18734                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
18735                 _res_constr.data[i] = _res_conv_8_conv;
18736         }
18737         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18738         CVec_NodeIdZ_free(_res_constr);
18739 }
18740
18741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18742         LDKProbabilisticScorer o_conv;
18743         o_conv.inner = untag_ptr(o);
18744         o_conv.is_owned = ptr_is_owned(o);
18745         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18746         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
18747         
18748         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18749         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
18750         return tag_ptr(ret_conv, true);
18751 }
18752
18753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18754         void* e_ptr = untag_ptr(e);
18755         CHECK_ACCESS(e_ptr);
18756         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18757         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18758         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18759         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
18760         return tag_ptr(ret_conv, true);
18761 }
18762
18763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18764         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
18765         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
18766         return ret_conv;
18767 }
18768
18769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18770         if (!ptr_is_owned(_res)) return;
18771         void* _res_ptr = untag_ptr(_res);
18772         CHECK_ACCESS(_res_ptr);
18773         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
18774         FREE(untag_ptr(_res));
18775         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
18776 }
18777
18778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18779         LDKInitFeatures o_conv;
18780         o_conv.inner = untag_ptr(o);
18781         o_conv.is_owned = ptr_is_owned(o);
18782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18783         o_conv = InitFeatures_clone(&o_conv);
18784         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18785         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
18786         return tag_ptr(ret_conv, true);
18787 }
18788
18789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18790         void* e_ptr = untag_ptr(e);
18791         CHECK_ACCESS(e_ptr);
18792         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18793         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18794         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18795         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
18796         return tag_ptr(ret_conv, true);
18797 }
18798
18799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18800         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
18801         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
18802         return ret_conv;
18803 }
18804
18805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18806         if (!ptr_is_owned(_res)) return;
18807         void* _res_ptr = untag_ptr(_res);
18808         CHECK_ACCESS(_res_ptr);
18809         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
18810         FREE(untag_ptr(_res));
18811         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
18812 }
18813
18814 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18815         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18816         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
18817         return tag_ptr(ret_conv, true);
18818 }
18819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18820         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
18821         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18822         return ret_conv;
18823 }
18824
18825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18826         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
18827         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18828         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
18829         return tag_ptr(ret_conv, true);
18830 }
18831
18832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18833         LDKChannelFeatures o_conv;
18834         o_conv.inner = untag_ptr(o);
18835         o_conv.is_owned = ptr_is_owned(o);
18836         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18837         o_conv = ChannelFeatures_clone(&o_conv);
18838         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18839         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
18840         return tag_ptr(ret_conv, true);
18841 }
18842
18843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18844         void* e_ptr = untag_ptr(e);
18845         CHECK_ACCESS(e_ptr);
18846         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18847         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18848         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18849         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
18850         return tag_ptr(ret_conv, true);
18851 }
18852
18853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18854         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
18855         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
18856         return ret_conv;
18857 }
18858
18859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18860         if (!ptr_is_owned(_res)) return;
18861         void* _res_ptr = untag_ptr(_res);
18862         CHECK_ACCESS(_res_ptr);
18863         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
18864         FREE(untag_ptr(_res));
18865         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
18866 }
18867
18868 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18869         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18870         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
18871         return tag_ptr(ret_conv, true);
18872 }
18873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18874         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
18875         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18876         return ret_conv;
18877 }
18878
18879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18880         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
18881         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18882         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
18883         return tag_ptr(ret_conv, true);
18884 }
18885
18886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18887         LDKNodeFeatures o_conv;
18888         o_conv.inner = untag_ptr(o);
18889         o_conv.is_owned = ptr_is_owned(o);
18890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18891         o_conv = NodeFeatures_clone(&o_conv);
18892         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18893         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
18894         return tag_ptr(ret_conv, true);
18895 }
18896
18897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18898         void* e_ptr = untag_ptr(e);
18899         CHECK_ACCESS(e_ptr);
18900         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18901         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18902         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18903         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
18904         return tag_ptr(ret_conv, true);
18905 }
18906
18907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18908         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
18909         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
18910         return ret_conv;
18911 }
18912
18913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18914         if (!ptr_is_owned(_res)) return;
18915         void* _res_ptr = untag_ptr(_res);
18916         CHECK_ACCESS(_res_ptr);
18917         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
18918         FREE(untag_ptr(_res));
18919         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
18920 }
18921
18922 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18923         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18924         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
18925         return tag_ptr(ret_conv, true);
18926 }
18927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18928         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
18929         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18930         return ret_conv;
18931 }
18932
18933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18934         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
18935         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18936         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
18937         return tag_ptr(ret_conv, true);
18938 }
18939
18940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18941         LDKInvoiceFeatures o_conv;
18942         o_conv.inner = untag_ptr(o);
18943         o_conv.is_owned = ptr_is_owned(o);
18944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18945         o_conv = InvoiceFeatures_clone(&o_conv);
18946         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18947         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18948         return tag_ptr(ret_conv, true);
18949 }
18950
18951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18952         void* e_ptr = untag_ptr(e);
18953         CHECK_ACCESS(e_ptr);
18954         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18955         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18956         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18957         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
18958         return tag_ptr(ret_conv, true);
18959 }
18960
18961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18962         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18963         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18964         return ret_conv;
18965 }
18966
18967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18968         if (!ptr_is_owned(_res)) return;
18969         void* _res_ptr = untag_ptr(_res);
18970         CHECK_ACCESS(_res_ptr);
18971         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18972         FREE(untag_ptr(_res));
18973         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18974 }
18975
18976 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18977         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18978         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
18979         return tag_ptr(ret_conv, true);
18980 }
18981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18982         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18983         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18984         return ret_conv;
18985 }
18986
18987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18988         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18989         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18990         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18991         return tag_ptr(ret_conv, true);
18992 }
18993
18994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18995         LDKBlindedHopFeatures o_conv;
18996         o_conv.inner = untag_ptr(o);
18997         o_conv.is_owned = ptr_is_owned(o);
18998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18999         o_conv = BlindedHopFeatures_clone(&o_conv);
19000         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
19001         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
19002         return tag_ptr(ret_conv, true);
19003 }
19004
19005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19006         void* e_ptr = untag_ptr(e);
19007         CHECK_ACCESS(e_ptr);
19008         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19009         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19010         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
19011         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
19012         return tag_ptr(ret_conv, true);
19013 }
19014
19015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19016         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
19017         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
19018         return ret_conv;
19019 }
19020
19021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19022         if (!ptr_is_owned(_res)) return;
19023         void* _res_ptr = untag_ptr(_res);
19024         CHECK_ACCESS(_res_ptr);
19025         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
19026         FREE(untag_ptr(_res));
19027         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
19028 }
19029
19030 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
19031         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
19032         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
19033         return tag_ptr(ret_conv, true);
19034 }
19035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19036         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
19037         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
19038         return ret_conv;
19039 }
19040
19041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19042         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
19043         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
19044         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
19045         return tag_ptr(ret_conv, true);
19046 }
19047
19048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19049         LDKChannelTypeFeatures o_conv;
19050         o_conv.inner = untag_ptr(o);
19051         o_conv.is_owned = ptr_is_owned(o);
19052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19053         o_conv = ChannelTypeFeatures_clone(&o_conv);
19054         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19055         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
19056         return tag_ptr(ret_conv, true);
19057 }
19058
19059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19060         void* e_ptr = untag_ptr(e);
19061         CHECK_ACCESS(e_ptr);
19062         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19063         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19064         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19065         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
19066         return tag_ptr(ret_conv, true);
19067 }
19068
19069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19070         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
19071         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
19072         return ret_conv;
19073 }
19074
19075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19076         if (!ptr_is_owned(_res)) return;
19077         void* _res_ptr = untag_ptr(_res);
19078         CHECK_ACCESS(_res_ptr);
19079         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
19080         FREE(untag_ptr(_res));
19081         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
19082 }
19083
19084 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
19085         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19086         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
19087         return tag_ptr(ret_conv, true);
19088 }
19089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19090         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
19091         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
19092         return ret_conv;
19093 }
19094
19095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19096         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
19097         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
19098         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
19099         return tag_ptr(ret_conv, true);
19100 }
19101
19102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19103         LDKNodeId o_conv;
19104         o_conv.inner = untag_ptr(o);
19105         o_conv.is_owned = ptr_is_owned(o);
19106         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19107         o_conv = NodeId_clone(&o_conv);
19108         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19109         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
19110         return tag_ptr(ret_conv, true);
19111 }
19112
19113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19114         void* e_ptr = untag_ptr(e);
19115         CHECK_ACCESS(e_ptr);
19116         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19117         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19118         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19119         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
19120         return tag_ptr(ret_conv, true);
19121 }
19122
19123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19124         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
19125         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
19126         return ret_conv;
19127 }
19128
19129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19130         if (!ptr_is_owned(_res)) return;
19131         void* _res_ptr = untag_ptr(_res);
19132         CHECK_ACCESS(_res_ptr);
19133         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
19134         FREE(untag_ptr(_res));
19135         CResult_NodeIdDecodeErrorZ_free(_res_conv);
19136 }
19137
19138 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
19139         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19140         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
19141         return tag_ptr(ret_conv, true);
19142 }
19143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19144         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
19145         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
19146         return ret_conv;
19147 }
19148
19149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19150         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
19151         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19152         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
19153         return tag_ptr(ret_conv, true);
19154 }
19155
19156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19157         void* o_ptr = untag_ptr(o);
19158         CHECK_ACCESS(o_ptr);
19159         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
19160         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
19161         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19162         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
19163         return tag_ptr(ret_conv, true);
19164 }
19165
19166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19167         void* e_ptr = untag_ptr(e);
19168         CHECK_ACCESS(e_ptr);
19169         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19170         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19171         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19172         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
19173         return tag_ptr(ret_conv, true);
19174 }
19175
19176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19177         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
19178         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
19179         return ret_conv;
19180 }
19181
19182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19183         if (!ptr_is_owned(_res)) return;
19184         void* _res_ptr = untag_ptr(_res);
19185         CHECK_ACCESS(_res_ptr);
19186         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
19187         FREE(untag_ptr(_res));
19188         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
19189 }
19190
19191 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
19192         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19193         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
19194         return tag_ptr(ret_conv, true);
19195 }
19196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19197         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
19198         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
19199         return ret_conv;
19200 }
19201
19202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19203         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
19204         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19205         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
19206         return tag_ptr(ret_conv, true);
19207 }
19208
19209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19210         void* o_ptr = untag_ptr(o);
19211         CHECK_ACCESS(o_ptr);
19212         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
19213         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
19214                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19215                 LDKUtxoLookup_JCalls_cloned(&o_conv);
19216         }
19217         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19218         *ret_copy = COption_UtxoLookupZ_some(o_conv);
19219         int64_t ret_ref = tag_ptr(ret_copy, true);
19220         return ret_ref;
19221 }
19222
19223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
19224         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19225         *ret_copy = COption_UtxoLookupZ_none();
19226         int64_t ret_ref = tag_ptr(ret_copy, true);
19227         return ret_ref;
19228 }
19229
19230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19231         if (!ptr_is_owned(_res)) return;
19232         void* _res_ptr = untag_ptr(_res);
19233         CHECK_ACCESS(_res_ptr);
19234         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
19235         FREE(untag_ptr(_res));
19236         COption_UtxoLookupZ_free(_res_conv);
19237 }
19238
19239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
19240         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19241         *ret_conv = CResult_boolLightningErrorZ_ok(o);
19242         return tag_ptr(ret_conv, true);
19243 }
19244
19245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19246         LDKLightningError e_conv;
19247         e_conv.inner = untag_ptr(e);
19248         e_conv.is_owned = ptr_is_owned(e);
19249         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19250         e_conv = LightningError_clone(&e_conv);
19251         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19252         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19253         return tag_ptr(ret_conv, true);
19254 }
19255
19256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19257         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
19258         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
19259         return ret_conv;
19260 }
19261
19262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19263         if (!ptr_is_owned(_res)) return;
19264         void* _res_ptr = untag_ptr(_res);
19265         CHECK_ACCESS(_res_ptr);
19266         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19267         FREE(untag_ptr(_res));
19268         CResult_boolLightningErrorZ_free(_res_conv);
19269 }
19270
19271 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19272         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19273         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19274         return tag_ptr(ret_conv, true);
19275 }
19276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19277         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
19278         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19279         return ret_conv;
19280 }
19281
19282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19283         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
19284         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19285         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19286         return tag_ptr(ret_conv, true);
19287 }
19288
19289 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19290         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19291         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19292         return tag_ptr(ret_conv, true);
19293 }
19294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19295         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
19296         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19297         return ret_conv;
19298 }
19299
19300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19301         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
19302         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19303         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19304         return tag_ptr(ret_conv, true);
19305 }
19306
19307 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) {
19308         LDKChannelAnnouncement a_conv;
19309         a_conv.inner = untag_ptr(a);
19310         a_conv.is_owned = ptr_is_owned(a);
19311         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19312         a_conv = ChannelAnnouncement_clone(&a_conv);
19313         LDKChannelUpdate b_conv;
19314         b_conv.inner = untag_ptr(b);
19315         b_conv.is_owned = ptr_is_owned(b);
19316         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19317         b_conv = ChannelUpdate_clone(&b_conv);
19318         LDKChannelUpdate c_conv;
19319         c_conv.inner = untag_ptr(c);
19320         c_conv.is_owned = ptr_is_owned(c);
19321         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19322         c_conv = ChannelUpdate_clone(&c_conv);
19323         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19324         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19325         return tag_ptr(ret_conv, true);
19326 }
19327
19328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19329         if (!ptr_is_owned(_res)) return;
19330         void* _res_ptr = untag_ptr(_res);
19331         CHECK_ACCESS(_res_ptr);
19332         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19333         FREE(untag_ptr(_res));
19334         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19335 }
19336
19337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19338         void* o_ptr = untag_ptr(o);
19339         CHECK_ACCESS(o_ptr);
19340         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
19341         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
19342         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19343         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
19344         int64_t ret_ref = tag_ptr(ret_copy, true);
19345         return ret_ref;
19346 }
19347
19348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
19349         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19350         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
19351         int64_t ret_ref = tag_ptr(ret_copy, true);
19352         return ret_ref;
19353 }
19354
19355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19356         if (!ptr_is_owned(_res)) return;
19357         void* _res_ptr = untag_ptr(_res);
19358         CHECK_ACCESS(_res_ptr);
19359         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
19360         FREE(untag_ptr(_res));
19361         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
19362 }
19363
19364 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
19365         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19366         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
19367         int64_t ret_ref = tag_ptr(ret_copy, true);
19368         return ret_ref;
19369 }
19370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19371         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
19372         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
19373         return ret_conv;
19374 }
19375
19376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19377         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
19378         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19379         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
19380         int64_t ret_ref = tag_ptr(ret_copy, true);
19381         return ret_ref;
19382 }
19383
19384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
19385         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19386         *ret_conv = CResult_NoneLightningErrorZ_ok();
19387         return tag_ptr(ret_conv, true);
19388 }
19389
19390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19391         LDKLightningError e_conv;
19392         e_conv.inner = untag_ptr(e);
19393         e_conv.is_owned = ptr_is_owned(e);
19394         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19395         e_conv = LightningError_clone(&e_conv);
19396         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19397         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19398         return tag_ptr(ret_conv, true);
19399 }
19400
19401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19402         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
19403         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
19404         return ret_conv;
19405 }
19406
19407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19408         if (!ptr_is_owned(_res)) return;
19409         void* _res_ptr = untag_ptr(_res);
19410         CHECK_ACCESS(_res_ptr);
19411         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19412         FREE(untag_ptr(_res));
19413         CResult_NoneLightningErrorZ_free(_res_conv);
19414 }
19415
19416 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19417         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19418         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19419         return tag_ptr(ret_conv, true);
19420 }
19421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19422         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
19423         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19424         return ret_conv;
19425 }
19426
19427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19428         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
19429         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19430         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19431         return tag_ptr(ret_conv, true);
19432 }
19433
19434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19435         LDKChannelUpdateInfo o_conv;
19436         o_conv.inner = untag_ptr(o);
19437         o_conv.is_owned = ptr_is_owned(o);
19438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19439         o_conv = ChannelUpdateInfo_clone(&o_conv);
19440         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19441         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
19442         return tag_ptr(ret_conv, true);
19443 }
19444
19445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19446         void* e_ptr = untag_ptr(e);
19447         CHECK_ACCESS(e_ptr);
19448         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19449         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19450         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19451         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
19452         return tag_ptr(ret_conv, true);
19453 }
19454
19455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19456         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
19457         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
19458         return ret_conv;
19459 }
19460
19461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19462         if (!ptr_is_owned(_res)) return;
19463         void* _res_ptr = untag_ptr(_res);
19464         CHECK_ACCESS(_res_ptr);
19465         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
19466         FREE(untag_ptr(_res));
19467         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
19468 }
19469
19470 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
19471         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19472         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
19473         return tag_ptr(ret_conv, true);
19474 }
19475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19476         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
19477         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
19478         return ret_conv;
19479 }
19480
19481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19482         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
19483         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19484         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
19485         return tag_ptr(ret_conv, true);
19486 }
19487
19488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19489         LDKChannelInfo o_conv;
19490         o_conv.inner = untag_ptr(o);
19491         o_conv.is_owned = ptr_is_owned(o);
19492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19493         o_conv = ChannelInfo_clone(&o_conv);
19494         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19495         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19496         return tag_ptr(ret_conv, true);
19497 }
19498
19499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19500         void* e_ptr = untag_ptr(e);
19501         CHECK_ACCESS(e_ptr);
19502         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19503         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19504         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19505         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19506         return tag_ptr(ret_conv, true);
19507 }
19508
19509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19510         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
19511         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19512         return ret_conv;
19513 }
19514
19515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19516         if (!ptr_is_owned(_res)) return;
19517         void* _res_ptr = untag_ptr(_res);
19518         CHECK_ACCESS(_res_ptr);
19519         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19520         FREE(untag_ptr(_res));
19521         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19522 }
19523
19524 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19525         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19526         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19527         return tag_ptr(ret_conv, true);
19528 }
19529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19530         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
19531         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19532         return ret_conv;
19533 }
19534
19535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19536         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
19537         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19538         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19539         return tag_ptr(ret_conv, true);
19540 }
19541
19542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19543         LDKRoutingFees o_conv;
19544         o_conv.inner = untag_ptr(o);
19545         o_conv.is_owned = ptr_is_owned(o);
19546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19547         o_conv = RoutingFees_clone(&o_conv);
19548         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19549         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19550         return tag_ptr(ret_conv, true);
19551 }
19552
19553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19554         void* e_ptr = untag_ptr(e);
19555         CHECK_ACCESS(e_ptr);
19556         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19557         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19558         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19559         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19560         return tag_ptr(ret_conv, true);
19561 }
19562
19563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19564         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
19565         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19566         return ret_conv;
19567 }
19568
19569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19570         if (!ptr_is_owned(_res)) return;
19571         void* _res_ptr = untag_ptr(_res);
19572         CHECK_ACCESS(_res_ptr);
19573         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19574         FREE(untag_ptr(_res));
19575         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19576 }
19577
19578 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19579         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19580         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19581         return tag_ptr(ret_conv, true);
19582 }
19583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19584         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
19585         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19586         return ret_conv;
19587 }
19588
19589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19590         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
19591         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19592         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19593         return tag_ptr(ret_conv, true);
19594 }
19595
19596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19597         LDKCVec_NetAddressZ _res_constr;
19598         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19599         if (_res_constr.datalen > 0)
19600                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19601         else
19602                 _res_constr.data = NULL;
19603         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19604         for (size_t m = 0; m < _res_constr.datalen; m++) {
19605                 int64_t _res_conv_12 = _res_vals[m];
19606                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
19607                 CHECK_ACCESS(_res_conv_12_ptr);
19608                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
19609                 FREE(untag_ptr(_res_conv_12));
19610                 _res_constr.data[m] = _res_conv_12_conv;
19611         }
19612         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19613         CVec_NetAddressZ_free(_res_constr);
19614 }
19615
19616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19617         LDKNodeAnnouncementInfo o_conv;
19618         o_conv.inner = untag_ptr(o);
19619         o_conv.is_owned = ptr_is_owned(o);
19620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19621         o_conv = NodeAnnouncementInfo_clone(&o_conv);
19622         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19623         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19624         return tag_ptr(ret_conv, true);
19625 }
19626
19627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19628         void* e_ptr = untag_ptr(e);
19629         CHECK_ACCESS(e_ptr);
19630         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19631         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19632         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19633         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19634         return tag_ptr(ret_conv, true);
19635 }
19636
19637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19638         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
19639         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19640         return ret_conv;
19641 }
19642
19643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19644         if (!ptr_is_owned(_res)) return;
19645         void* _res_ptr = untag_ptr(_res);
19646         CHECK_ACCESS(_res_ptr);
19647         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19648         FREE(untag_ptr(_res));
19649         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19650 }
19651
19652 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19653         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19654         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19655         return tag_ptr(ret_conv, true);
19656 }
19657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19658         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
19659         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19660         return ret_conv;
19661 }
19662
19663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19664         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
19665         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19666         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19667         return tag_ptr(ret_conv, true);
19668 }
19669
19670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19671         LDKNodeAlias o_conv;
19672         o_conv.inner = untag_ptr(o);
19673         o_conv.is_owned = ptr_is_owned(o);
19674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19675         o_conv = NodeAlias_clone(&o_conv);
19676         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19677         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
19678         return tag_ptr(ret_conv, true);
19679 }
19680
19681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19682         void* e_ptr = untag_ptr(e);
19683         CHECK_ACCESS(e_ptr);
19684         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19685         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19686         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19687         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
19688         return tag_ptr(ret_conv, true);
19689 }
19690
19691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19692         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
19693         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
19694         return ret_conv;
19695 }
19696
19697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19698         if (!ptr_is_owned(_res)) return;
19699         void* _res_ptr = untag_ptr(_res);
19700         CHECK_ACCESS(_res_ptr);
19701         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
19702         FREE(untag_ptr(_res));
19703         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
19704 }
19705
19706 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
19707         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19708         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
19709         return tag_ptr(ret_conv, true);
19710 }
19711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19712         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
19713         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
19714         return ret_conv;
19715 }
19716
19717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19718         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
19719         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19720         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
19721         return tag_ptr(ret_conv, true);
19722 }
19723
19724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19725         LDKNodeInfo o_conv;
19726         o_conv.inner = untag_ptr(o);
19727         o_conv.is_owned = ptr_is_owned(o);
19728         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19729         o_conv = NodeInfo_clone(&o_conv);
19730         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19731         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
19732         return tag_ptr(ret_conv, true);
19733 }
19734
19735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19736         void* e_ptr = untag_ptr(e);
19737         CHECK_ACCESS(e_ptr);
19738         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19739         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19740         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19741         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
19742         return tag_ptr(ret_conv, true);
19743 }
19744
19745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19746         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
19747         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
19748         return ret_conv;
19749 }
19750
19751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19752         if (!ptr_is_owned(_res)) return;
19753         void* _res_ptr = untag_ptr(_res);
19754         CHECK_ACCESS(_res_ptr);
19755         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
19756         FREE(untag_ptr(_res));
19757         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
19758 }
19759
19760 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
19761         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19762         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
19763         return tag_ptr(ret_conv, true);
19764 }
19765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19766         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
19767         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
19768         return ret_conv;
19769 }
19770
19771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19772         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
19773         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19774         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
19775         return tag_ptr(ret_conv, true);
19776 }
19777
19778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19779         LDKNetworkGraph o_conv;
19780         o_conv.inner = untag_ptr(o);
19781         o_conv.is_owned = ptr_is_owned(o);
19782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19783         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
19784         
19785         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19786         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
19787         return tag_ptr(ret_conv, true);
19788 }
19789
19790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19791         void* e_ptr = untag_ptr(e);
19792         CHECK_ACCESS(e_ptr);
19793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19795         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19796         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
19797         return tag_ptr(ret_conv, true);
19798 }
19799
19800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19801         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
19802         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
19803         return ret_conv;
19804 }
19805
19806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19807         if (!ptr_is_owned(_res)) return;
19808         void* _res_ptr = untag_ptr(_res);
19809         CHECK_ACCESS(_res_ptr);
19810         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
19811         FREE(untag_ptr(_res));
19812         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
19813 }
19814
19815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
19816         LDKCVec_NetAddressZ o_constr;
19817         o_constr.datalen = (*env)->GetArrayLength(env, o);
19818         if (o_constr.datalen > 0)
19819                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19820         else
19821                 o_constr.data = NULL;
19822         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
19823         for (size_t m = 0; m < o_constr.datalen; m++) {
19824                 int64_t o_conv_12 = o_vals[m];
19825                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
19826                 CHECK_ACCESS(o_conv_12_ptr);
19827                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
19828                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
19829                 o_constr.data[m] = o_conv_12_conv;
19830         }
19831         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
19832         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19833         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
19834         int64_t ret_ref = tag_ptr(ret_copy, true);
19835         return ret_ref;
19836 }
19837
19838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
19839         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19840         *ret_copy = COption_CVec_NetAddressZZ_none();
19841         int64_t ret_ref = tag_ptr(ret_copy, true);
19842         return ret_ref;
19843 }
19844
19845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19846         if (!ptr_is_owned(_res)) return;
19847         void* _res_ptr = untag_ptr(_res);
19848         CHECK_ACCESS(_res_ptr);
19849         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
19850         FREE(untag_ptr(_res));
19851         COption_CVec_NetAddressZZ_free(_res_conv);
19852 }
19853
19854 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
19855         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19856         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
19857         int64_t ret_ref = tag_ptr(ret_copy, true);
19858         return ret_ref;
19859 }
19860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19861         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
19862         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
19863         return ret_conv;
19864 }
19865
19866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19867         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
19868         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19869         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
19870         int64_t ret_ref = tag_ptr(ret_copy, true);
19871         return ret_ref;
19872 }
19873
19874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19875         LDKDelayedPaymentOutputDescriptor o_conv;
19876         o_conv.inner = untag_ptr(o);
19877         o_conv.is_owned = ptr_is_owned(o);
19878         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19879         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19880         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19881         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19882         return tag_ptr(ret_conv, true);
19883 }
19884
19885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19886         void* e_ptr = untag_ptr(e);
19887         CHECK_ACCESS(e_ptr);
19888         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19889         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19890         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19891         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19892         return tag_ptr(ret_conv, true);
19893 }
19894
19895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19896         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19897         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19898         return ret_conv;
19899 }
19900
19901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19902         if (!ptr_is_owned(_res)) return;
19903         void* _res_ptr = untag_ptr(_res);
19904         CHECK_ACCESS(_res_ptr);
19905         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19906         FREE(untag_ptr(_res));
19907         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19908 }
19909
19910 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19911         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19912         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19913         return tag_ptr(ret_conv, true);
19914 }
19915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19916         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19917         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19918         return ret_conv;
19919 }
19920
19921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19922         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19923         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19924         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19925         return tag_ptr(ret_conv, true);
19926 }
19927
19928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19929         LDKStaticPaymentOutputDescriptor o_conv;
19930         o_conv.inner = untag_ptr(o);
19931         o_conv.is_owned = ptr_is_owned(o);
19932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19933         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19934         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19935         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19936         return tag_ptr(ret_conv, true);
19937 }
19938
19939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19940         void* e_ptr = untag_ptr(e);
19941         CHECK_ACCESS(e_ptr);
19942         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19943         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19944         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19945         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19946         return tag_ptr(ret_conv, true);
19947 }
19948
19949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19950         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19951         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19952         return ret_conv;
19953 }
19954
19955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19956         if (!ptr_is_owned(_res)) return;
19957         void* _res_ptr = untag_ptr(_res);
19958         CHECK_ACCESS(_res_ptr);
19959         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19960         FREE(untag_ptr(_res));
19961         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19962 }
19963
19964 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19965         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19966         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19967         return tag_ptr(ret_conv, true);
19968 }
19969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19970         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19971         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19972         return ret_conv;
19973 }
19974
19975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19976         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19977         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19978         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19979         return tag_ptr(ret_conv, true);
19980 }
19981
19982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19983         void* o_ptr = untag_ptr(o);
19984         CHECK_ACCESS(o_ptr);
19985         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19986         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19987         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19988         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19989         return tag_ptr(ret_conv, true);
19990 }
19991
19992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19993         void* e_ptr = untag_ptr(e);
19994         CHECK_ACCESS(e_ptr);
19995         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19996         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19997         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19998         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19999         return tag_ptr(ret_conv, true);
20000 }
20001
20002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20003         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
20004         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
20005         return ret_conv;
20006 }
20007
20008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20009         if (!ptr_is_owned(_res)) return;
20010         void* _res_ptr = untag_ptr(_res);
20011         CHECK_ACCESS(_res_ptr);
20012         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
20013         FREE(untag_ptr(_res));
20014         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
20015 }
20016
20017 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
20018         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
20019         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
20020         return tag_ptr(ret_conv, true);
20021 }
20022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20023         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
20024         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
20025         return ret_conv;
20026 }
20027
20028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20029         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
20030         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
20031         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
20032         return tag_ptr(ret_conv, true);
20033 }
20034
20035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20036         LDKCVec_PaymentPreimageZ _res_constr;
20037         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20038         if (_res_constr.datalen > 0)
20039                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
20040         else
20041                 _res_constr.data = NULL;
20042         for (size_t i = 0; i < _res_constr.datalen; i++) {
20043                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20044                 LDKThirtyTwoBytes _res_conv_8_ref;
20045                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
20046                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
20047                 _res_constr.data[i] = _res_conv_8_ref;
20048         }
20049         CVec_PaymentPreimageZ_free(_res_constr);
20050 }
20051
20052 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
20053         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20054         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
20055         return tag_ptr(ret_conv, true);
20056 }
20057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20058         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
20059         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
20060         return ret_conv;
20061 }
20062
20063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20064         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
20065         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20066         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
20067         return tag_ptr(ret_conv, true);
20068 }
20069
20070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
20071         LDKSignature a_ref;
20072         CHECK((*env)->GetArrayLength(env, a) == 64);
20073         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
20074         LDKCVec_SignatureZ b_constr;
20075         b_constr.datalen = (*env)->GetArrayLength(env, b);
20076         if (b_constr.datalen > 0)
20077                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20078         else
20079                 b_constr.data = NULL;
20080         for (size_t i = 0; i < b_constr.datalen; i++) {
20081                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
20082                 LDKSignature b_conv_8_ref;
20083                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
20084                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
20085                 b_constr.data[i] = b_conv_8_ref;
20086         }
20087         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20088         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
20089         return tag_ptr(ret_conv, true);
20090 }
20091
20092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20093         if (!ptr_is_owned(_res)) return;
20094         void* _res_ptr = untag_ptr(_res);
20095         CHECK_ACCESS(_res_ptr);
20096         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
20097         FREE(untag_ptr(_res));
20098         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
20099 }
20100
20101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20102         void* o_ptr = untag_ptr(o);
20103         CHECK_ACCESS(o_ptr);
20104         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
20105         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
20106         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20107         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
20108         return tag_ptr(ret_conv, true);
20109 }
20110
20111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
20112         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20113         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
20114         return tag_ptr(ret_conv, true);
20115 }
20116
20117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20118         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
20119         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
20120         return ret_conv;
20121 }
20122
20123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20124         if (!ptr_is_owned(_res)) return;
20125         void* _res_ptr = untag_ptr(_res);
20126         CHECK_ACCESS(_res_ptr);
20127         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
20128         FREE(untag_ptr(_res));
20129         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
20130 }
20131
20132 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
20133         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20134         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
20135         return tag_ptr(ret_conv, true);
20136 }
20137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20138         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
20139         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
20140         return ret_conv;
20141 }
20142
20143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20144         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
20145         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20146         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
20147         return tag_ptr(ret_conv, true);
20148 }
20149
20150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20151         LDKSignature o_ref;
20152         CHECK((*env)->GetArrayLength(env, o) == 64);
20153         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
20154         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20155         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
20156         return tag_ptr(ret_conv, true);
20157 }
20158
20159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
20160         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20161         *ret_conv = CResult_SignatureNoneZ_err();
20162         return tag_ptr(ret_conv, true);
20163 }
20164
20165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20166         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
20167         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
20168         return ret_conv;
20169 }
20170
20171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20172         if (!ptr_is_owned(_res)) return;
20173         void* _res_ptr = untag_ptr(_res);
20174         CHECK_ACCESS(_res_ptr);
20175         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
20176         FREE(untag_ptr(_res));
20177         CResult_SignatureNoneZ_free(_res_conv);
20178 }
20179
20180 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
20181         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20182         *ret_conv = CResult_SignatureNoneZ_clone(arg);
20183         return tag_ptr(ret_conv, true);
20184 }
20185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20186         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
20187         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
20188         return ret_conv;
20189 }
20190
20191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20192         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
20193         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20194         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
20195         return tag_ptr(ret_conv, true);
20196 }
20197
20198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20199         LDKPublicKey o_ref;
20200         CHECK((*env)->GetArrayLength(env, o) == 33);
20201         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
20202         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20203         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
20204         return tag_ptr(ret_conv, true);
20205 }
20206
20207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
20208         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20209         *ret_conv = CResult_PublicKeyNoneZ_err();
20210         return tag_ptr(ret_conv, true);
20211 }
20212
20213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20214         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
20215         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
20216         return ret_conv;
20217 }
20218
20219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20220         if (!ptr_is_owned(_res)) return;
20221         void* _res_ptr = untag_ptr(_res);
20222         CHECK_ACCESS(_res_ptr);
20223         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
20224         FREE(untag_ptr(_res));
20225         CResult_PublicKeyNoneZ_free(_res_conv);
20226 }
20227
20228 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
20229         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20230         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
20231         return tag_ptr(ret_conv, true);
20232 }
20233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20234         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
20235         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
20236         return ret_conv;
20237 }
20238
20239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20240         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
20241         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20242         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
20243         return tag_ptr(ret_conv, true);
20244 }
20245
20246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20247         void* o_ptr = untag_ptr(o);
20248         CHECK_ACCESS(o_ptr);
20249         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
20250         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
20251         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20252         *ret_copy = COption_ScalarZ_some(o_conv);
20253         int64_t ret_ref = tag_ptr(ret_copy, true);
20254         return ret_ref;
20255 }
20256
20257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1none(JNIEnv *env, jclass clz) {
20258         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20259         *ret_copy = COption_ScalarZ_none();
20260         int64_t ret_ref = tag_ptr(ret_copy, true);
20261         return ret_ref;
20262 }
20263
20264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20265         if (!ptr_is_owned(_res)) return;
20266         void* _res_ptr = untag_ptr(_res);
20267         CHECK_ACCESS(_res_ptr);
20268         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
20269         FREE(untag_ptr(_res));
20270         COption_ScalarZ_free(_res_conv);
20271 }
20272
20273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20274         LDKThirtyTwoBytes o_ref;
20275         CHECK((*env)->GetArrayLength(env, o) == 32);
20276         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20277         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20278         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
20279         return tag_ptr(ret_conv, true);
20280 }
20281
20282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1err(JNIEnv *env, jclass clz) {
20283         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20284         *ret_conv = CResult_SharedSecretNoneZ_err();
20285         return tag_ptr(ret_conv, true);
20286 }
20287
20288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20289         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
20290         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
20291         return ret_conv;
20292 }
20293
20294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20295         if (!ptr_is_owned(_res)) return;
20296         void* _res_ptr = untag_ptr(_res);
20297         CHECK_ACCESS(_res_ptr);
20298         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
20299         FREE(untag_ptr(_res));
20300         CResult_SharedSecretNoneZ_free(_res_conv);
20301 }
20302
20303 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
20304         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20305         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
20306         return tag_ptr(ret_conv, true);
20307 }
20308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20309         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
20310         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
20311         return ret_conv;
20312 }
20313
20314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20315         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
20316         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20317         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
20318         return tag_ptr(ret_conv, true);
20319 }
20320
20321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20322         LDKCVec_U5Z _res_constr;
20323         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20324         if (_res_constr.datalen > 0)
20325                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
20326         else
20327                 _res_constr.data = NULL;
20328         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
20329         for (size_t h = 0; h < _res_constr.datalen; h++) {
20330                 int8_t _res_conv_7 = _res_vals[h];
20331                 
20332                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
20333         }
20334         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
20335         CVec_U5Z_free(_res_constr);
20336 }
20337
20338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20339         LDKRecoverableSignature o_ref;
20340         CHECK((*env)->GetArrayLength(env, o) == 68);
20341         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
20342         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20343         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
20344         return tag_ptr(ret_conv, true);
20345 }
20346
20347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
20348         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20349         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
20350         return tag_ptr(ret_conv, true);
20351 }
20352
20353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20354         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
20355         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
20356         return ret_conv;
20357 }
20358
20359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20360         if (!ptr_is_owned(_res)) return;
20361         void* _res_ptr = untag_ptr(_res);
20362         CHECK_ACCESS(_res_ptr);
20363         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
20364         FREE(untag_ptr(_res));
20365         CResult_RecoverableSignatureNoneZ_free(_res_conv);
20366 }
20367
20368 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
20369         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20370         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
20371         return tag_ptr(ret_conv, true);
20372 }
20373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20374         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
20375         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
20376         return ret_conv;
20377 }
20378
20379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20380         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
20381         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20382         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
20383         return tag_ptr(ret_conv, true);
20384 }
20385
20386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20387         void* o_ptr = untag_ptr(o);
20388         CHECK_ACCESS(o_ptr);
20389         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
20390         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
20391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20392                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
20393         }
20394         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20395         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
20396         return tag_ptr(ret_conv, true);
20397 }
20398
20399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20400         void* e_ptr = untag_ptr(e);
20401         CHECK_ACCESS(e_ptr);
20402         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20403         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20404         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20405         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
20406         return tag_ptr(ret_conv, true);
20407 }
20408
20409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20410         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
20411         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
20412         return ret_conv;
20413 }
20414
20415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20416         if (!ptr_is_owned(_res)) return;
20417         void* _res_ptr = untag_ptr(_res);
20418         CHECK_ACCESS(_res_ptr);
20419         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
20420         FREE(untag_ptr(_res));
20421         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
20422 }
20423
20424 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
20425         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20426         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
20427         return tag_ptr(ret_conv, true);
20428 }
20429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20430         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
20431         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
20432         return ret_conv;
20433 }
20434
20435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20436         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
20437         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20438         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
20439         return tag_ptr(ret_conv, true);
20440 }
20441
20442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20443         LDKCVec_u8Z _res_ref;
20444         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20445         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
20446         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20447         CVec_u8Z_free(_res_ref);
20448 }
20449
20450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20451         LDKCVec_CVec_u8ZZ _res_constr;
20452         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20453         if (_res_constr.datalen > 0)
20454                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
20455         else
20456                 _res_constr.data = NULL;
20457         for (size_t i = 0; i < _res_constr.datalen; i++) {
20458                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20459                 LDKCVec_u8Z _res_conv_8_ref;
20460                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
20461                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
20462                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
20463                 _res_constr.data[i] = _res_conv_8_ref;
20464         }
20465         CVec_CVec_u8ZZ_free(_res_constr);
20466 }
20467
20468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
20469         LDKCVec_CVec_u8ZZ o_constr;
20470         o_constr.datalen = (*env)->GetArrayLength(env, o);
20471         if (o_constr.datalen > 0)
20472                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
20473         else
20474                 o_constr.data = NULL;
20475         for (size_t i = 0; i < o_constr.datalen; i++) {
20476                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
20477                 LDKCVec_u8Z o_conv_8_ref;
20478                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
20479                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
20480                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
20481                 o_constr.data[i] = o_conv_8_ref;
20482         }
20483         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20484         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
20485         return tag_ptr(ret_conv, true);
20486 }
20487
20488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
20489         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20490         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
20491         return tag_ptr(ret_conv, true);
20492 }
20493
20494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20495         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
20496         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
20497         return ret_conv;
20498 }
20499
20500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20501         if (!ptr_is_owned(_res)) return;
20502         void* _res_ptr = untag_ptr(_res);
20503         CHECK_ACCESS(_res_ptr);
20504         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
20505         FREE(untag_ptr(_res));
20506         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
20507 }
20508
20509 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
20510         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20511         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
20512         return tag_ptr(ret_conv, true);
20513 }
20514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20515         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
20516         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
20517         return ret_conv;
20518 }
20519
20520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20521         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
20522         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20523         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
20524         return tag_ptr(ret_conv, true);
20525 }
20526
20527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20528         LDKInMemorySigner o_conv;
20529         o_conv.inner = untag_ptr(o);
20530         o_conv.is_owned = ptr_is_owned(o);
20531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20532         o_conv = InMemorySigner_clone(&o_conv);
20533         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20534         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20535         return tag_ptr(ret_conv, true);
20536 }
20537
20538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20539         void* e_ptr = untag_ptr(e);
20540         CHECK_ACCESS(e_ptr);
20541         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20542         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20543         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20544         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20545         return tag_ptr(ret_conv, true);
20546 }
20547
20548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20549         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20550         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20551         return ret_conv;
20552 }
20553
20554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20555         if (!ptr_is_owned(_res)) return;
20556         void* _res_ptr = untag_ptr(_res);
20557         CHECK_ACCESS(_res_ptr);
20558         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20559         FREE(untag_ptr(_res));
20560         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20561 }
20562
20563 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20564         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20565         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20566         return tag_ptr(ret_conv, true);
20567 }
20568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20569         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20570         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20571         return ret_conv;
20572 }
20573
20574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20575         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20576         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20577         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20578         return tag_ptr(ret_conv, true);
20579 }
20580
20581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20582         LDKCVec_TxOutZ _res_constr;
20583         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20584         if (_res_constr.datalen > 0)
20585                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20586         else
20587                 _res_constr.data = NULL;
20588         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20589         for (size_t h = 0; h < _res_constr.datalen; h++) {
20590                 int64_t _res_conv_7 = _res_vals[h];
20591                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
20592                 CHECK_ACCESS(_res_conv_7_ptr);
20593                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
20594                 FREE(untag_ptr(_res_conv_7));
20595                 _res_constr.data[h] = _res_conv_7_conv;
20596         }
20597         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20598         CVec_TxOutZ_free(_res_constr);
20599 }
20600
20601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20602         LDKTransaction o_ref;
20603         o_ref.datalen = (*env)->GetArrayLength(env, o);
20604         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
20605         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20606         o_ref.data_is_owned = true;
20607         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20608         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
20609         return tag_ptr(ret_conv, true);
20610 }
20611
20612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
20613         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20614         *ret_conv = CResult_TransactionNoneZ_err();
20615         return tag_ptr(ret_conv, true);
20616 }
20617
20618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20619         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
20620         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
20621         return ret_conv;
20622 }
20623
20624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20625         if (!ptr_is_owned(_res)) return;
20626         void* _res_ptr = untag_ptr(_res);
20627         CHECK_ACCESS(_res_ptr);
20628         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
20629         FREE(untag_ptr(_res));
20630         CResult_TransactionNoneZ_free(_res_conv);
20631 }
20632
20633 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
20634         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20635         *ret_conv = CResult_TransactionNoneZ_clone(arg);
20636         return tag_ptr(ret_conv, true);
20637 }
20638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20639         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
20640         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
20641         return ret_conv;
20642 }
20643
20644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20645         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
20646         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20647         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
20648         return tag_ptr(ret_conv, true);
20649 }
20650
20651 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
20652         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
20653         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
20654         return tag_ptr(ret_conv, true);
20655 }
20656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20657         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
20658         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
20659         return ret_conv;
20660 }
20661
20662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20663         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
20664         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
20665         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
20666         return tag_ptr(ret_conv, true);
20667 }
20668
20669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20670         LDKThirtyTwoBytes a_ref;
20671         CHECK((*env)->GetArrayLength(env, a) == 32);
20672         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20673         LDKChannelMonitor b_conv;
20674         b_conv.inner = untag_ptr(b);
20675         b_conv.is_owned = ptr_is_owned(b);
20676         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20677         b_conv = ChannelMonitor_clone(&b_conv);
20678         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
20679         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
20680         return tag_ptr(ret_conv, true);
20681 }
20682
20683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20684         if (!ptr_is_owned(_res)) return;
20685         void* _res_ptr = untag_ptr(_res);
20686         CHECK_ACCESS(_res_ptr);
20687         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
20688         FREE(untag_ptr(_res));
20689         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
20690 }
20691
20692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20693         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
20694         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20695         if (_res_constr.datalen > 0)
20696                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
20697         else
20698                 _res_constr.data = NULL;
20699         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20700         for (size_t j = 0; j < _res_constr.datalen; j++) {
20701                 int64_t _res_conv_35 = _res_vals[j];
20702                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
20703                 CHECK_ACCESS(_res_conv_35_ptr);
20704                 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
20705                 FREE(untag_ptr(_res_conv_35));
20706                 _res_constr.data[j] = _res_conv_35_conv;
20707         }
20708         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20709         CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
20710 }
20711
20712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
20713         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
20714         o_constr.datalen = (*env)->GetArrayLength(env, o);
20715         if (o_constr.datalen > 0)
20716                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
20717         else
20718                 o_constr.data = NULL;
20719         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
20720         for (size_t j = 0; j < o_constr.datalen; j++) {
20721                 int64_t o_conv_35 = o_vals[j];
20722                 void* o_conv_35_ptr = untag_ptr(o_conv_35);
20723                 CHECK_ACCESS(o_conv_35_ptr);
20724                 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
20725                 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o_conv_35));
20726                 o_constr.data[j] = o_conv_35_conv;
20727         }
20728         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
20729         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
20730         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
20731         return tag_ptr(ret_conv, true);
20732 }
20733
20734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20735         LDKIOError e_conv = LDKIOError_from_java(env, e);
20736         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
20737         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
20738         return tag_ptr(ret_conv, true);
20739 }
20740
20741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20742         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(o);
20743         jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
20744         return ret_conv;
20745 }
20746
20747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20748         if (!ptr_is_owned(_res)) return;
20749         void* _res_ptr = untag_ptr(_res);
20750         CHECK_ACCESS(_res_ptr);
20751         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
20752         FREE(untag_ptr(_res));
20753         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
20754 }
20755
20756 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
20757         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
20758         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
20759         return tag_ptr(ret_conv, true);
20760 }
20761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20762         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(arg);
20763         int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
20764         return ret_conv;
20765 }
20766
20767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20768         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(orig);
20769         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
20770         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
20771         return tag_ptr(ret_conv, true);
20772 }
20773
20774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
20775         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20776         *ret_copy = COption_u16Z_some(o);
20777         int64_t ret_ref = tag_ptr(ret_copy, true);
20778         return ret_ref;
20779 }
20780
20781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
20782         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20783         *ret_copy = COption_u16Z_none();
20784         int64_t ret_ref = tag_ptr(ret_copy, true);
20785         return ret_ref;
20786 }
20787
20788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
20789         if (!ptr_is_owned(_res)) return;
20790         void* _res_ptr = untag_ptr(_res);
20791         CHECK_ACCESS(_res_ptr);
20792         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20793         FREE(untag_ptr(_res));
20794         COption_u16Z_free(_res_conv);
20795 }
20796
20797 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20798         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20799         *ret_copy = COption_u16Z_clone(arg);
20800         int64_t ret_ref = tag_ptr(ret_copy, true);
20801         return ret_ref;
20802 }
20803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20804         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20805         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20806         return ret_conv;
20807 }
20808
20809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20810         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20811         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20812         *ret_copy = COption_u16Z_clone(orig_conv);
20813         int64_t ret_ref = tag_ptr(ret_copy, true);
20814         return ret_ref;
20815 }
20816
20817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20818         LDKThirtyTwoBytes o_ref;
20819         CHECK((*env)->GetArrayLength(env, o) == 32);
20820         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20821         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20822         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
20823         return tag_ptr(ret_conv, true);
20824 }
20825
20826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20827         void* e_ptr = untag_ptr(e);
20828         CHECK_ACCESS(e_ptr);
20829         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20830         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20831         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20832         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
20833         return tag_ptr(ret_conv, true);
20834 }
20835
20836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20837         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
20838         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
20839         return ret_conv;
20840 }
20841
20842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20843         if (!ptr_is_owned(_res)) return;
20844         void* _res_ptr = untag_ptr(_res);
20845         CHECK_ACCESS(_res_ptr);
20846         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
20847         FREE(untag_ptr(_res));
20848         CResult__u832APIErrorZ_free(_res_conv);
20849 }
20850
20851 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
20852         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20853         *ret_conv = CResult__u832APIErrorZ_clone(arg);
20854         return tag_ptr(ret_conv, true);
20855 }
20856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20857         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
20858         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
20859         return ret_conv;
20860 }
20861
20862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20863         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
20864         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20865         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
20866         return tag_ptr(ret_conv, true);
20867 }
20868
20869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20870         LDKCVec_RecentPaymentDetailsZ _res_constr;
20871         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20872         if (_res_constr.datalen > 0)
20873                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
20874         else
20875                 _res_constr.data = NULL;
20876         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20877         for (size_t w = 0; w < _res_constr.datalen; w++) {
20878                 int64_t _res_conv_22 = _res_vals[w];
20879                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20880                 CHECK_ACCESS(_res_conv_22_ptr);
20881                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
20882                 FREE(untag_ptr(_res_conv_22));
20883                 _res_constr.data[w] = _res_conv_22_conv;
20884         }
20885         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20886         CVec_RecentPaymentDetailsZ_free(_res_constr);
20887 }
20888
20889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
20890         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20891         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20892         return tag_ptr(ret_conv, true);
20893 }
20894
20895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20896         void* e_ptr = untag_ptr(e);
20897         CHECK_ACCESS(e_ptr);
20898         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20899         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20900         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20901         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20902         return tag_ptr(ret_conv, true);
20903 }
20904
20905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20906         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20907         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20908         return ret_conv;
20909 }
20910
20911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20912         if (!ptr_is_owned(_res)) return;
20913         void* _res_ptr = untag_ptr(_res);
20914         CHECK_ACCESS(_res_ptr);
20915         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20916         FREE(untag_ptr(_res));
20917         CResult_NonePaymentSendFailureZ_free(_res_conv);
20918 }
20919
20920 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20921         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20922         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20923         return tag_ptr(ret_conv, true);
20924 }
20925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20926         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20927         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20928         return ret_conv;
20929 }
20930
20931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20932         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20933         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20934         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20935         return tag_ptr(ret_conv, true);
20936 }
20937
20938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
20939         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20940         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
20941         return tag_ptr(ret_conv, true);
20942 }
20943
20944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
20945         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
20946         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20947         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
20948         return tag_ptr(ret_conv, true);
20949 }
20950
20951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20952         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
20953         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
20954         return ret_conv;
20955 }
20956
20957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20958         if (!ptr_is_owned(_res)) return;
20959         void* _res_ptr = untag_ptr(_res);
20960         CHECK_ACCESS(_res_ptr);
20961         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
20962         FREE(untag_ptr(_res));
20963         CResult_NoneRetryableSendFailureZ_free(_res_conv);
20964 }
20965
20966 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
20967         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20968         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
20969         return tag_ptr(ret_conv, true);
20970 }
20971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20972         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
20973         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
20974         return ret_conv;
20975 }
20976
20977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20978         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
20979         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20980         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
20981         return tag_ptr(ret_conv, true);
20982 }
20983
20984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20985         LDKThirtyTwoBytes o_ref;
20986         CHECK((*env)->GetArrayLength(env, o) == 32);
20987         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20988         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20989         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
20990         return tag_ptr(ret_conv, true);
20991 }
20992
20993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20994         void* e_ptr = untag_ptr(e);
20995         CHECK_ACCESS(e_ptr);
20996         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20997         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20998         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20999         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
21000         return tag_ptr(ret_conv, true);
21001 }
21002
21003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21004         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
21005         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
21006         return ret_conv;
21007 }
21008
21009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21010         if (!ptr_is_owned(_res)) return;
21011         void* _res_ptr = untag_ptr(_res);
21012         CHECK_ACCESS(_res_ptr);
21013         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
21014         FREE(untag_ptr(_res));
21015         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
21016 }
21017
21018 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
21019         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
21020         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
21021         return tag_ptr(ret_conv, true);
21022 }
21023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21024         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
21025         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
21026         return ret_conv;
21027 }
21028
21029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21030         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
21031         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
21032         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
21033         return tag_ptr(ret_conv, true);
21034 }
21035
21036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21037         LDKThirtyTwoBytes o_ref;
21038         CHECK((*env)->GetArrayLength(env, o) == 32);
21039         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21040         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
21041         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
21042         return tag_ptr(ret_conv, true);
21043 }
21044
21045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
21046         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
21047         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
21048         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
21049         return tag_ptr(ret_conv, true);
21050 }
21051
21052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21053         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
21054         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
21055         return ret_conv;
21056 }
21057
21058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21059         if (!ptr_is_owned(_res)) return;
21060         void* _res_ptr = untag_ptr(_res);
21061         CHECK_ACCESS(_res_ptr);
21062         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
21063         FREE(untag_ptr(_res));
21064         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
21065 }
21066
21067 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
21068         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
21069         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
21070         return tag_ptr(ret_conv, true);
21071 }
21072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21073         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
21074         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
21075         return ret_conv;
21076 }
21077
21078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21079         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
21080         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
21081         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
21082         return tag_ptr(ret_conv, true);
21083 }
21084
21085 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
21086         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
21087         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
21088         return tag_ptr(ret_conv, true);
21089 }
21090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21091         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
21092         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
21093         return ret_conv;
21094 }
21095
21096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21097         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
21098         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
21099         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
21100         return tag_ptr(ret_conv, true);
21101 }
21102
21103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
21104         LDKThirtyTwoBytes a_ref;
21105         CHECK((*env)->GetArrayLength(env, a) == 32);
21106         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21107         LDKThirtyTwoBytes b_ref;
21108         CHECK((*env)->GetArrayLength(env, b) == 32);
21109         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
21110         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
21111         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
21112         return tag_ptr(ret_conv, true);
21113 }
21114
21115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21116         if (!ptr_is_owned(_res)) return;
21117         void* _res_ptr = untag_ptr(_res);
21118         CHECK_ACCESS(_res_ptr);
21119         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
21120         FREE(untag_ptr(_res));
21121         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
21122 }
21123
21124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21125         void* o_ptr = untag_ptr(o);
21126         CHECK_ACCESS(o_ptr);
21127         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
21128         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
21129         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21130         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
21131         return tag_ptr(ret_conv, true);
21132 }
21133
21134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21135         void* e_ptr = untag_ptr(e);
21136         CHECK_ACCESS(e_ptr);
21137         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
21138         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
21139         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21140         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
21141         return tag_ptr(ret_conv, true);
21142 }
21143
21144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21145         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
21146         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
21147         return ret_conv;
21148 }
21149
21150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21151         if (!ptr_is_owned(_res)) return;
21152         void* _res_ptr = untag_ptr(_res);
21153         CHECK_ACCESS(_res_ptr);
21154         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
21155         FREE(untag_ptr(_res));
21156         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
21157 }
21158
21159 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
21160         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21161         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
21162         return tag_ptr(ret_conv, true);
21163 }
21164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21165         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
21166         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
21167         return ret_conv;
21168 }
21169
21170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21171         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
21172         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21173         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
21174         return tag_ptr(ret_conv, true);
21175 }
21176
21177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21178         LDKCVec_ThirtyTwoBytesZ _res_constr;
21179         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21180         if (_res_constr.datalen > 0)
21181                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
21182         else
21183                 _res_constr.data = NULL;
21184         for (size_t i = 0; i < _res_constr.datalen; i++) {
21185                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21186                 LDKThirtyTwoBytes _res_conv_8_ref;
21187                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
21188                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
21189                 _res_constr.data[i] = _res_conv_8_ref;
21190         }
21191         CVec_ThirtyTwoBytesZ_free(_res_constr);
21192 }
21193
21194 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
21195         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
21196         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
21197         return tag_ptr(ret_conv, true);
21198 }
21199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21200         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
21201         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
21202         return ret_conv;
21203 }
21204
21205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21206         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
21207         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
21208         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
21209         return tag_ptr(ret_conv, true);
21210 }
21211
21212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
21213         LDKThirtyTwoBytes a_ref;
21214         CHECK((*env)->GetArrayLength(env, a) == 32);
21215         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21216         LDKThirtyTwoBytes b_ref;
21217         CHECK((*env)->GetArrayLength(env, b) == 32);
21218         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
21219         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
21220         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
21221         return tag_ptr(ret_conv, true);
21222 }
21223
21224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21225         if (!ptr_is_owned(_res)) return;
21226         void* _res_ptr = untag_ptr(_res);
21227         CHECK_ACCESS(_res_ptr);
21228         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
21229         FREE(untag_ptr(_res));
21230         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
21231 }
21232
21233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21234         void* o_ptr = untag_ptr(o);
21235         CHECK_ACCESS(o_ptr);
21236         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
21237         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
21238         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21239         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
21240         return tag_ptr(ret_conv, true);
21241 }
21242
21243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
21244         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21245         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
21246         return tag_ptr(ret_conv, true);
21247 }
21248
21249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21250         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
21251         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
21252         return ret_conv;
21253 }
21254
21255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21256         if (!ptr_is_owned(_res)) return;
21257         void* _res_ptr = untag_ptr(_res);
21258         CHECK_ACCESS(_res_ptr);
21259         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
21260         FREE(untag_ptr(_res));
21261         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
21262 }
21263
21264 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
21265         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21266         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
21267         return tag_ptr(ret_conv, true);
21268 }
21269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21270         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
21271         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
21272         return ret_conv;
21273 }
21274
21275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21276         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
21277         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21278         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
21279         return tag_ptr(ret_conv, true);
21280 }
21281
21282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21283         void* o_ptr = untag_ptr(o);
21284         CHECK_ACCESS(o_ptr);
21285         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
21286         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
21287         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21288         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
21289         return tag_ptr(ret_conv, true);
21290 }
21291
21292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21293         void* e_ptr = untag_ptr(e);
21294         CHECK_ACCESS(e_ptr);
21295         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
21296         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
21297         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21298         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
21299         return tag_ptr(ret_conv, true);
21300 }
21301
21302 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21303         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
21304         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
21305         return ret_conv;
21306 }
21307
21308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21309         if (!ptr_is_owned(_res)) return;
21310         void* _res_ptr = untag_ptr(_res);
21311         CHECK_ACCESS(_res_ptr);
21312         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
21313         FREE(untag_ptr(_res));
21314         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
21315 }
21316
21317 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
21318         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21319         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
21320         return tag_ptr(ret_conv, true);
21321 }
21322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21323         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
21324         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
21325         return ret_conv;
21326 }
21327
21328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21329         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
21330         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21331         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
21332         return tag_ptr(ret_conv, true);
21333 }
21334
21335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21336         LDKThirtyTwoBytes o_ref;
21337         CHECK((*env)->GetArrayLength(env, o) == 32);
21338         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21339         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21340         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
21341         return tag_ptr(ret_conv, true);
21342 }
21343
21344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
21345         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21346         *ret_conv = CResult_PaymentSecretNoneZ_err();
21347         return tag_ptr(ret_conv, true);
21348 }
21349
21350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21351         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
21352         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
21353         return ret_conv;
21354 }
21355
21356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21357         if (!ptr_is_owned(_res)) return;
21358         void* _res_ptr = untag_ptr(_res);
21359         CHECK_ACCESS(_res_ptr);
21360         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
21361         FREE(untag_ptr(_res));
21362         CResult_PaymentSecretNoneZ_free(_res_conv);
21363 }
21364
21365 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
21366         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21367         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
21368         return tag_ptr(ret_conv, true);
21369 }
21370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21371         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
21372         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
21373         return ret_conv;
21374 }
21375
21376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21377         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
21378         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21379         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
21380         return tag_ptr(ret_conv, true);
21381 }
21382
21383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21384         LDKThirtyTwoBytes o_ref;
21385         CHECK((*env)->GetArrayLength(env, o) == 32);
21386         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21387         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21388         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
21389         return tag_ptr(ret_conv, true);
21390 }
21391
21392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21393         void* e_ptr = untag_ptr(e);
21394         CHECK_ACCESS(e_ptr);
21395         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
21396         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
21397         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21398         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
21399         return tag_ptr(ret_conv, true);
21400 }
21401
21402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21403         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
21404         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
21405         return ret_conv;
21406 }
21407
21408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21409         if (!ptr_is_owned(_res)) return;
21410         void* _res_ptr = untag_ptr(_res);
21411         CHECK_ACCESS(_res_ptr);
21412         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
21413         FREE(untag_ptr(_res));
21414         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
21415 }
21416
21417 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
21418         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21419         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
21420         return tag_ptr(ret_conv, true);
21421 }
21422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21423         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
21424         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
21425         return ret_conv;
21426 }
21427
21428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21429         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
21430         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21431         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
21432         return tag_ptr(ret_conv, true);
21433 }
21434
21435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21436         LDKThirtyTwoBytes o_ref;
21437         CHECK((*env)->GetArrayLength(env, o) == 32);
21438         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21439         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21440         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
21441         return tag_ptr(ret_conv, true);
21442 }
21443
21444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21445         void* e_ptr = untag_ptr(e);
21446         CHECK_ACCESS(e_ptr);
21447         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
21448         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
21449         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21450         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
21451         return tag_ptr(ret_conv, true);
21452 }
21453
21454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21455         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
21456         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
21457         return ret_conv;
21458 }
21459
21460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21461         if (!ptr_is_owned(_res)) return;
21462         void* _res_ptr = untag_ptr(_res);
21463         CHECK_ACCESS(_res_ptr);
21464         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
21465         FREE(untag_ptr(_res));
21466         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
21467 }
21468
21469 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
21470         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21471         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
21472         return tag_ptr(ret_conv, true);
21473 }
21474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21475         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
21476         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
21477         return ret_conv;
21478 }
21479
21480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21481         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
21482         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21483         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
21484         return tag_ptr(ret_conv, true);
21485 }
21486
21487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21488         LDKCounterpartyForwardingInfo o_conv;
21489         o_conv.inner = untag_ptr(o);
21490         o_conv.is_owned = ptr_is_owned(o);
21491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21492         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
21493         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21494         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
21495         return tag_ptr(ret_conv, true);
21496 }
21497
21498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21499         void* e_ptr = untag_ptr(e);
21500         CHECK_ACCESS(e_ptr);
21501         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21502         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21503         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21504         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
21505         return tag_ptr(ret_conv, true);
21506 }
21507
21508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21509         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
21510         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
21511         return ret_conv;
21512 }
21513
21514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21515         if (!ptr_is_owned(_res)) return;
21516         void* _res_ptr = untag_ptr(_res);
21517         CHECK_ACCESS(_res_ptr);
21518         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
21519         FREE(untag_ptr(_res));
21520         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
21521 }
21522
21523 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
21524         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21525         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
21526         return tag_ptr(ret_conv, true);
21527 }
21528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21529         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
21530         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
21531         return ret_conv;
21532 }
21533
21534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21535         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
21536         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21537         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
21538         return tag_ptr(ret_conv, true);
21539 }
21540
21541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21542         LDKChannelCounterparty o_conv;
21543         o_conv.inner = untag_ptr(o);
21544         o_conv.is_owned = ptr_is_owned(o);
21545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21546         o_conv = ChannelCounterparty_clone(&o_conv);
21547         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21548         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
21549         return tag_ptr(ret_conv, true);
21550 }
21551
21552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21553         void* e_ptr = untag_ptr(e);
21554         CHECK_ACCESS(e_ptr);
21555         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21556         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21557         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21558         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
21559         return tag_ptr(ret_conv, true);
21560 }
21561
21562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21563         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
21564         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
21565         return ret_conv;
21566 }
21567
21568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21569         if (!ptr_is_owned(_res)) return;
21570         void* _res_ptr = untag_ptr(_res);
21571         CHECK_ACCESS(_res_ptr);
21572         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
21573         FREE(untag_ptr(_res));
21574         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
21575 }
21576
21577 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
21578         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21579         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
21580         return tag_ptr(ret_conv, true);
21581 }
21582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21583         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
21584         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
21585         return ret_conv;
21586 }
21587
21588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21589         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
21590         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21591         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
21592         return tag_ptr(ret_conv, true);
21593 }
21594
21595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21596         LDKChannelDetails o_conv;
21597         o_conv.inner = untag_ptr(o);
21598         o_conv.is_owned = ptr_is_owned(o);
21599         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21600         o_conv = ChannelDetails_clone(&o_conv);
21601         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21602         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
21603         return tag_ptr(ret_conv, true);
21604 }
21605
21606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21607         void* e_ptr = untag_ptr(e);
21608         CHECK_ACCESS(e_ptr);
21609         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21610         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21611         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21612         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
21613         return tag_ptr(ret_conv, true);
21614 }
21615
21616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21617         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
21618         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
21619         return ret_conv;
21620 }
21621
21622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21623         if (!ptr_is_owned(_res)) return;
21624         void* _res_ptr = untag_ptr(_res);
21625         CHECK_ACCESS(_res_ptr);
21626         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
21627         FREE(untag_ptr(_res));
21628         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
21629 }
21630
21631 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
21632         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21633         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
21634         return tag_ptr(ret_conv, true);
21635 }
21636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21637         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
21638         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
21639         return ret_conv;
21640 }
21641
21642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21643         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
21644         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21645         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
21646         return tag_ptr(ret_conv, true);
21647 }
21648
21649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21650         LDKPhantomRouteHints o_conv;
21651         o_conv.inner = untag_ptr(o);
21652         o_conv.is_owned = ptr_is_owned(o);
21653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21654         o_conv = PhantomRouteHints_clone(&o_conv);
21655         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21656         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
21657         return tag_ptr(ret_conv, true);
21658 }
21659
21660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21661         void* e_ptr = untag_ptr(e);
21662         CHECK_ACCESS(e_ptr);
21663         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21664         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21665         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21666         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
21667         return tag_ptr(ret_conv, true);
21668 }
21669
21670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21671         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
21672         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
21673         return ret_conv;
21674 }
21675
21676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21677         if (!ptr_is_owned(_res)) return;
21678         void* _res_ptr = untag_ptr(_res);
21679         CHECK_ACCESS(_res_ptr);
21680         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
21681         FREE(untag_ptr(_res));
21682         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
21683 }
21684
21685 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
21686         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21687         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
21688         return tag_ptr(ret_conv, true);
21689 }
21690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21691         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
21692         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
21693         return ret_conv;
21694 }
21695
21696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21697         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
21698         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21699         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
21700         return tag_ptr(ret_conv, true);
21701 }
21702
21703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21704         LDKCVec_ChannelMonitorZ _res_constr;
21705         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21706         if (_res_constr.datalen > 0)
21707                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21708         else
21709                 _res_constr.data = NULL;
21710         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21711         for (size_t q = 0; q < _res_constr.datalen; q++) {
21712                 int64_t _res_conv_16 = _res_vals[q];
21713                 LDKChannelMonitor _res_conv_16_conv;
21714                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21715                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21716                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21717                 _res_constr.data[q] = _res_conv_16_conv;
21718         }
21719         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21720         CVec_ChannelMonitorZ_free(_res_constr);
21721 }
21722
21723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21724         LDKThirtyTwoBytes a_ref;
21725         CHECK((*env)->GetArrayLength(env, a) == 32);
21726         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21727         LDKChannelManager b_conv;
21728         b_conv.inner = untag_ptr(b);
21729         b_conv.is_owned = ptr_is_owned(b);
21730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21731         // WARNING: we need a move here but no clone is available for LDKChannelManager
21732         
21733         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
21734         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
21735         return tag_ptr(ret_conv, true);
21736 }
21737
21738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21739         if (!ptr_is_owned(_res)) return;
21740         void* _res_ptr = untag_ptr(_res);
21741         CHECK_ACCESS(_res_ptr);
21742         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
21743         FREE(untag_ptr(_res));
21744         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
21745 }
21746
21747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21748         void* o_ptr = untag_ptr(o);
21749         CHECK_ACCESS(o_ptr);
21750         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
21751         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
21752         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21753         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
21754         return tag_ptr(ret_conv, true);
21755 }
21756
21757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21758         void* e_ptr = untag_ptr(e);
21759         CHECK_ACCESS(e_ptr);
21760         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21761         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21762         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21763         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
21764         return tag_ptr(ret_conv, true);
21765 }
21766
21767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21768         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
21769         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
21770         return ret_conv;
21771 }
21772
21773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21774         if (!ptr_is_owned(_res)) return;
21775         void* _res_ptr = untag_ptr(_res);
21776         CHECK_ACCESS(_res_ptr);
21777         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
21778         FREE(untag_ptr(_res));
21779         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
21780 }
21781
21782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21783         LDKChannelConfig o_conv;
21784         o_conv.inner = untag_ptr(o);
21785         o_conv.is_owned = ptr_is_owned(o);
21786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21787         o_conv = ChannelConfig_clone(&o_conv);
21788         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21789         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
21790         return tag_ptr(ret_conv, true);
21791 }
21792
21793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21794         void* e_ptr = untag_ptr(e);
21795         CHECK_ACCESS(e_ptr);
21796         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21797         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21798         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21799         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
21800         return tag_ptr(ret_conv, true);
21801 }
21802
21803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21804         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
21805         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
21806         return ret_conv;
21807 }
21808
21809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21810         if (!ptr_is_owned(_res)) return;
21811         void* _res_ptr = untag_ptr(_res);
21812         CHECK_ACCESS(_res_ptr);
21813         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
21814         FREE(untag_ptr(_res));
21815         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
21816 }
21817
21818 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
21819         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21820         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
21821         return tag_ptr(ret_conv, true);
21822 }
21823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21824         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
21825         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
21826         return ret_conv;
21827 }
21828
21829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21830         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
21831         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21832         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
21833         return tag_ptr(ret_conv, true);
21834 }
21835
21836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21837         void* o_ptr = untag_ptr(o);
21838         CHECK_ACCESS(o_ptr);
21839         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
21840         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
21841         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21842         *ret_copy = COption_APIErrorZ_some(o_conv);
21843         int64_t ret_ref = tag_ptr(ret_copy, true);
21844         return ret_ref;
21845 }
21846
21847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
21848         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21849         *ret_copy = COption_APIErrorZ_none();
21850         int64_t ret_ref = tag_ptr(ret_copy, true);
21851         return ret_ref;
21852 }
21853
21854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21855         if (!ptr_is_owned(_res)) return;
21856         void* _res_ptr = untag_ptr(_res);
21857         CHECK_ACCESS(_res_ptr);
21858         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
21859         FREE(untag_ptr(_res));
21860         COption_APIErrorZ_free(_res_conv);
21861 }
21862
21863 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
21864         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21865         *ret_copy = COption_APIErrorZ_clone(arg);
21866         int64_t ret_ref = tag_ptr(ret_copy, true);
21867         return ret_ref;
21868 }
21869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21870         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
21871         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
21872         return ret_conv;
21873 }
21874
21875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21876         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
21877         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21878         *ret_copy = COption_APIErrorZ_clone(orig_conv);
21879         int64_t ret_ref = tag_ptr(ret_copy, true);
21880         return ret_ref;
21881 }
21882
21883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21884         void* o_ptr = untag_ptr(o);
21885         CHECK_ACCESS(o_ptr);
21886         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
21887         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
21888         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21889         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
21890         return tag_ptr(ret_conv, true);
21891 }
21892
21893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21894         void* e_ptr = untag_ptr(e);
21895         CHECK_ACCESS(e_ptr);
21896         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21897         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21898         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21899         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
21900         return tag_ptr(ret_conv, true);
21901 }
21902
21903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21904         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
21905         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
21906         return ret_conv;
21907 }
21908
21909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21910         if (!ptr_is_owned(_res)) return;
21911         void* _res_ptr = untag_ptr(_res);
21912         CHECK_ACCESS(_res_ptr);
21913         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
21914         FREE(untag_ptr(_res));
21915         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
21916 }
21917
21918 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
21919         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21920         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
21921         return tag_ptr(ret_conv, true);
21922 }
21923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21924         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
21925         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
21926         return ret_conv;
21927 }
21928
21929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21930         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
21931         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21932         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
21933         return tag_ptr(ret_conv, true);
21934 }
21935
21936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21937         LDKOutPoint o_conv;
21938         o_conv.inner = untag_ptr(o);
21939         o_conv.is_owned = ptr_is_owned(o);
21940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21941         o_conv = OutPoint_clone(&o_conv);
21942         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
21943         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
21944         return tag_ptr(ret_conv, true);
21945 }
21946
21947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21948         void* e_ptr = untag_ptr(e);
21949         CHECK_ACCESS(e_ptr);
21950         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21951         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21952         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
21953         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
21954         return tag_ptr(ret_conv, true);
21955 }
21956
21957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21958         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
21959         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
21960         return ret_conv;
21961 }
21962
21963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21964         if (!ptr_is_owned(_res)) return;
21965         void* _res_ptr = untag_ptr(_res);
21966         CHECK_ACCESS(_res_ptr);
21967         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
21968         FREE(untag_ptr(_res));
21969         CResult_OutPointDecodeErrorZ_free(_res_conv);
21970 }
21971
21972 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
21973         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
21974         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
21975         return tag_ptr(ret_conv, true);
21976 }
21977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21978         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
21979         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
21980         return ret_conv;
21981 }
21982
21983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21984         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
21985         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
21986         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
21987         return tag_ptr(ret_conv, true);
21988 }
21989
21990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21991         void* o_ptr = untag_ptr(o);
21992         CHECK_ACCESS(o_ptr);
21993         LDKType o_conv = *(LDKType*)(o_ptr);
21994         if (o_conv.free == LDKType_JCalls_free) {
21995                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21996                 LDKType_JCalls_cloned(&o_conv);
21997         }
21998         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
21999         *ret_copy = COption_TypeZ_some(o_conv);
22000         int64_t ret_ref = tag_ptr(ret_copy, true);
22001         return ret_ref;
22002 }
22003
22004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
22005         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22006         *ret_copy = COption_TypeZ_none();
22007         int64_t ret_ref = tag_ptr(ret_copy, true);
22008         return ret_ref;
22009 }
22010
22011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22012         if (!ptr_is_owned(_res)) return;
22013         void* _res_ptr = untag_ptr(_res);
22014         CHECK_ACCESS(_res_ptr);
22015         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
22016         FREE(untag_ptr(_res));
22017         COption_TypeZ_free(_res_conv);
22018 }
22019
22020 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
22021         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22022         *ret_copy = COption_TypeZ_clone(arg);
22023         int64_t ret_ref = tag_ptr(ret_copy, true);
22024         return ret_ref;
22025 }
22026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22027         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
22028         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
22029         return ret_conv;
22030 }
22031
22032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22033         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
22034         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22035         *ret_copy = COption_TypeZ_clone(orig_conv);
22036         int64_t ret_ref = tag_ptr(ret_copy, true);
22037         return ret_ref;
22038 }
22039
22040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22041         void* o_ptr = untag_ptr(o);
22042         CHECK_ACCESS(o_ptr);
22043         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
22044         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
22045         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22046         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
22047         return tag_ptr(ret_conv, true);
22048 }
22049
22050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22051         void* e_ptr = untag_ptr(e);
22052         CHECK_ACCESS(e_ptr);
22053         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22054         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22055         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22056         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
22057         return tag_ptr(ret_conv, true);
22058 }
22059
22060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22061         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
22062         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
22063         return ret_conv;
22064 }
22065
22066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22067         if (!ptr_is_owned(_res)) return;
22068         void* _res_ptr = untag_ptr(_res);
22069         CHECK_ACCESS(_res_ptr);
22070         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
22071         FREE(untag_ptr(_res));
22072         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
22073 }
22074
22075 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
22076         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22077         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
22078         return tag_ptr(ret_conv, true);
22079 }
22080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22081         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
22082         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
22083         return ret_conv;
22084 }
22085
22086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22087         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
22088         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22089         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
22090         return tag_ptr(ret_conv, true);
22091 }
22092
22093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22094         LDKThirtyTwoBytes o_ref;
22095         CHECK((*env)->GetArrayLength(env, o) == 32);
22096         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
22097         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22098         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
22099         return tag_ptr(ret_conv, true);
22100 }
22101
22102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22103         void* e_ptr = untag_ptr(e);
22104         CHECK_ACCESS(e_ptr);
22105         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
22106         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
22107         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22108         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
22109         return tag_ptr(ret_conv, true);
22110 }
22111
22112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22113         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
22114         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
22115         return ret_conv;
22116 }
22117
22118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22119         if (!ptr_is_owned(_res)) return;
22120         void* _res_ptr = untag_ptr(_res);
22121         CHECK_ACCESS(_res_ptr);
22122         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
22123         FREE(untag_ptr(_res));
22124         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
22125 }
22126
22127 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
22128         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22129         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
22130         return tag_ptr(ret_conv, true);
22131 }
22132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22133         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
22134         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
22135         return ret_conv;
22136 }
22137
22138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22139         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
22140         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22141         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
22142         return tag_ptr(ret_conv, true);
22143 }
22144
22145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1ok(JNIEnv *env, jclass clz) {
22146         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22147         *ret_conv = CResult_NonePaymentErrorZ_ok();
22148         return tag_ptr(ret_conv, true);
22149 }
22150
22151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22152         void* e_ptr = untag_ptr(e);
22153         CHECK_ACCESS(e_ptr);
22154         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
22155         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
22156         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22157         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
22158         return tag_ptr(ret_conv, true);
22159 }
22160
22161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22162         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
22163         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
22164         return ret_conv;
22165 }
22166
22167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22168         if (!ptr_is_owned(_res)) return;
22169         void* _res_ptr = untag_ptr(_res);
22170         CHECK_ACCESS(_res_ptr);
22171         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
22172         FREE(untag_ptr(_res));
22173         CResult_NonePaymentErrorZ_free(_res_conv);
22174 }
22175
22176 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
22177         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22178         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
22179         return tag_ptr(ret_conv, true);
22180 }
22181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22182         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
22183         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
22184         return ret_conv;
22185 }
22186
22187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22188         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
22189         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22190         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
22191         return tag_ptr(ret_conv, true);
22192 }
22193
22194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
22195         LDKStr o_conv = java_to_owned_str(env, o);
22196         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22197         *ret_conv = CResult_StringErrorZ_ok(o_conv);
22198         return tag_ptr(ret_conv, true);
22199 }
22200
22201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22202         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
22203         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22204         *ret_conv = CResult_StringErrorZ_err(e_conv);
22205         return tag_ptr(ret_conv, true);
22206 }
22207
22208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22209         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
22210         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
22211         return ret_conv;
22212 }
22213
22214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22215         if (!ptr_is_owned(_res)) return;
22216         void* _res_ptr = untag_ptr(_res);
22217         CHECK_ACCESS(_res_ptr);
22218         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
22219         FREE(untag_ptr(_res));
22220         CResult_StringErrorZ_free(_res_conv);
22221 }
22222
22223 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
22224         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22225         *ret_conv = CResult_StringErrorZ_clone(arg);
22226         return tag_ptr(ret_conv, true);
22227 }
22228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22229         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
22230         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
22231         return ret_conv;
22232 }
22233
22234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22235         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
22236         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22237         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
22238         return tag_ptr(ret_conv, true);
22239 }
22240
22241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22242         LDKPublicKey o_ref;
22243         CHECK((*env)->GetArrayLength(env, o) == 33);
22244         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
22245         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22246         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
22247         return tag_ptr(ret_conv, true);
22248 }
22249
22250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22251         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
22252         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22253         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
22254         return tag_ptr(ret_conv, true);
22255 }
22256
22257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22258         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
22259         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
22260         return ret_conv;
22261 }
22262
22263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22264         if (!ptr_is_owned(_res)) return;
22265         void* _res_ptr = untag_ptr(_res);
22266         CHECK_ACCESS(_res_ptr);
22267         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
22268         FREE(untag_ptr(_res));
22269         CResult_PublicKeyErrorZ_free(_res_conv);
22270 }
22271
22272 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
22273         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22274         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
22275         return tag_ptr(ret_conv, true);
22276 }
22277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22278         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
22279         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
22280         return ret_conv;
22281 }
22282
22283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22284         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
22285         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22286         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
22287         return tag_ptr(ret_conv, true);
22288 }
22289
22290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22291         LDKChannelMonitorUpdate o_conv;
22292         o_conv.inner = untag_ptr(o);
22293         o_conv.is_owned = ptr_is_owned(o);
22294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22295         o_conv = ChannelMonitorUpdate_clone(&o_conv);
22296         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22297         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
22298         return tag_ptr(ret_conv, true);
22299 }
22300
22301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22302         void* e_ptr = untag_ptr(e);
22303         CHECK_ACCESS(e_ptr);
22304         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22305         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22306         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22307         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
22308         return tag_ptr(ret_conv, true);
22309 }
22310
22311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22312         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
22313         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
22314         return ret_conv;
22315 }
22316
22317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22318         if (!ptr_is_owned(_res)) return;
22319         void* _res_ptr = untag_ptr(_res);
22320         CHECK_ACCESS(_res_ptr);
22321         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
22322         FREE(untag_ptr(_res));
22323         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
22324 }
22325
22326 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
22327         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22328         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
22329         return tag_ptr(ret_conv, true);
22330 }
22331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22332         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
22333         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
22334         return ret_conv;
22335 }
22336
22337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22338         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
22339         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22340         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
22341         return tag_ptr(ret_conv, true);
22342 }
22343
22344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22345         void* o_ptr = untag_ptr(o);
22346         CHECK_ACCESS(o_ptr);
22347         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
22348         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
22349         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22350         *ret_copy = COption_MonitorEventZ_some(o_conv);
22351         int64_t ret_ref = tag_ptr(ret_copy, true);
22352         return ret_ref;
22353 }
22354
22355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
22356         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22357         *ret_copy = COption_MonitorEventZ_none();
22358         int64_t ret_ref = tag_ptr(ret_copy, true);
22359         return ret_ref;
22360 }
22361
22362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22363         if (!ptr_is_owned(_res)) return;
22364         void* _res_ptr = untag_ptr(_res);
22365         CHECK_ACCESS(_res_ptr);
22366         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
22367         FREE(untag_ptr(_res));
22368         COption_MonitorEventZ_free(_res_conv);
22369 }
22370
22371 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
22372         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22373         *ret_copy = COption_MonitorEventZ_clone(arg);
22374         int64_t ret_ref = tag_ptr(ret_copy, true);
22375         return ret_ref;
22376 }
22377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22378         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
22379         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
22380         return ret_conv;
22381 }
22382
22383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22384         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
22385         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22386         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
22387         int64_t ret_ref = tag_ptr(ret_copy, true);
22388         return ret_ref;
22389 }
22390
22391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22392         void* o_ptr = untag_ptr(o);
22393         CHECK_ACCESS(o_ptr);
22394         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
22395         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
22396         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22397         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
22398         return tag_ptr(ret_conv, true);
22399 }
22400
22401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22402         void* e_ptr = untag_ptr(e);
22403         CHECK_ACCESS(e_ptr);
22404         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22405         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22406         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22407         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
22408         return tag_ptr(ret_conv, true);
22409 }
22410
22411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22412         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
22413         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
22414         return ret_conv;
22415 }
22416
22417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22418         if (!ptr_is_owned(_res)) return;
22419         void* _res_ptr = untag_ptr(_res);
22420         CHECK_ACCESS(_res_ptr);
22421         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
22422         FREE(untag_ptr(_res));
22423         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
22424 }
22425
22426 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
22427         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22428         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
22429         return tag_ptr(ret_conv, true);
22430 }
22431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22432         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
22433         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
22434         return ret_conv;
22435 }
22436
22437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22438         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
22439         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22440         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
22441         return tag_ptr(ret_conv, true);
22442 }
22443
22444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22445         LDKHTLCUpdate o_conv;
22446         o_conv.inner = untag_ptr(o);
22447         o_conv.is_owned = ptr_is_owned(o);
22448         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22449         o_conv = HTLCUpdate_clone(&o_conv);
22450         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22451         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
22452         return tag_ptr(ret_conv, true);
22453 }
22454
22455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22456         void* e_ptr = untag_ptr(e);
22457         CHECK_ACCESS(e_ptr);
22458         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22459         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22460         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22461         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
22462         return tag_ptr(ret_conv, true);
22463 }
22464
22465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22466         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
22467         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
22468         return ret_conv;
22469 }
22470
22471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22472         if (!ptr_is_owned(_res)) return;
22473         void* _res_ptr = untag_ptr(_res);
22474         CHECK_ACCESS(_res_ptr);
22475         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
22476         FREE(untag_ptr(_res));
22477         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
22478 }
22479
22480 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
22481         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22482         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
22483         return tag_ptr(ret_conv, true);
22484 }
22485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22486         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
22487         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
22488         return ret_conv;
22489 }
22490
22491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22492         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
22493         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22494         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
22495         return tag_ptr(ret_conv, true);
22496 }
22497
22498 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
22499         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22500         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
22501         return tag_ptr(ret_conv, true);
22502 }
22503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22504         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
22505         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
22506         return ret_conv;
22507 }
22508
22509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22510         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
22511         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22512         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
22513         return tag_ptr(ret_conv, true);
22514 }
22515
22516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
22517         LDKOutPoint a_conv;
22518         a_conv.inner = untag_ptr(a);
22519         a_conv.is_owned = ptr_is_owned(a);
22520         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22521         a_conv = OutPoint_clone(&a_conv);
22522         LDKCVec_u8Z b_ref;
22523         b_ref.datalen = (*env)->GetArrayLength(env, b);
22524         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22525         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
22526         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22527         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
22528         return tag_ptr(ret_conv, true);
22529 }
22530
22531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22532         if (!ptr_is_owned(_res)) return;
22533         void* _res_ptr = untag_ptr(_res);
22534         CHECK_ACCESS(_res_ptr);
22535         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
22536         FREE(untag_ptr(_res));
22537         C2Tuple_OutPointScriptZ_free(_res_conv);
22538 }
22539
22540 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
22541         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22542         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
22543         return tag_ptr(ret_conv, true);
22544 }
22545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22546         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
22547         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
22548         return ret_conv;
22549 }
22550
22551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22552         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
22553         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22554         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
22555         return tag_ptr(ret_conv, true);
22556 }
22557
22558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
22559         LDKCVec_u8Z b_ref;
22560         b_ref.datalen = (*env)->GetArrayLength(env, b);
22561         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22562         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
22563         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22564         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
22565         return tag_ptr(ret_conv, true);
22566 }
22567
22568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22569         if (!ptr_is_owned(_res)) return;
22570         void* _res_ptr = untag_ptr(_res);
22571         CHECK_ACCESS(_res_ptr);
22572         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
22573         FREE(untag_ptr(_res));
22574         C2Tuple_u32ScriptZ_free(_res_conv);
22575 }
22576
22577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22578         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
22579         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22580         if (_res_constr.datalen > 0)
22581                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
22582         else
22583                 _res_constr.data = NULL;
22584         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22585         for (size_t v = 0; v < _res_constr.datalen; v++) {
22586                 int64_t _res_conv_21 = _res_vals[v];
22587                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
22588                 CHECK_ACCESS(_res_conv_21_ptr);
22589                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
22590                 FREE(untag_ptr(_res_conv_21));
22591                 _res_constr.data[v] = _res_conv_21_conv;
22592         }
22593         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22594         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
22595 }
22596
22597 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
22598         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22599         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
22600         return tag_ptr(ret_conv, true);
22601 }
22602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22603         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
22604         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
22605         return ret_conv;
22606 }
22607
22608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22609         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
22610         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22611         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
22612         return tag_ptr(ret_conv, true);
22613 }
22614
22615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
22616         LDKThirtyTwoBytes a_ref;
22617         CHECK((*env)->GetArrayLength(env, a) == 32);
22618         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22619         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
22620         b_constr.datalen = (*env)->GetArrayLength(env, b);
22621         if (b_constr.datalen > 0)
22622                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
22623         else
22624                 b_constr.data = NULL;
22625         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
22626         for (size_t v = 0; v < b_constr.datalen; v++) {
22627                 int64_t b_conv_21 = b_vals[v];
22628                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
22629                 CHECK_ACCESS(b_conv_21_ptr);
22630                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
22631                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
22632                 b_constr.data[v] = b_conv_21_conv;
22633         }
22634         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
22635         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22636         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
22637         return tag_ptr(ret_conv, true);
22638 }
22639
22640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22641         if (!ptr_is_owned(_res)) return;
22642         void* _res_ptr = untag_ptr(_res);
22643         CHECK_ACCESS(_res_ptr);
22644         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
22645         FREE(untag_ptr(_res));
22646         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
22647 }
22648
22649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22650         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
22651         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22652         if (_res_constr.datalen > 0)
22653                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
22654         else
22655                 _res_constr.data = NULL;
22656         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22657         for (size_t o = 0; o < _res_constr.datalen; o++) {
22658                 int64_t _res_conv_40 = _res_vals[o];
22659                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22660                 CHECK_ACCESS(_res_conv_40_ptr);
22661                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
22662                 FREE(untag_ptr(_res_conv_40));
22663                 _res_constr.data[o] = _res_conv_40_conv;
22664         }
22665         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22666         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
22667 }
22668
22669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22670         LDKCVec_EventZ _res_constr;
22671         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22672         if (_res_constr.datalen > 0)
22673                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
22674         else
22675                 _res_constr.data = NULL;
22676         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22677         for (size_t h = 0; h < _res_constr.datalen; h++) {
22678                 int64_t _res_conv_7 = _res_vals[h];
22679                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
22680                 CHECK_ACCESS(_res_conv_7_ptr);
22681                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
22682                 FREE(untag_ptr(_res_conv_7));
22683                 _res_constr.data[h] = _res_conv_7_conv;
22684         }
22685         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22686         CVec_EventZ_free(_res_constr);
22687 }
22688
22689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22690         LDKCVec_TransactionZ _res_constr;
22691         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22692         if (_res_constr.datalen > 0)
22693                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
22694         else
22695                 _res_constr.data = NULL;
22696         for (size_t i = 0; i < _res_constr.datalen; i++) {
22697                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22698                 LDKTransaction _res_conv_8_ref;
22699                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
22700                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
22701                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
22702                 _res_conv_8_ref.data_is_owned = true;
22703                 _res_constr.data[i] = _res_conv_8_ref;
22704         }
22705         CVec_TransactionZ_free(_res_constr);
22706 }
22707
22708 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
22709         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22710         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
22711         return tag_ptr(ret_conv, true);
22712 }
22713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22714         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
22715         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
22716         return ret_conv;
22717 }
22718
22719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22720         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
22721         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22722         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
22723         return tag_ptr(ret_conv, true);
22724 }
22725
22726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
22727         void* b_ptr = untag_ptr(b);
22728         CHECK_ACCESS(b_ptr);
22729         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
22730         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
22731         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22732         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
22733         return tag_ptr(ret_conv, true);
22734 }
22735
22736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22737         if (!ptr_is_owned(_res)) return;
22738         void* _res_ptr = untag_ptr(_res);
22739         CHECK_ACCESS(_res_ptr);
22740         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
22741         FREE(untag_ptr(_res));
22742         C2Tuple_u32TxOutZ_free(_res_conv);
22743 }
22744
22745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22746         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
22747         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22748         if (_res_constr.datalen > 0)
22749                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22750         else
22751                 _res_constr.data = NULL;
22752         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22753         for (size_t u = 0; u < _res_constr.datalen; u++) {
22754                 int64_t _res_conv_20 = _res_vals[u];
22755                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
22756                 CHECK_ACCESS(_res_conv_20_ptr);
22757                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
22758                 FREE(untag_ptr(_res_conv_20));
22759                 _res_constr.data[u] = _res_conv_20_conv;
22760         }
22761         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22762         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
22763 }
22764
22765 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
22766         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22767         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
22768         return tag_ptr(ret_conv, true);
22769 }
22770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22771         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
22772         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
22773         return ret_conv;
22774 }
22775
22776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22777         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
22778         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22779         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
22780         return tag_ptr(ret_conv, true);
22781 }
22782
22783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
22784         LDKThirtyTwoBytes a_ref;
22785         CHECK((*env)->GetArrayLength(env, a) == 32);
22786         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22787         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
22788         b_constr.datalen = (*env)->GetArrayLength(env, b);
22789         if (b_constr.datalen > 0)
22790                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22791         else
22792                 b_constr.data = NULL;
22793         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
22794         for (size_t u = 0; u < b_constr.datalen; u++) {
22795                 int64_t b_conv_20 = b_vals[u];
22796                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
22797                 CHECK_ACCESS(b_conv_20_ptr);
22798                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
22799                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
22800                 b_constr.data[u] = b_conv_20_conv;
22801         }
22802         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
22803         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22804         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
22805         return tag_ptr(ret_conv, true);
22806 }
22807
22808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22809         if (!ptr_is_owned(_res)) return;
22810         void* _res_ptr = untag_ptr(_res);
22811         CHECK_ACCESS(_res_ptr);
22812         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
22813         FREE(untag_ptr(_res));
22814         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
22815 }
22816
22817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22818         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
22819         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22820         if (_res_constr.datalen > 0)
22821                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
22822         else
22823                 _res_constr.data = NULL;
22824         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22825         for (size_t n = 0; n < _res_constr.datalen; n++) {
22826                 int64_t _res_conv_39 = _res_vals[n];
22827                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
22828                 CHECK_ACCESS(_res_conv_39_ptr);
22829                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
22830                 FREE(untag_ptr(_res_conv_39));
22831                 _res_constr.data[n] = _res_conv_39_conv;
22832         }
22833         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22834         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
22835 }
22836
22837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22838         LDKCVec_BalanceZ _res_constr;
22839         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22840         if (_res_constr.datalen > 0)
22841                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
22842         else
22843                 _res_constr.data = NULL;
22844         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22845         for (size_t j = 0; j < _res_constr.datalen; j++) {
22846                 int64_t _res_conv_9 = _res_vals[j];
22847                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
22848                 CHECK_ACCESS(_res_conv_9_ptr);
22849                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
22850                 FREE(untag_ptr(_res_conv_9));
22851                 _res_constr.data[j] = _res_conv_9_conv;
22852         }
22853         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22854         CVec_BalanceZ_free(_res_constr);
22855 }
22856
22857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22858         void* o_ptr = untag_ptr(o);
22859         CHECK_ACCESS(o_ptr);
22860         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
22861         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
22862         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22863         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
22864         return tag_ptr(ret_conv, true);
22865 }
22866
22867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22873         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
22874         return tag_ptr(ret_conv, true);
22875 }
22876
22877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22878         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
22879         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
22880         return ret_conv;
22881 }
22882
22883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
22888         FREE(untag_ptr(_res));
22889         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
22890 }
22891
22892 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
22893         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22894         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
22895         return tag_ptr(ret_conv, true);
22896 }
22897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22898         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
22899         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
22900         return ret_conv;
22901 }
22902
22903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22904         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
22905         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22906         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
22907         return tag_ptr(ret_conv, true);
22908 }
22909
22910 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
22911         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22912         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
22913         return tag_ptr(ret_conv, true);
22914 }
22915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22916         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
22917         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
22918         return ret_conv;
22919 }
22920
22921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22922         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
22923         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22924         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
22925         return tag_ptr(ret_conv, true);
22926 }
22927
22928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
22929         LDKPublicKey a_ref;
22930         CHECK((*env)->GetArrayLength(env, a) == 33);
22931         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
22932         void* b_ptr = untag_ptr(b);
22933         CHECK_ACCESS(b_ptr);
22934         LDKType b_conv = *(LDKType*)(b_ptr);
22935         if (b_conv.free == LDKType_JCalls_free) {
22936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22937                 LDKType_JCalls_cloned(&b_conv);
22938         }
22939         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22940         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
22941         return tag_ptr(ret_conv, true);
22942 }
22943
22944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22945         if (!ptr_is_owned(_res)) return;
22946         void* _res_ptr = untag_ptr(_res);
22947         CHECK_ACCESS(_res_ptr);
22948         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
22949         FREE(untag_ptr(_res));
22950         C2Tuple_PublicKeyTypeZ_free(_res_conv);
22951 }
22952
22953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22954         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
22955         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22956         if (_res_constr.datalen > 0)
22957                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22958         else
22959                 _res_constr.data = NULL;
22960         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22961         for (size_t z = 0; z < _res_constr.datalen; z++) {
22962                 int64_t _res_conv_25 = _res_vals[z];
22963                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
22964                 CHECK_ACCESS(_res_conv_25_ptr);
22965                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
22966                 FREE(untag_ptr(_res_conv_25));
22967                 _res_constr.data[z] = _res_conv_25_conv;
22968         }
22969         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22970         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
22971 }
22972
22973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22974         void* o_ptr = untag_ptr(o);
22975         CHECK_ACCESS(o_ptr);
22976         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
22977         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
22978                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22979                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
22980         }
22981         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22982         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
22983         int64_t ret_ref = tag_ptr(ret_copy, true);
22984         return ret_ref;
22985 }
22986
22987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
22988         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22989         *ret_copy = COption_CustomOnionMessageContentsZ_none();
22990         int64_t ret_ref = tag_ptr(ret_copy, true);
22991         return ret_ref;
22992 }
22993
22994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22995         if (!ptr_is_owned(_res)) return;
22996         void* _res_ptr = untag_ptr(_res);
22997         CHECK_ACCESS(_res_ptr);
22998         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
22999         FREE(untag_ptr(_res));
23000         COption_CustomOnionMessageContentsZ_free(_res_conv);
23001 }
23002
23003 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
23004         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
23005         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
23006         int64_t ret_ref = tag_ptr(ret_copy, true);
23007         return ret_ref;
23008 }
23009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23010         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
23011         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
23012         return ret_conv;
23013 }
23014
23015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23016         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
23017         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
23018         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
23019         int64_t ret_ref = tag_ptr(ret_copy, true);
23020         return ret_ref;
23021 }
23022
23023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23024         void* o_ptr = untag_ptr(o);
23025         CHECK_ACCESS(o_ptr);
23026         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
23027         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
23028         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23029         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
23030         return tag_ptr(ret_conv, true);
23031 }
23032
23033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23034         void* e_ptr = untag_ptr(e);
23035         CHECK_ACCESS(e_ptr);
23036         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23037         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23038         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23039         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
23040         return tag_ptr(ret_conv, true);
23041 }
23042
23043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23044         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
23045         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
23046         return ret_conv;
23047 }
23048
23049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23050         if (!ptr_is_owned(_res)) return;
23051         void* _res_ptr = untag_ptr(_res);
23052         CHECK_ACCESS(_res_ptr);
23053         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
23054         FREE(untag_ptr(_res));
23055         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
23056 }
23057
23058 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
23059         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23060         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
23061         return tag_ptr(ret_conv, true);
23062 }
23063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23064         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
23065         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
23066         return ret_conv;
23067 }
23068
23069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23070         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
23071         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23072         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
23073         return tag_ptr(ret_conv, true);
23074 }
23075
23076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23077         void* o_ptr = untag_ptr(o);
23078         CHECK_ACCESS(o_ptr);
23079         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
23080         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
23081         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23082         *ret_copy = COption_NetAddressZ_some(o_conv);
23083         int64_t ret_ref = tag_ptr(ret_copy, true);
23084         return ret_ref;
23085 }
23086
23087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
23088         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23089         *ret_copy = COption_NetAddressZ_none();
23090         int64_t ret_ref = tag_ptr(ret_copy, true);
23091         return ret_ref;
23092 }
23093
23094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23095         if (!ptr_is_owned(_res)) return;
23096         void* _res_ptr = untag_ptr(_res);
23097         CHECK_ACCESS(_res_ptr);
23098         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
23099         FREE(untag_ptr(_res));
23100         COption_NetAddressZ_free(_res_conv);
23101 }
23102
23103 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
23104         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23105         *ret_copy = COption_NetAddressZ_clone(arg);
23106         int64_t ret_ref = tag_ptr(ret_copy, true);
23107         return ret_ref;
23108 }
23109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23110         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
23111         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
23112         return ret_conv;
23113 }
23114
23115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23116         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
23117         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23118         *ret_copy = COption_NetAddressZ_clone(orig_conv);
23119         int64_t ret_ref = tag_ptr(ret_copy, true);
23120         return ret_ref;
23121 }
23122
23123 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
23124         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23125         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
23126         return tag_ptr(ret_conv, true);
23127 }
23128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23129         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
23130         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
23131         return ret_conv;
23132 }
23133
23134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23135         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
23136         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23137         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
23138         return tag_ptr(ret_conv, true);
23139 }
23140
23141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
23142         LDKPublicKey a_ref;
23143         CHECK((*env)->GetArrayLength(env, a) == 33);
23144         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
23145         void* b_ptr = untag_ptr(b);
23146         CHECK_ACCESS(b_ptr);
23147         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
23148         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
23149         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23150         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
23151         return tag_ptr(ret_conv, true);
23152 }
23153
23154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23155         if (!ptr_is_owned(_res)) return;
23156         void* _res_ptr = untag_ptr(_res);
23157         CHECK_ACCESS(_res_ptr);
23158         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
23159         FREE(untag_ptr(_res));
23160         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
23161 }
23162
23163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1NetAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23164         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
23165         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23166         if (_res_constr.datalen > 0)
23167                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
23168         else
23169                 _res_constr.data = NULL;
23170         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23171         for (size_t o = 0; o < _res_constr.datalen; o++) {
23172                 int64_t _res_conv_40 = _res_vals[o];
23173                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
23174                 CHECK_ACCESS(_res_conv_40_ptr);
23175                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
23176                 FREE(untag_ptr(_res_conv_40));
23177                 _res_constr.data[o] = _res_conv_40_conv;
23178         }
23179         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23180         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
23181 }
23182
23183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23184         LDKCVec_u8Z o_ref;
23185         o_ref.datalen = (*env)->GetArrayLength(env, o);
23186         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
23187         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
23188         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23189         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
23190         return tag_ptr(ret_conv, true);
23191 }
23192
23193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23194         LDKPeerHandleError e_conv;
23195         e_conv.inner = untag_ptr(e);
23196         e_conv.is_owned = ptr_is_owned(e);
23197         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23198         e_conv = PeerHandleError_clone(&e_conv);
23199         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23200         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
23201         return tag_ptr(ret_conv, true);
23202 }
23203
23204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23205         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
23206         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
23207         return ret_conv;
23208 }
23209
23210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23211         if (!ptr_is_owned(_res)) return;
23212         void* _res_ptr = untag_ptr(_res);
23213         CHECK_ACCESS(_res_ptr);
23214         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
23215         FREE(untag_ptr(_res));
23216         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
23217 }
23218
23219 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
23220         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23221         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
23222         return tag_ptr(ret_conv, true);
23223 }
23224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23225         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
23226         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
23227         return ret_conv;
23228 }
23229
23230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23231         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
23232         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23233         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
23234         return tag_ptr(ret_conv, true);
23235 }
23236
23237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
23238         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23239         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
23240         return tag_ptr(ret_conv, true);
23241 }
23242
23243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23244         LDKPeerHandleError e_conv;
23245         e_conv.inner = untag_ptr(e);
23246         e_conv.is_owned = ptr_is_owned(e);
23247         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23248         e_conv = PeerHandleError_clone(&e_conv);
23249         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23250         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
23251         return tag_ptr(ret_conv, true);
23252 }
23253
23254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23255         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
23256         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
23257         return ret_conv;
23258 }
23259
23260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23261         if (!ptr_is_owned(_res)) return;
23262         void* _res_ptr = untag_ptr(_res);
23263         CHECK_ACCESS(_res_ptr);
23264         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
23265         FREE(untag_ptr(_res));
23266         CResult_NonePeerHandleErrorZ_free(_res_conv);
23267 }
23268
23269 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
23270         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23271         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
23272         return tag_ptr(ret_conv, true);
23273 }
23274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23275         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
23276         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
23277         return ret_conv;
23278 }
23279
23280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23281         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
23282         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23283         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
23284         return tag_ptr(ret_conv, true);
23285 }
23286
23287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
23288         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23289         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
23290         return tag_ptr(ret_conv, true);
23291 }
23292
23293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23294         LDKPeerHandleError e_conv;
23295         e_conv.inner = untag_ptr(e);
23296         e_conv.is_owned = ptr_is_owned(e);
23297         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23298         e_conv = PeerHandleError_clone(&e_conv);
23299         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23300         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
23301         return tag_ptr(ret_conv, true);
23302 }
23303
23304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23305         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
23306         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
23307         return ret_conv;
23308 }
23309
23310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23311         if (!ptr_is_owned(_res)) return;
23312         void* _res_ptr = untag_ptr(_res);
23313         CHECK_ACCESS(_res_ptr);
23314         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
23315         FREE(untag_ptr(_res));
23316         CResult_boolPeerHandleErrorZ_free(_res_conv);
23317 }
23318
23319 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
23320         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23321         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
23322         return tag_ptr(ret_conv, true);
23323 }
23324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23325         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
23326         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
23327         return ret_conv;
23328 }
23329
23330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23331         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
23332         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23333         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
23334         return tag_ptr(ret_conv, true);
23335 }
23336
23337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23338         void* o_ptr = untag_ptr(o);
23339         CHECK_ACCESS(o_ptr);
23340         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23341         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23342         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23343         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
23344         return tag_ptr(ret_conv, true);
23345 }
23346
23347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23348         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
23349         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23350         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
23351         return tag_ptr(ret_conv, true);
23352 }
23353
23354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23355         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
23356         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
23357         return ret_conv;
23358 }
23359
23360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23361         if (!ptr_is_owned(_res)) return;
23362         void* _res_ptr = untag_ptr(_res);
23363         CHECK_ACCESS(_res_ptr);
23364         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
23365         FREE(untag_ptr(_res));
23366         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
23367 }
23368
23369 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
23370         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23371         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
23372         return tag_ptr(ret_conv, true);
23373 }
23374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23375         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
23376         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
23377         return ret_conv;
23378 }
23379
23380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23381         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
23382         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23383         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
23384         return tag_ptr(ret_conv, true);
23385 }
23386
23387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
23388         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
23389         *ret_conv = CResult_NoneSendErrorZ_ok();
23390         return tag_ptr(ret_conv, true);
23391 }
23392
23393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23394         void* e_ptr = untag_ptr(e);
23395         CHECK_ACCESS(e_ptr);
23396         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
23397         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
23398         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
23399         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
23400         return tag_ptr(ret_conv, true);
23401 }
23402
23403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23404         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
23405         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
23406         return ret_conv;
23407 }
23408
23409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23410         if (!ptr_is_owned(_res)) return;
23411         void* _res_ptr = untag_ptr(_res);
23412         CHECK_ACCESS(_res_ptr);
23413         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
23414         FREE(untag_ptr(_res));
23415         CResult_NoneSendErrorZ_free(_res_conv);
23416 }
23417
23418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
23419         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
23420         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
23421         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
23422         return tag_ptr(ret_conv, true);
23423 }
23424
23425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23426         void* e_ptr = untag_ptr(e);
23427         CHECK_ACCESS(e_ptr);
23428         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
23429         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
23430         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
23431         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
23432         return tag_ptr(ret_conv, true);
23433 }
23434
23435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23436         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
23437         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
23438         return ret_conv;
23439 }
23440
23441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23442         if (!ptr_is_owned(_res)) return;
23443         void* _res_ptr = untag_ptr(_res);
23444         CHECK_ACCESS(_res_ptr);
23445         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
23446         FREE(untag_ptr(_res));
23447         CResult_SiPrefixParseErrorZ_free(_res_conv);
23448 }
23449
23450 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
23451         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
23452         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
23453         return tag_ptr(ret_conv, true);
23454 }
23455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23456         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
23457         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
23458         return ret_conv;
23459 }
23460
23461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23462         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
23463         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
23464         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
23465         return tag_ptr(ret_conv, true);
23466 }
23467
23468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23469         LDKInvoice o_conv;
23470         o_conv.inner = untag_ptr(o);
23471         o_conv.is_owned = ptr_is_owned(o);
23472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23473         o_conv = Invoice_clone(&o_conv);
23474         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
23475         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
23476         return tag_ptr(ret_conv, true);
23477 }
23478
23479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23480         void* e_ptr = untag_ptr(e);
23481         CHECK_ACCESS(e_ptr);
23482         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
23483         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
23484         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
23485         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
23486         return tag_ptr(ret_conv, true);
23487 }
23488
23489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23490         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
23491         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
23492         return ret_conv;
23493 }
23494
23495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23496         if (!ptr_is_owned(_res)) return;
23497         void* _res_ptr = untag_ptr(_res);
23498         CHECK_ACCESS(_res_ptr);
23499         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
23500         FREE(untag_ptr(_res));
23501         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
23502 }
23503
23504 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
23505         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
23506         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
23507         return tag_ptr(ret_conv, true);
23508 }
23509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23510         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
23511         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
23512         return ret_conv;
23513 }
23514
23515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23516         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
23517         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
23518         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
23519         return tag_ptr(ret_conv, true);
23520 }
23521
23522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23523         LDKSignedRawInvoice o_conv;
23524         o_conv.inner = untag_ptr(o);
23525         o_conv.is_owned = ptr_is_owned(o);
23526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23527         o_conv = SignedRawInvoice_clone(&o_conv);
23528         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
23529         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
23530         return tag_ptr(ret_conv, true);
23531 }
23532
23533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23534         void* e_ptr = untag_ptr(e);
23535         CHECK_ACCESS(e_ptr);
23536         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
23537         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
23538         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
23539         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
23540         return tag_ptr(ret_conv, true);
23541 }
23542
23543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23544         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
23545         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
23546         return ret_conv;
23547 }
23548
23549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23550         if (!ptr_is_owned(_res)) return;
23551         void* _res_ptr = untag_ptr(_res);
23552         CHECK_ACCESS(_res_ptr);
23553         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
23554         FREE(untag_ptr(_res));
23555         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
23556 }
23557
23558 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
23559         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
23560         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
23561         return tag_ptr(ret_conv, true);
23562 }
23563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23564         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
23565         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
23566         return ret_conv;
23567 }
23568
23569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23570         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
23571         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
23572         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
23573         return tag_ptr(ret_conv, true);
23574 }
23575
23576 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
23577         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
23578         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
23579         return tag_ptr(ret_conv, true);
23580 }
23581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23582         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
23583         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
23584         return ret_conv;
23585 }
23586
23587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23588         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
23589         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
23590         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
23591         return tag_ptr(ret_conv, true);
23592 }
23593
23594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
23595         LDKRawInvoice a_conv;
23596         a_conv.inner = untag_ptr(a);
23597         a_conv.is_owned = ptr_is_owned(a);
23598         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23599         a_conv = RawInvoice_clone(&a_conv);
23600         LDKThirtyTwoBytes b_ref;
23601         CHECK((*env)->GetArrayLength(env, b) == 32);
23602         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
23603         LDKInvoiceSignature c_conv;
23604         c_conv.inner = untag_ptr(c);
23605         c_conv.is_owned = ptr_is_owned(c);
23606         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
23607         c_conv = InvoiceSignature_clone(&c_conv);
23608         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
23609         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
23610         return tag_ptr(ret_conv, true);
23611 }
23612
23613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23614         if (!ptr_is_owned(_res)) return;
23615         void* _res_ptr = untag_ptr(_res);
23616         CHECK_ACCESS(_res_ptr);
23617         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
23618         FREE(untag_ptr(_res));
23619         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
23620 }
23621
23622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23623         LDKPayeePubKey o_conv;
23624         o_conv.inner = untag_ptr(o);
23625         o_conv.is_owned = ptr_is_owned(o);
23626         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23627         o_conv = PayeePubKey_clone(&o_conv);
23628         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
23629         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
23630         return tag_ptr(ret_conv, true);
23631 }
23632
23633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23634         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
23635         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
23636         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
23637         return tag_ptr(ret_conv, true);
23638 }
23639
23640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23641         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
23642         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
23643         return ret_conv;
23644 }
23645
23646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23647         if (!ptr_is_owned(_res)) return;
23648         void* _res_ptr = untag_ptr(_res);
23649         CHECK_ACCESS(_res_ptr);
23650         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
23651         FREE(untag_ptr(_res));
23652         CResult_PayeePubKeyErrorZ_free(_res_conv);
23653 }
23654
23655 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
23656         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
23657         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
23658         return tag_ptr(ret_conv, true);
23659 }
23660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23661         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
23662         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
23663         return ret_conv;
23664 }
23665
23666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23667         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
23668         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
23669         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
23670         return tag_ptr(ret_conv, true);
23671 }
23672
23673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23674         LDKCVec_PrivateRouteZ _res_constr;
23675         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23676         if (_res_constr.datalen > 0)
23677                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
23678         else
23679                 _res_constr.data = NULL;
23680         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23681         for (size_t o = 0; o < _res_constr.datalen; o++) {
23682                 int64_t _res_conv_14 = _res_vals[o];
23683                 LDKPrivateRoute _res_conv_14_conv;
23684                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
23685                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
23686                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
23687                 _res_constr.data[o] = _res_conv_14_conv;
23688         }
23689         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23690         CVec_PrivateRouteZ_free(_res_constr);
23691 }
23692
23693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23694         LDKPositiveTimestamp o_conv;
23695         o_conv.inner = untag_ptr(o);
23696         o_conv.is_owned = ptr_is_owned(o);
23697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23698         o_conv = PositiveTimestamp_clone(&o_conv);
23699         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23700         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
23701         return tag_ptr(ret_conv, true);
23702 }
23703
23704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23705         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
23706         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23707         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
23708         return tag_ptr(ret_conv, true);
23709 }
23710
23711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23712         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
23713         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
23714         return ret_conv;
23715 }
23716
23717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23718         if (!ptr_is_owned(_res)) return;
23719         void* _res_ptr = untag_ptr(_res);
23720         CHECK_ACCESS(_res_ptr);
23721         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
23722         FREE(untag_ptr(_res));
23723         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
23724 }
23725
23726 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
23727         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23728         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
23729         return tag_ptr(ret_conv, true);
23730 }
23731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23732         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
23733         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
23734         return ret_conv;
23735 }
23736
23737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23738         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
23739         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
23740         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
23741         return tag_ptr(ret_conv, true);
23742 }
23743
23744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
23745         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
23746         *ret_conv = CResult_NoneSemanticErrorZ_ok();
23747         return tag_ptr(ret_conv, true);
23748 }
23749
23750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23751         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
23752         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
23753         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
23754         return tag_ptr(ret_conv, true);
23755 }
23756
23757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23758         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
23759         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
23760         return ret_conv;
23761 }
23762
23763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23764         if (!ptr_is_owned(_res)) return;
23765         void* _res_ptr = untag_ptr(_res);
23766         CHECK_ACCESS(_res_ptr);
23767         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
23768         FREE(untag_ptr(_res));
23769         CResult_NoneSemanticErrorZ_free(_res_conv);
23770 }
23771
23772 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
23773         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
23774         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
23775         return tag_ptr(ret_conv, true);
23776 }
23777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23778         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
23779         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
23780         return ret_conv;
23781 }
23782
23783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23784         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
23785         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
23786         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
23787         return tag_ptr(ret_conv, true);
23788 }
23789
23790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23791         LDKInvoice o_conv;
23792         o_conv.inner = untag_ptr(o);
23793         o_conv.is_owned = ptr_is_owned(o);
23794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23795         o_conv = Invoice_clone(&o_conv);
23796         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
23797         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
23798         return tag_ptr(ret_conv, true);
23799 }
23800
23801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23802         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
23803         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
23804         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
23805         return tag_ptr(ret_conv, true);
23806 }
23807
23808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23809         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
23810         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
23811         return ret_conv;
23812 }
23813
23814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23815         if (!ptr_is_owned(_res)) return;
23816         void* _res_ptr = untag_ptr(_res);
23817         CHECK_ACCESS(_res_ptr);
23818         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
23819         FREE(untag_ptr(_res));
23820         CResult_InvoiceSemanticErrorZ_free(_res_conv);
23821 }
23822
23823 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
23824         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
23825         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
23826         return tag_ptr(ret_conv, true);
23827 }
23828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23829         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
23830         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
23831         return ret_conv;
23832 }
23833
23834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23835         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
23836         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
23837         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
23838         return tag_ptr(ret_conv, true);
23839 }
23840
23841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23842         LDKDescription o_conv;
23843         o_conv.inner = untag_ptr(o);
23844         o_conv.is_owned = ptr_is_owned(o);
23845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23846         o_conv = Description_clone(&o_conv);
23847         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
23848         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
23849         return tag_ptr(ret_conv, true);
23850 }
23851
23852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23853         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
23854         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
23855         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
23856         return tag_ptr(ret_conv, true);
23857 }
23858
23859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23860         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
23861         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
23862         return ret_conv;
23863 }
23864
23865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23866         if (!ptr_is_owned(_res)) return;
23867         void* _res_ptr = untag_ptr(_res);
23868         CHECK_ACCESS(_res_ptr);
23869         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
23870         FREE(untag_ptr(_res));
23871         CResult_DescriptionCreationErrorZ_free(_res_conv);
23872 }
23873
23874 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
23875         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
23876         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
23877         return tag_ptr(ret_conv, true);
23878 }
23879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23880         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
23881         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
23882         return ret_conv;
23883 }
23884
23885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23886         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
23887         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
23888         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
23889         return tag_ptr(ret_conv, true);
23890 }
23891
23892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23893         LDKPrivateRoute o_conv;
23894         o_conv.inner = untag_ptr(o);
23895         o_conv.is_owned = ptr_is_owned(o);
23896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23897         o_conv = PrivateRoute_clone(&o_conv);
23898         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
23899         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
23900         return tag_ptr(ret_conv, true);
23901 }
23902
23903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23904         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
23905         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
23906         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
23907         return tag_ptr(ret_conv, true);
23908 }
23909
23910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23911         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
23912         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
23913         return ret_conv;
23914 }
23915
23916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23917         if (!ptr_is_owned(_res)) return;
23918         void* _res_ptr = untag_ptr(_res);
23919         CHECK_ACCESS(_res_ptr);
23920         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
23921         FREE(untag_ptr(_res));
23922         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
23923 }
23924
23925 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
23926         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
23927         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
23928         return tag_ptr(ret_conv, true);
23929 }
23930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23931         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
23932         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
23933         return ret_conv;
23934 }
23935
23936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23937         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
23938         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
23939         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
23940         return tag_ptr(ret_conv, true);
23941 }
23942
23943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
23944         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
23945         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
23946         return tag_ptr(ret_conv, true);
23947 }
23948
23949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23950         void* e_ptr = untag_ptr(e);
23951         CHECK_ACCESS(e_ptr);
23952         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
23953         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
23954         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
23955         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
23956         return tag_ptr(ret_conv, true);
23957 }
23958
23959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23960         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
23961         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
23962         return ret_conv;
23963 }
23964
23965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23966         if (!ptr_is_owned(_res)) return;
23967         void* _res_ptr = untag_ptr(_res);
23968         CHECK_ACCESS(_res_ptr);
23969         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
23970         FREE(untag_ptr(_res));
23971         CResult_u32GraphSyncErrorZ_free(_res_conv);
23972 }
23973
23974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23975         void* o_ptr = untag_ptr(o);
23976         CHECK_ACCESS(o_ptr);
23977         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
23978         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
23979         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23980         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
23981         return tag_ptr(ret_conv, true);
23982 }
23983
23984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23985         void* e_ptr = untag_ptr(e);
23986         CHECK_ACCESS(e_ptr);
23987         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23988         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23989         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23990         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
23991         return tag_ptr(ret_conv, true);
23992 }
23993
23994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23995         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
23996         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
23997         return ret_conv;
23998 }
23999
24000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24001         if (!ptr_is_owned(_res)) return;
24002         void* _res_ptr = untag_ptr(_res);
24003         CHECK_ACCESS(_res_ptr);
24004         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
24005         FREE(untag_ptr(_res));
24006         CResult_NetAddressDecodeErrorZ_free(_res_conv);
24007 }
24008
24009 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
24010         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
24011         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
24012         return tag_ptr(ret_conv, true);
24013 }
24014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24015         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
24016         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
24017         return ret_conv;
24018 }
24019
24020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24021         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
24022         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
24023         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
24024         return tag_ptr(ret_conv, true);
24025 }
24026
24027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24028         LDKCVec_UpdateAddHTLCZ _res_constr;
24029         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24030         if (_res_constr.datalen > 0)
24031                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
24032         else
24033                 _res_constr.data = NULL;
24034         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24035         for (size_t p = 0; p < _res_constr.datalen; p++) {
24036                 int64_t _res_conv_15 = _res_vals[p];
24037                 LDKUpdateAddHTLC _res_conv_15_conv;
24038                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
24039                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
24040                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
24041                 _res_constr.data[p] = _res_conv_15_conv;
24042         }
24043         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24044         CVec_UpdateAddHTLCZ_free(_res_constr);
24045 }
24046
24047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24048         LDKCVec_UpdateFulfillHTLCZ _res_constr;
24049         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24050         if (_res_constr.datalen > 0)
24051                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
24052         else
24053                 _res_constr.data = NULL;
24054         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24055         for (size_t t = 0; t < _res_constr.datalen; t++) {
24056                 int64_t _res_conv_19 = _res_vals[t];
24057                 LDKUpdateFulfillHTLC _res_conv_19_conv;
24058                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
24059                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
24060                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
24061                 _res_constr.data[t] = _res_conv_19_conv;
24062         }
24063         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24064         CVec_UpdateFulfillHTLCZ_free(_res_constr);
24065 }
24066
24067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24068         LDKCVec_UpdateFailHTLCZ _res_constr;
24069         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24070         if (_res_constr.datalen > 0)
24071                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
24072         else
24073                 _res_constr.data = NULL;
24074         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24075         for (size_t q = 0; q < _res_constr.datalen; q++) {
24076                 int64_t _res_conv_16 = _res_vals[q];
24077                 LDKUpdateFailHTLC _res_conv_16_conv;
24078                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
24079                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
24080                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
24081                 _res_constr.data[q] = _res_conv_16_conv;
24082         }
24083         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24084         CVec_UpdateFailHTLCZ_free(_res_constr);
24085 }
24086
24087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24088         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
24089         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24090         if (_res_constr.datalen > 0)
24091                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
24092         else
24093                 _res_constr.data = NULL;
24094         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24095         for (size_t z = 0; z < _res_constr.datalen; z++) {
24096                 int64_t _res_conv_25 = _res_vals[z];
24097                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
24098                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
24099                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
24100                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
24101                 _res_constr.data[z] = _res_conv_25_conv;
24102         }
24103         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24104         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
24105 }
24106
24107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24108         LDKAcceptChannel o_conv;
24109         o_conv.inner = untag_ptr(o);
24110         o_conv.is_owned = ptr_is_owned(o);
24111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24112         o_conv = AcceptChannel_clone(&o_conv);
24113         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24114         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
24115         return tag_ptr(ret_conv, true);
24116 }
24117
24118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24119         void* e_ptr = untag_ptr(e);
24120         CHECK_ACCESS(e_ptr);
24121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24123         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24124         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
24125         return tag_ptr(ret_conv, true);
24126 }
24127
24128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24129         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
24130         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
24131         return ret_conv;
24132 }
24133
24134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24135         if (!ptr_is_owned(_res)) return;
24136         void* _res_ptr = untag_ptr(_res);
24137         CHECK_ACCESS(_res_ptr);
24138         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
24139         FREE(untag_ptr(_res));
24140         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
24141 }
24142
24143 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
24144         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24145         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
24146         return tag_ptr(ret_conv, true);
24147 }
24148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24149         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
24150         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
24151         return ret_conv;
24152 }
24153
24154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24155         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
24156         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24157         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
24158         return tag_ptr(ret_conv, true);
24159 }
24160
24161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24162         LDKAnnouncementSignatures o_conv;
24163         o_conv.inner = untag_ptr(o);
24164         o_conv.is_owned = ptr_is_owned(o);
24165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24166         o_conv = AnnouncementSignatures_clone(&o_conv);
24167         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24168         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
24169         return tag_ptr(ret_conv, true);
24170 }
24171
24172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24173         void* e_ptr = untag_ptr(e);
24174         CHECK_ACCESS(e_ptr);
24175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24177         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24178         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
24179         return tag_ptr(ret_conv, true);
24180 }
24181
24182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24183         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
24184         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
24185         return ret_conv;
24186 }
24187
24188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24189         if (!ptr_is_owned(_res)) return;
24190         void* _res_ptr = untag_ptr(_res);
24191         CHECK_ACCESS(_res_ptr);
24192         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
24193         FREE(untag_ptr(_res));
24194         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
24195 }
24196
24197 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24198         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24199         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
24200         return tag_ptr(ret_conv, true);
24201 }
24202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24203         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
24204         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24205         return ret_conv;
24206 }
24207
24208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24209         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
24210         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24211         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
24212         return tag_ptr(ret_conv, true);
24213 }
24214
24215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24216         LDKChannelReestablish o_conv;
24217         o_conv.inner = untag_ptr(o);
24218         o_conv.is_owned = ptr_is_owned(o);
24219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24220         o_conv = ChannelReestablish_clone(&o_conv);
24221         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24222         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
24223         return tag_ptr(ret_conv, true);
24224 }
24225
24226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24227         void* e_ptr = untag_ptr(e);
24228         CHECK_ACCESS(e_ptr);
24229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24231         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24232         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
24233         return tag_ptr(ret_conv, true);
24234 }
24235
24236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24237         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
24238         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
24239         return ret_conv;
24240 }
24241
24242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24243         if (!ptr_is_owned(_res)) return;
24244         void* _res_ptr = untag_ptr(_res);
24245         CHECK_ACCESS(_res_ptr);
24246         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
24247         FREE(untag_ptr(_res));
24248         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
24249 }
24250
24251 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
24252         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24253         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
24254         return tag_ptr(ret_conv, true);
24255 }
24256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24257         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
24258         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
24259         return ret_conv;
24260 }
24261
24262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24263         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
24264         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24265         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
24266         return tag_ptr(ret_conv, true);
24267 }
24268
24269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24270         LDKClosingSigned o_conv;
24271         o_conv.inner = untag_ptr(o);
24272         o_conv.is_owned = ptr_is_owned(o);
24273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24274         o_conv = ClosingSigned_clone(&o_conv);
24275         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24276         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
24277         return tag_ptr(ret_conv, true);
24278 }
24279
24280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24281         void* e_ptr = untag_ptr(e);
24282         CHECK_ACCESS(e_ptr);
24283         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24284         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24285         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24286         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
24287         return tag_ptr(ret_conv, true);
24288 }
24289
24290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24291         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
24292         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
24293         return ret_conv;
24294 }
24295
24296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24297         if (!ptr_is_owned(_res)) return;
24298         void* _res_ptr = untag_ptr(_res);
24299         CHECK_ACCESS(_res_ptr);
24300         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
24301         FREE(untag_ptr(_res));
24302         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
24303 }
24304
24305 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
24306         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24307         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
24308         return tag_ptr(ret_conv, true);
24309 }
24310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24311         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
24312         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
24313         return ret_conv;
24314 }
24315
24316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24317         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
24318         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24319         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
24320         return tag_ptr(ret_conv, true);
24321 }
24322
24323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24324         LDKClosingSignedFeeRange o_conv;
24325         o_conv.inner = untag_ptr(o);
24326         o_conv.is_owned = ptr_is_owned(o);
24327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24328         o_conv = ClosingSignedFeeRange_clone(&o_conv);
24329         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24330         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
24331         return tag_ptr(ret_conv, true);
24332 }
24333
24334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24335         void* e_ptr = untag_ptr(e);
24336         CHECK_ACCESS(e_ptr);
24337         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24338         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24339         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24340         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
24341         return tag_ptr(ret_conv, true);
24342 }
24343
24344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24345         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
24346         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
24347         return ret_conv;
24348 }
24349
24350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24351         if (!ptr_is_owned(_res)) return;
24352         void* _res_ptr = untag_ptr(_res);
24353         CHECK_ACCESS(_res_ptr);
24354         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
24355         FREE(untag_ptr(_res));
24356         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
24357 }
24358
24359 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
24360         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24361         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
24362         return tag_ptr(ret_conv, true);
24363 }
24364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24365         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
24366         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
24367         return ret_conv;
24368 }
24369
24370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24371         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
24372         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24373         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
24374         return tag_ptr(ret_conv, true);
24375 }
24376
24377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24378         LDKCommitmentSigned o_conv;
24379         o_conv.inner = untag_ptr(o);
24380         o_conv.is_owned = ptr_is_owned(o);
24381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24382         o_conv = CommitmentSigned_clone(&o_conv);
24383         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24384         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
24385         return tag_ptr(ret_conv, true);
24386 }
24387
24388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24389         void* e_ptr = untag_ptr(e);
24390         CHECK_ACCESS(e_ptr);
24391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24393         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24394         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
24395         return tag_ptr(ret_conv, true);
24396 }
24397
24398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24399         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
24400         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
24401         return ret_conv;
24402 }
24403
24404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24405         if (!ptr_is_owned(_res)) return;
24406         void* _res_ptr = untag_ptr(_res);
24407         CHECK_ACCESS(_res_ptr);
24408         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
24409         FREE(untag_ptr(_res));
24410         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
24411 }
24412
24413 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
24414         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24415         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
24416         return tag_ptr(ret_conv, true);
24417 }
24418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24419         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
24420         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
24421         return ret_conv;
24422 }
24423
24424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24425         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
24426         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24427         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
24428         return tag_ptr(ret_conv, true);
24429 }
24430
24431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24432         LDKFundingCreated o_conv;
24433         o_conv.inner = untag_ptr(o);
24434         o_conv.is_owned = ptr_is_owned(o);
24435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24436         o_conv = FundingCreated_clone(&o_conv);
24437         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24438         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
24439         return tag_ptr(ret_conv, true);
24440 }
24441
24442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24443         void* e_ptr = untag_ptr(e);
24444         CHECK_ACCESS(e_ptr);
24445         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24446         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24447         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24448         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
24449         return tag_ptr(ret_conv, true);
24450 }
24451
24452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24453         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
24454         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
24455         return ret_conv;
24456 }
24457
24458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24459         if (!ptr_is_owned(_res)) return;
24460         void* _res_ptr = untag_ptr(_res);
24461         CHECK_ACCESS(_res_ptr);
24462         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
24463         FREE(untag_ptr(_res));
24464         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
24465 }
24466
24467 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
24468         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24469         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
24470         return tag_ptr(ret_conv, true);
24471 }
24472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24473         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
24474         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
24475         return ret_conv;
24476 }
24477
24478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24479         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
24480         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24481         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
24482         return tag_ptr(ret_conv, true);
24483 }
24484
24485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24486         LDKFundingSigned o_conv;
24487         o_conv.inner = untag_ptr(o);
24488         o_conv.is_owned = ptr_is_owned(o);
24489         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24490         o_conv = FundingSigned_clone(&o_conv);
24491         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24492         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
24493         return tag_ptr(ret_conv, true);
24494 }
24495
24496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24497         void* e_ptr = untag_ptr(e);
24498         CHECK_ACCESS(e_ptr);
24499         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24500         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24501         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24502         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
24503         return tag_ptr(ret_conv, true);
24504 }
24505
24506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24507         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
24508         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
24509         return ret_conv;
24510 }
24511
24512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24513         if (!ptr_is_owned(_res)) return;
24514         void* _res_ptr = untag_ptr(_res);
24515         CHECK_ACCESS(_res_ptr);
24516         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
24517         FREE(untag_ptr(_res));
24518         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
24519 }
24520
24521 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
24522         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24523         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
24524         return tag_ptr(ret_conv, true);
24525 }
24526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24527         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
24528         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
24529         return ret_conv;
24530 }
24531
24532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24533         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
24534         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24535         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
24536         return tag_ptr(ret_conv, true);
24537 }
24538
24539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24540         LDKChannelReady o_conv;
24541         o_conv.inner = untag_ptr(o);
24542         o_conv.is_owned = ptr_is_owned(o);
24543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24544         o_conv = ChannelReady_clone(&o_conv);
24545         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24546         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
24547         return tag_ptr(ret_conv, true);
24548 }
24549
24550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24551         void* e_ptr = untag_ptr(e);
24552         CHECK_ACCESS(e_ptr);
24553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24555         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24556         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
24557         return tag_ptr(ret_conv, true);
24558 }
24559
24560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24561         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
24562         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
24563         return ret_conv;
24564 }
24565
24566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24567         if (!ptr_is_owned(_res)) return;
24568         void* _res_ptr = untag_ptr(_res);
24569         CHECK_ACCESS(_res_ptr);
24570         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
24571         FREE(untag_ptr(_res));
24572         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
24573 }
24574
24575 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
24576         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24577         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
24578         return tag_ptr(ret_conv, true);
24579 }
24580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24581         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
24582         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
24583         return ret_conv;
24584 }
24585
24586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24587         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
24588         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24589         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
24590         return tag_ptr(ret_conv, true);
24591 }
24592
24593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24594         LDKInit o_conv;
24595         o_conv.inner = untag_ptr(o);
24596         o_conv.is_owned = ptr_is_owned(o);
24597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24598         o_conv = Init_clone(&o_conv);
24599         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24600         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
24601         return tag_ptr(ret_conv, true);
24602 }
24603
24604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24605         void* e_ptr = untag_ptr(e);
24606         CHECK_ACCESS(e_ptr);
24607         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24608         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24609         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24610         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
24611         return tag_ptr(ret_conv, true);
24612 }
24613
24614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24615         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
24616         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
24617         return ret_conv;
24618 }
24619
24620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24621         if (!ptr_is_owned(_res)) return;
24622         void* _res_ptr = untag_ptr(_res);
24623         CHECK_ACCESS(_res_ptr);
24624         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
24625         FREE(untag_ptr(_res));
24626         CResult_InitDecodeErrorZ_free(_res_conv);
24627 }
24628
24629 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
24630         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24631         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
24632         return tag_ptr(ret_conv, true);
24633 }
24634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24635         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
24636         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
24637         return ret_conv;
24638 }
24639
24640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24641         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
24642         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24643         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
24644         return tag_ptr(ret_conv, true);
24645 }
24646
24647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24648         LDKOpenChannel o_conv;
24649         o_conv.inner = untag_ptr(o);
24650         o_conv.is_owned = ptr_is_owned(o);
24651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24652         o_conv = OpenChannel_clone(&o_conv);
24653         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24654         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
24655         return tag_ptr(ret_conv, true);
24656 }
24657
24658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24659         void* e_ptr = untag_ptr(e);
24660         CHECK_ACCESS(e_ptr);
24661         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24662         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24663         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24664         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
24665         return tag_ptr(ret_conv, true);
24666 }
24667
24668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24669         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
24670         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
24671         return ret_conv;
24672 }
24673
24674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24675         if (!ptr_is_owned(_res)) return;
24676         void* _res_ptr = untag_ptr(_res);
24677         CHECK_ACCESS(_res_ptr);
24678         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
24679         FREE(untag_ptr(_res));
24680         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
24681 }
24682
24683 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
24684         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24685         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
24686         return tag_ptr(ret_conv, true);
24687 }
24688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24689         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
24690         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
24691         return ret_conv;
24692 }
24693
24694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24695         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
24696         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24697         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
24698         return tag_ptr(ret_conv, true);
24699 }
24700
24701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24702         LDKRevokeAndACK o_conv;
24703         o_conv.inner = untag_ptr(o);
24704         o_conv.is_owned = ptr_is_owned(o);
24705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24706         o_conv = RevokeAndACK_clone(&o_conv);
24707         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24708         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
24709         return tag_ptr(ret_conv, true);
24710 }
24711
24712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24713         void* e_ptr = untag_ptr(e);
24714         CHECK_ACCESS(e_ptr);
24715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24717         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24718         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
24719         return tag_ptr(ret_conv, true);
24720 }
24721
24722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24723         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
24724         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
24725         return ret_conv;
24726 }
24727
24728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24729         if (!ptr_is_owned(_res)) return;
24730         void* _res_ptr = untag_ptr(_res);
24731         CHECK_ACCESS(_res_ptr);
24732         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
24733         FREE(untag_ptr(_res));
24734         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
24735 }
24736
24737 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
24738         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24739         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
24740         return tag_ptr(ret_conv, true);
24741 }
24742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24743         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
24744         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
24745         return ret_conv;
24746 }
24747
24748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24749         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
24750         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24751         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
24752         return tag_ptr(ret_conv, true);
24753 }
24754
24755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24756         LDKShutdown o_conv;
24757         o_conv.inner = untag_ptr(o);
24758         o_conv.is_owned = ptr_is_owned(o);
24759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24760         o_conv = Shutdown_clone(&o_conv);
24761         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24762         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
24763         return tag_ptr(ret_conv, true);
24764 }
24765
24766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24767         void* e_ptr = untag_ptr(e);
24768         CHECK_ACCESS(e_ptr);
24769         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24770         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24771         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24772         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
24773         return tag_ptr(ret_conv, true);
24774 }
24775
24776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24777         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
24778         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
24779         return ret_conv;
24780 }
24781
24782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24783         if (!ptr_is_owned(_res)) return;
24784         void* _res_ptr = untag_ptr(_res);
24785         CHECK_ACCESS(_res_ptr);
24786         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
24787         FREE(untag_ptr(_res));
24788         CResult_ShutdownDecodeErrorZ_free(_res_conv);
24789 }
24790
24791 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
24792         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24793         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
24794         return tag_ptr(ret_conv, true);
24795 }
24796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24797         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
24798         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
24799         return ret_conv;
24800 }
24801
24802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24803         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
24804         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24805         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
24806         return tag_ptr(ret_conv, true);
24807 }
24808
24809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24810         LDKUpdateFailHTLC o_conv;
24811         o_conv.inner = untag_ptr(o);
24812         o_conv.is_owned = ptr_is_owned(o);
24813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24814         o_conv = UpdateFailHTLC_clone(&o_conv);
24815         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24816         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
24817         return tag_ptr(ret_conv, true);
24818 }
24819
24820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24821         void* e_ptr = untag_ptr(e);
24822         CHECK_ACCESS(e_ptr);
24823         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24824         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24825         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24826         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
24827         return tag_ptr(ret_conv, true);
24828 }
24829
24830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24831         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
24832         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
24833         return ret_conv;
24834 }
24835
24836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24837         if (!ptr_is_owned(_res)) return;
24838         void* _res_ptr = untag_ptr(_res);
24839         CHECK_ACCESS(_res_ptr);
24840         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
24841         FREE(untag_ptr(_res));
24842         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
24843 }
24844
24845 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
24846         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24847         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
24848         return tag_ptr(ret_conv, true);
24849 }
24850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24851         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
24852         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
24853         return ret_conv;
24854 }
24855
24856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24857         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
24858         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24859         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
24860         return tag_ptr(ret_conv, true);
24861 }
24862
24863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24864         LDKUpdateFailMalformedHTLC o_conv;
24865         o_conv.inner = untag_ptr(o);
24866         o_conv.is_owned = ptr_is_owned(o);
24867         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24868         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
24869         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24870         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
24871         return tag_ptr(ret_conv, true);
24872 }
24873
24874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24875         void* e_ptr = untag_ptr(e);
24876         CHECK_ACCESS(e_ptr);
24877         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24878         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24879         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24880         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
24881         return tag_ptr(ret_conv, true);
24882 }
24883
24884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24885         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
24886         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
24887         return ret_conv;
24888 }
24889
24890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24891         if (!ptr_is_owned(_res)) return;
24892         void* _res_ptr = untag_ptr(_res);
24893         CHECK_ACCESS(_res_ptr);
24894         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
24895         FREE(untag_ptr(_res));
24896         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
24897 }
24898
24899 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
24900         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24901         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
24902         return tag_ptr(ret_conv, true);
24903 }
24904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24905         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
24906         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
24907         return ret_conv;
24908 }
24909
24910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24911         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
24912         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24913         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
24914         return tag_ptr(ret_conv, true);
24915 }
24916
24917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24918         LDKUpdateFee o_conv;
24919         o_conv.inner = untag_ptr(o);
24920         o_conv.is_owned = ptr_is_owned(o);
24921         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24922         o_conv = UpdateFee_clone(&o_conv);
24923         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24924         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
24925         return tag_ptr(ret_conv, true);
24926 }
24927
24928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24929         void* e_ptr = untag_ptr(e);
24930         CHECK_ACCESS(e_ptr);
24931         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24932         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24933         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24934         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
24935         return tag_ptr(ret_conv, true);
24936 }
24937
24938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24939         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
24940         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
24941         return ret_conv;
24942 }
24943
24944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24945         if (!ptr_is_owned(_res)) return;
24946         void* _res_ptr = untag_ptr(_res);
24947         CHECK_ACCESS(_res_ptr);
24948         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
24949         FREE(untag_ptr(_res));
24950         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
24951 }
24952
24953 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
24954         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24955         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
24956         return tag_ptr(ret_conv, true);
24957 }
24958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24959         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
24960         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
24961         return ret_conv;
24962 }
24963
24964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24965         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
24966         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24967         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
24968         return tag_ptr(ret_conv, true);
24969 }
24970
24971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24972         LDKUpdateFulfillHTLC o_conv;
24973         o_conv.inner = untag_ptr(o);
24974         o_conv.is_owned = ptr_is_owned(o);
24975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24976         o_conv = UpdateFulfillHTLC_clone(&o_conv);
24977         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24978         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
24979         return tag_ptr(ret_conv, true);
24980 }
24981
24982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24983         void* e_ptr = untag_ptr(e);
24984         CHECK_ACCESS(e_ptr);
24985         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24986         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24987         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24988         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
24989         return tag_ptr(ret_conv, true);
24990 }
24991
24992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24993         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
24994         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
24995         return ret_conv;
24996 }
24997
24998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24999         if (!ptr_is_owned(_res)) return;
25000         void* _res_ptr = untag_ptr(_res);
25001         CHECK_ACCESS(_res_ptr);
25002         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
25003         FREE(untag_ptr(_res));
25004         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
25005 }
25006
25007 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
25008         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25009         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
25010         return tag_ptr(ret_conv, true);
25011 }
25012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25013         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
25014         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
25015         return ret_conv;
25016 }
25017
25018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25019         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
25020         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25021         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
25022         return tag_ptr(ret_conv, true);
25023 }
25024
25025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25026         LDKUpdateAddHTLC o_conv;
25027         o_conv.inner = untag_ptr(o);
25028         o_conv.is_owned = ptr_is_owned(o);
25029         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25030         o_conv = UpdateAddHTLC_clone(&o_conv);
25031         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25032         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
25033         return tag_ptr(ret_conv, true);
25034 }
25035
25036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25037         void* e_ptr = untag_ptr(e);
25038         CHECK_ACCESS(e_ptr);
25039         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25040         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25041         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25042         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
25043         return tag_ptr(ret_conv, true);
25044 }
25045
25046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25047         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
25048         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
25049         return ret_conv;
25050 }
25051
25052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25053         if (!ptr_is_owned(_res)) return;
25054         void* _res_ptr = untag_ptr(_res);
25055         CHECK_ACCESS(_res_ptr);
25056         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
25057         FREE(untag_ptr(_res));
25058         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
25059 }
25060
25061 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
25062         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25063         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
25064         return tag_ptr(ret_conv, true);
25065 }
25066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25067         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
25068         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
25069         return ret_conv;
25070 }
25071
25072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25073         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
25074         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25075         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
25076         return tag_ptr(ret_conv, true);
25077 }
25078
25079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25080         LDKOnionMessage o_conv;
25081         o_conv.inner = untag_ptr(o);
25082         o_conv.is_owned = ptr_is_owned(o);
25083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25084         o_conv = OnionMessage_clone(&o_conv);
25085         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25086         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
25087         return tag_ptr(ret_conv, true);
25088 }
25089
25090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25091         void* e_ptr = untag_ptr(e);
25092         CHECK_ACCESS(e_ptr);
25093         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25094         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25095         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25096         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
25097         return tag_ptr(ret_conv, true);
25098 }
25099
25100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25101         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
25102         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
25103         return ret_conv;
25104 }
25105
25106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25107         if (!ptr_is_owned(_res)) return;
25108         void* _res_ptr = untag_ptr(_res);
25109         CHECK_ACCESS(_res_ptr);
25110         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
25111         FREE(untag_ptr(_res));
25112         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
25113 }
25114
25115 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
25116         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25117         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
25118         return tag_ptr(ret_conv, true);
25119 }
25120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25121         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
25122         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
25123         return ret_conv;
25124 }
25125
25126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25127         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
25128         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25129         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
25130         return tag_ptr(ret_conv, true);
25131 }
25132
25133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25134         LDKPing o_conv;
25135         o_conv.inner = untag_ptr(o);
25136         o_conv.is_owned = ptr_is_owned(o);
25137         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25138         o_conv = Ping_clone(&o_conv);
25139         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25140         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
25141         return tag_ptr(ret_conv, true);
25142 }
25143
25144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25145         void* e_ptr = untag_ptr(e);
25146         CHECK_ACCESS(e_ptr);
25147         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25148         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25149         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25150         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
25151         return tag_ptr(ret_conv, true);
25152 }
25153
25154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25155         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
25156         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
25157         return ret_conv;
25158 }
25159
25160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25161         if (!ptr_is_owned(_res)) return;
25162         void* _res_ptr = untag_ptr(_res);
25163         CHECK_ACCESS(_res_ptr);
25164         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
25165         FREE(untag_ptr(_res));
25166         CResult_PingDecodeErrorZ_free(_res_conv);
25167 }
25168
25169 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
25170         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25171         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
25172         return tag_ptr(ret_conv, true);
25173 }
25174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25175         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
25176         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
25177         return ret_conv;
25178 }
25179
25180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25181         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
25182         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25183         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
25184         return tag_ptr(ret_conv, true);
25185 }
25186
25187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25188         LDKPong o_conv;
25189         o_conv.inner = untag_ptr(o);
25190         o_conv.is_owned = ptr_is_owned(o);
25191         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25192         o_conv = Pong_clone(&o_conv);
25193         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25194         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
25195         return tag_ptr(ret_conv, true);
25196 }
25197
25198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25199         void* e_ptr = untag_ptr(e);
25200         CHECK_ACCESS(e_ptr);
25201         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25202         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25203         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25204         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
25205         return tag_ptr(ret_conv, true);
25206 }
25207
25208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25209         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
25210         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
25211         return ret_conv;
25212 }
25213
25214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25215         if (!ptr_is_owned(_res)) return;
25216         void* _res_ptr = untag_ptr(_res);
25217         CHECK_ACCESS(_res_ptr);
25218         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
25219         FREE(untag_ptr(_res));
25220         CResult_PongDecodeErrorZ_free(_res_conv);
25221 }
25222
25223 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
25224         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25225         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
25226         return tag_ptr(ret_conv, true);
25227 }
25228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25229         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
25230         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
25231         return ret_conv;
25232 }
25233
25234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25235         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
25236         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25237         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
25238         return tag_ptr(ret_conv, true);
25239 }
25240
25241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25242         LDKUnsignedChannelAnnouncement o_conv;
25243         o_conv.inner = untag_ptr(o);
25244         o_conv.is_owned = ptr_is_owned(o);
25245         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25246         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
25247         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25248         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
25249         return tag_ptr(ret_conv, true);
25250 }
25251
25252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25253         void* e_ptr = untag_ptr(e);
25254         CHECK_ACCESS(e_ptr);
25255         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25256         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25257         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25258         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
25259         return tag_ptr(ret_conv, true);
25260 }
25261
25262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25263         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25264         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25265         return ret_conv;
25266 }
25267
25268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25269         if (!ptr_is_owned(_res)) return;
25270         void* _res_ptr = untag_ptr(_res);
25271         CHECK_ACCESS(_res_ptr);
25272         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25273         FREE(untag_ptr(_res));
25274         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
25275 }
25276
25277 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25278         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25279         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
25280         return tag_ptr(ret_conv, true);
25281 }
25282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25283         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25284         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25285         return ret_conv;
25286 }
25287
25288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25289         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25290         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25291         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25292         return tag_ptr(ret_conv, true);
25293 }
25294
25295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25296         LDKChannelAnnouncement o_conv;
25297         o_conv.inner = untag_ptr(o);
25298         o_conv.is_owned = ptr_is_owned(o);
25299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25300         o_conv = ChannelAnnouncement_clone(&o_conv);
25301         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25302         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
25303         return tag_ptr(ret_conv, true);
25304 }
25305
25306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25307         void* e_ptr = untag_ptr(e);
25308         CHECK_ACCESS(e_ptr);
25309         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25310         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25311         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25312         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
25313         return tag_ptr(ret_conv, true);
25314 }
25315
25316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25317         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25318         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25319         return ret_conv;
25320 }
25321
25322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25323         if (!ptr_is_owned(_res)) return;
25324         void* _res_ptr = untag_ptr(_res);
25325         CHECK_ACCESS(_res_ptr);
25326         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25327         FREE(untag_ptr(_res));
25328         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
25329 }
25330
25331 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25332         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25333         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
25334         return tag_ptr(ret_conv, true);
25335 }
25336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25337         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25338         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25339         return ret_conv;
25340 }
25341
25342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25343         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25344         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25345         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25346         return tag_ptr(ret_conv, true);
25347 }
25348
25349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25350         LDKUnsignedChannelUpdate o_conv;
25351         o_conv.inner = untag_ptr(o);
25352         o_conv.is_owned = ptr_is_owned(o);
25353         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25354         o_conv = UnsignedChannelUpdate_clone(&o_conv);
25355         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25356         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
25357         return tag_ptr(ret_conv, true);
25358 }
25359
25360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25361         void* e_ptr = untag_ptr(e);
25362         CHECK_ACCESS(e_ptr);
25363         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25364         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25365         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25366         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
25367         return tag_ptr(ret_conv, true);
25368 }
25369
25370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25371         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
25372         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
25373         return ret_conv;
25374 }
25375
25376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25377         if (!ptr_is_owned(_res)) return;
25378         void* _res_ptr = untag_ptr(_res);
25379         CHECK_ACCESS(_res_ptr);
25380         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
25381         FREE(untag_ptr(_res));
25382         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
25383 }
25384
25385 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25386         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25387         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
25388         return tag_ptr(ret_conv, true);
25389 }
25390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25391         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25392         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25393         return ret_conv;
25394 }
25395
25396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25397         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25398         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25399         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
25400         return tag_ptr(ret_conv, true);
25401 }
25402
25403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25404         LDKChannelUpdate o_conv;
25405         o_conv.inner = untag_ptr(o);
25406         o_conv.is_owned = ptr_is_owned(o);
25407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25408         o_conv = ChannelUpdate_clone(&o_conv);
25409         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25410         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
25411         return tag_ptr(ret_conv, true);
25412 }
25413
25414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25415         void* e_ptr = untag_ptr(e);
25416         CHECK_ACCESS(e_ptr);
25417         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25418         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25419         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25420         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
25421         return tag_ptr(ret_conv, true);
25422 }
25423
25424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25425         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
25426         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
25427         return ret_conv;
25428 }
25429
25430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25431         if (!ptr_is_owned(_res)) return;
25432         void* _res_ptr = untag_ptr(_res);
25433         CHECK_ACCESS(_res_ptr);
25434         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
25435         FREE(untag_ptr(_res));
25436         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
25437 }
25438
25439 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25440         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25441         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
25442         return tag_ptr(ret_conv, true);
25443 }
25444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25445         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25446         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25447         return ret_conv;
25448 }
25449
25450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25451         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25452         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25453         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
25454         return tag_ptr(ret_conv, true);
25455 }
25456
25457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25458         LDKErrorMessage o_conv;
25459         o_conv.inner = untag_ptr(o);
25460         o_conv.is_owned = ptr_is_owned(o);
25461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25462         o_conv = ErrorMessage_clone(&o_conv);
25463         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25464         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
25465         return tag_ptr(ret_conv, true);
25466 }
25467
25468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25469         void* e_ptr = untag_ptr(e);
25470         CHECK_ACCESS(e_ptr);
25471         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25472         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25473         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25474         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
25475         return tag_ptr(ret_conv, true);
25476 }
25477
25478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25479         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
25480         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
25481         return ret_conv;
25482 }
25483
25484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25485         if (!ptr_is_owned(_res)) return;
25486         void* _res_ptr = untag_ptr(_res);
25487         CHECK_ACCESS(_res_ptr);
25488         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
25489         FREE(untag_ptr(_res));
25490         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
25491 }
25492
25493 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
25494         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25495         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
25496         return tag_ptr(ret_conv, true);
25497 }
25498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25499         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
25500         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
25501         return ret_conv;
25502 }
25503
25504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25505         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
25506         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25507         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
25508         return tag_ptr(ret_conv, true);
25509 }
25510
25511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25512         LDKWarningMessage o_conv;
25513         o_conv.inner = untag_ptr(o);
25514         o_conv.is_owned = ptr_is_owned(o);
25515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25516         o_conv = WarningMessage_clone(&o_conv);
25517         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25518         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
25519         return tag_ptr(ret_conv, true);
25520 }
25521
25522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25523         void* e_ptr = untag_ptr(e);
25524         CHECK_ACCESS(e_ptr);
25525         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25526         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25527         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25528         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
25529         return tag_ptr(ret_conv, true);
25530 }
25531
25532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25533         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
25534         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
25535         return ret_conv;
25536 }
25537
25538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25539         if (!ptr_is_owned(_res)) return;
25540         void* _res_ptr = untag_ptr(_res);
25541         CHECK_ACCESS(_res_ptr);
25542         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
25543         FREE(untag_ptr(_res));
25544         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
25545 }
25546
25547 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
25548         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25549         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
25550         return tag_ptr(ret_conv, true);
25551 }
25552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25553         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
25554         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
25555         return ret_conv;
25556 }
25557
25558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25559         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
25560         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
25561         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
25562         return tag_ptr(ret_conv, true);
25563 }
25564
25565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25566         LDKUnsignedNodeAnnouncement o_conv;
25567         o_conv.inner = untag_ptr(o);
25568         o_conv.is_owned = ptr_is_owned(o);
25569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25570         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
25571         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25572         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25577         void* e_ptr = untag_ptr(e);
25578         CHECK_ACCESS(e_ptr);
25579         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25580         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25581         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25582         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
25583         return tag_ptr(ret_conv, true);
25584 }
25585
25586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25587         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25588         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25589         return ret_conv;
25590 }
25591
25592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25593         if (!ptr_is_owned(_res)) return;
25594         void* _res_ptr = untag_ptr(_res);
25595         CHECK_ACCESS(_res_ptr);
25596         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
25597         FREE(untag_ptr(_res));
25598         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
25599 }
25600
25601 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25602         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25603         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
25604         return tag_ptr(ret_conv, true);
25605 }
25606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25607         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25608         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25609         return ret_conv;
25610 }
25611
25612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25613         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25614         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25615         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
25616         return tag_ptr(ret_conv, true);
25617 }
25618
25619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25620         LDKNodeAnnouncement o_conv;
25621         o_conv.inner = untag_ptr(o);
25622         o_conv.is_owned = ptr_is_owned(o);
25623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25624         o_conv = NodeAnnouncement_clone(&o_conv);
25625         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25626         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
25627         return tag_ptr(ret_conv, true);
25628 }
25629
25630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25631         void* e_ptr = untag_ptr(e);
25632         CHECK_ACCESS(e_ptr);
25633         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25634         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25635         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25636         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
25637         return tag_ptr(ret_conv, true);
25638 }
25639
25640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25641         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
25642         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
25643         return ret_conv;
25644 }
25645
25646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25647         if (!ptr_is_owned(_res)) return;
25648         void* _res_ptr = untag_ptr(_res);
25649         CHECK_ACCESS(_res_ptr);
25650         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
25651         FREE(untag_ptr(_res));
25652         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
25653 }
25654
25655 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25656         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25657         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
25658         return tag_ptr(ret_conv, true);
25659 }
25660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25661         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
25662         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25663         return ret_conv;
25664 }
25665
25666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25667         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
25668         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25669         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
25670         return tag_ptr(ret_conv, true);
25671 }
25672
25673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25674         LDKQueryShortChannelIds o_conv;
25675         o_conv.inner = untag_ptr(o);
25676         o_conv.is_owned = ptr_is_owned(o);
25677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25678         o_conv = QueryShortChannelIds_clone(&o_conv);
25679         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25680         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
25681         return tag_ptr(ret_conv, true);
25682 }
25683
25684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25685         void* e_ptr = untag_ptr(e);
25686         CHECK_ACCESS(e_ptr);
25687         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25688         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25689         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25690         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
25691         return tag_ptr(ret_conv, true);
25692 }
25693
25694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25695         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
25696         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
25697         return ret_conv;
25698 }
25699
25700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25701         if (!ptr_is_owned(_res)) return;
25702         void* _res_ptr = untag_ptr(_res);
25703         CHECK_ACCESS(_res_ptr);
25704         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
25705         FREE(untag_ptr(_res));
25706         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
25707 }
25708
25709 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
25710         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25711         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
25712         return tag_ptr(ret_conv, true);
25713 }
25714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25715         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
25716         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
25717         return ret_conv;
25718 }
25719
25720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25721         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
25722         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25723         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
25724         return tag_ptr(ret_conv, true);
25725 }
25726
25727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25728         LDKReplyShortChannelIdsEnd o_conv;
25729         o_conv.inner = untag_ptr(o);
25730         o_conv.is_owned = ptr_is_owned(o);
25731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25732         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
25733         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25734         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
25735         return tag_ptr(ret_conv, true);
25736 }
25737
25738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25739         void* e_ptr = untag_ptr(e);
25740         CHECK_ACCESS(e_ptr);
25741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25743         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25744         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
25745         return tag_ptr(ret_conv, true);
25746 }
25747
25748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25749         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
25750         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
25751         return ret_conv;
25752 }
25753
25754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25755         if (!ptr_is_owned(_res)) return;
25756         void* _res_ptr = untag_ptr(_res);
25757         CHECK_ACCESS(_res_ptr);
25758         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
25759         FREE(untag_ptr(_res));
25760         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
25761 }
25762
25763 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
25764         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25765         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
25766         return tag_ptr(ret_conv, true);
25767 }
25768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25769         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
25770         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
25771         return ret_conv;
25772 }
25773
25774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25775         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
25776         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25777         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
25778         return tag_ptr(ret_conv, true);
25779 }
25780
25781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25782         LDKQueryChannelRange o_conv;
25783         o_conv.inner = untag_ptr(o);
25784         o_conv.is_owned = ptr_is_owned(o);
25785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25786         o_conv = QueryChannelRange_clone(&o_conv);
25787         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25788         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
25789         return tag_ptr(ret_conv, true);
25790 }
25791
25792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25793         void* e_ptr = untag_ptr(e);
25794         CHECK_ACCESS(e_ptr);
25795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25797         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25798         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
25799         return tag_ptr(ret_conv, true);
25800 }
25801
25802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25803         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
25804         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
25805         return ret_conv;
25806 }
25807
25808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25809         if (!ptr_is_owned(_res)) return;
25810         void* _res_ptr = untag_ptr(_res);
25811         CHECK_ACCESS(_res_ptr);
25812         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
25813         FREE(untag_ptr(_res));
25814         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
25815 }
25816
25817 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25818         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25819         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
25820         return tag_ptr(ret_conv, true);
25821 }
25822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25823         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
25824         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25825         return ret_conv;
25826 }
25827
25828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25829         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
25830         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25831         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
25832         return tag_ptr(ret_conv, true);
25833 }
25834
25835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25836         LDKReplyChannelRange o_conv;
25837         o_conv.inner = untag_ptr(o);
25838         o_conv.is_owned = ptr_is_owned(o);
25839         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25840         o_conv = ReplyChannelRange_clone(&o_conv);
25841         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25842         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
25843         return tag_ptr(ret_conv, true);
25844 }
25845
25846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25847         void* e_ptr = untag_ptr(e);
25848         CHECK_ACCESS(e_ptr);
25849         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25850         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25851         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25852         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
25853         return tag_ptr(ret_conv, true);
25854 }
25855
25856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25857         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
25858         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
25859         return ret_conv;
25860 }
25861
25862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25863         if (!ptr_is_owned(_res)) return;
25864         void* _res_ptr = untag_ptr(_res);
25865         CHECK_ACCESS(_res_ptr);
25866         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
25867         FREE(untag_ptr(_res));
25868         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
25869 }
25870
25871 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
25872         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25873         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
25874         return tag_ptr(ret_conv, true);
25875 }
25876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25877         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
25878         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
25879         return ret_conv;
25880 }
25881
25882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25883         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
25884         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25885         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
25886         return tag_ptr(ret_conv, true);
25887 }
25888
25889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25890         LDKGossipTimestampFilter o_conv;
25891         o_conv.inner = untag_ptr(o);
25892         o_conv.is_owned = ptr_is_owned(o);
25893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25894         o_conv = GossipTimestampFilter_clone(&o_conv);
25895         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25896         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
25897         return tag_ptr(ret_conv, true);
25898 }
25899
25900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25901         void* e_ptr = untag_ptr(e);
25902         CHECK_ACCESS(e_ptr);
25903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25905         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25906         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
25907         return tag_ptr(ret_conv, true);
25908 }
25909
25910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25911         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
25912         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
25913         return ret_conv;
25914 }
25915
25916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25917         if (!ptr_is_owned(_res)) return;
25918         void* _res_ptr = untag_ptr(_res);
25919         CHECK_ACCESS(_res_ptr);
25920         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
25921         FREE(untag_ptr(_res));
25922         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
25923 }
25924
25925 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
25926         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25927         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
25928         return tag_ptr(ret_conv, true);
25929 }
25930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25931         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
25932         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
25933         return ret_conv;
25934 }
25935
25936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25937         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
25938         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25939         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
25940         return tag_ptr(ret_conv, true);
25941 }
25942
25943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25944         LDKCVec_PhantomRouteHintsZ _res_constr;
25945         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25946         if (_res_constr.datalen > 0)
25947                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
25948         else
25949                 _res_constr.data = NULL;
25950         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25951         for (size_t t = 0; t < _res_constr.datalen; t++) {
25952                 int64_t _res_conv_19 = _res_vals[t];
25953                 LDKPhantomRouteHints _res_conv_19_conv;
25954                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
25955                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
25956                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
25957                 _res_constr.data[t] = _res_conv_19_conv;
25958         }
25959         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25960         CVec_PhantomRouteHintsZ_free(_res_constr);
25961 }
25962
25963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25964         LDKInvoice o_conv;
25965         o_conv.inner = untag_ptr(o);
25966         o_conv.is_owned = ptr_is_owned(o);
25967         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25968         o_conv = Invoice_clone(&o_conv);
25969         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25970         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
25971         return tag_ptr(ret_conv, true);
25972 }
25973
25974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25975         void* e_ptr = untag_ptr(e);
25976         CHECK_ACCESS(e_ptr);
25977         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
25978         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
25979         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25980         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
25981         return tag_ptr(ret_conv, true);
25982 }
25983
25984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25985         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
25986         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
25987         return ret_conv;
25988 }
25989
25990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25991         if (!ptr_is_owned(_res)) return;
25992         void* _res_ptr = untag_ptr(_res);
25993         CHECK_ACCESS(_res_ptr);
25994         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
25995         FREE(untag_ptr(_res));
25996         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
25997 }
25998
25999 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
26000         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
26001         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
26002         return tag_ptr(ret_conv, true);
26003 }
26004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26005         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
26006         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
26007         return ret_conv;
26008 }
26009
26010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26011         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
26012         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
26013         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
26014         return tag_ptr(ret_conv, true);
26015 }
26016
26017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26018         void* o_ptr = untag_ptr(o);
26019         CHECK_ACCESS(o_ptr);
26020         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
26021         if (o_conv.free == LDKFilter_JCalls_free) {
26022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26023                 LDKFilter_JCalls_cloned(&o_conv);
26024         }
26025         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
26026         *ret_copy = COption_FilterZ_some(o_conv);
26027         int64_t ret_ref = tag_ptr(ret_copy, true);
26028         return ret_ref;
26029 }
26030
26031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
26032         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
26033         *ret_copy = COption_FilterZ_none();
26034         int64_t ret_ref = tag_ptr(ret_copy, true);
26035         return ret_ref;
26036 }
26037
26038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26039         if (!ptr_is_owned(_res)) return;
26040         void* _res_ptr = untag_ptr(_res);
26041         CHECK_ACCESS(_res_ptr);
26042         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
26043         FREE(untag_ptr(_res));
26044         COption_FilterZ_free(_res_conv);
26045 }
26046
26047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26048         LDKLockedChannelMonitor o_conv;
26049         o_conv.inner = untag_ptr(o);
26050         o_conv.is_owned = ptr_is_owned(o);
26051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26052         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
26053         
26054         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26055         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
26056         return tag_ptr(ret_conv, true);
26057 }
26058
26059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
26060         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26061         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
26062         return tag_ptr(ret_conv, true);
26063 }
26064
26065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26066         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
26067         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
26068         return ret_conv;
26069 }
26070
26071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26072         if (!ptr_is_owned(_res)) return;
26073         void* _res_ptr = untag_ptr(_res);
26074         CHECK_ACCESS(_res_ptr);
26075         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
26076         FREE(untag_ptr(_res));
26077         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
26078 }
26079
26080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26081         LDKCVec_OutPointZ _res_constr;
26082         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26083         if (_res_constr.datalen > 0)
26084                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
26085         else
26086                 _res_constr.data = NULL;
26087         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26088         for (size_t k = 0; k < _res_constr.datalen; k++) {
26089                 int64_t _res_conv_10 = _res_vals[k];
26090                 LDKOutPoint _res_conv_10_conv;
26091                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
26092                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
26093                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
26094                 _res_constr.data[k] = _res_conv_10_conv;
26095         }
26096         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26097         CVec_OutPointZ_free(_res_constr);
26098 }
26099
26100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26101         LDKCVec_MonitorUpdateIdZ _res_constr;
26102         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26103         if (_res_constr.datalen > 0)
26104                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
26105         else
26106                 _res_constr.data = NULL;
26107         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26108         for (size_t r = 0; r < _res_constr.datalen; r++) {
26109                 int64_t _res_conv_17 = _res_vals[r];
26110                 LDKMonitorUpdateId _res_conv_17_conv;
26111                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
26112                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
26113                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
26114                 _res_constr.data[r] = _res_conv_17_conv;
26115         }
26116         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26117         CVec_MonitorUpdateIdZ_free(_res_constr);
26118 }
26119
26120 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
26121         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26122         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
26123         return tag_ptr(ret_conv, true);
26124 }
26125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26126         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
26127         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
26128         return ret_conv;
26129 }
26130
26131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26132         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
26133         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26134         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
26135         return tag_ptr(ret_conv, true);
26136 }
26137
26138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
26139         LDKOutPoint a_conv;
26140         a_conv.inner = untag_ptr(a);
26141         a_conv.is_owned = ptr_is_owned(a);
26142         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26143         a_conv = OutPoint_clone(&a_conv);
26144         LDKCVec_MonitorUpdateIdZ b_constr;
26145         b_constr.datalen = (*env)->GetArrayLength(env, b);
26146         if (b_constr.datalen > 0)
26147                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
26148         else
26149                 b_constr.data = NULL;
26150         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
26151         for (size_t r = 0; r < b_constr.datalen; r++) {
26152                 int64_t b_conv_17 = b_vals[r];
26153                 LDKMonitorUpdateId b_conv_17_conv;
26154                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
26155                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
26156                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
26157                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
26158                 b_constr.data[r] = b_conv_17_conv;
26159         }
26160         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
26161         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26162         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
26163         return tag_ptr(ret_conv, true);
26164 }
26165
26166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26167         if (!ptr_is_owned(_res)) return;
26168         void* _res_ptr = untag_ptr(_res);
26169         CHECK_ACCESS(_res_ptr);
26170         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
26171         FREE(untag_ptr(_res));
26172         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
26173 }
26174
26175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26176         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
26177         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26178         if (_res_constr.datalen > 0)
26179                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
26180         else
26181                 _res_constr.data = NULL;
26182         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26183         for (size_t p = 0; p < _res_constr.datalen; p++) {
26184                 int64_t _res_conv_41 = _res_vals[p];
26185                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
26186                 CHECK_ACCESS(_res_conv_41_ptr);
26187                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
26188                 FREE(untag_ptr(_res_conv_41));
26189                 _res_constr.data[p] = _res_conv_41_conv;
26190         }
26191         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26192         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
26193 }
26194
26195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26196         if (!ptr_is_owned(this_ptr)) return;
26197         void* this_ptr_ptr = untag_ptr(this_ptr);
26198         CHECK_ACCESS(this_ptr_ptr);
26199         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
26200         FREE(untag_ptr(this_ptr));
26201         PaymentPurpose_free(this_ptr_conv);
26202 }
26203
26204 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
26205         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
26206         *ret_copy = PaymentPurpose_clone(arg);
26207         int64_t ret_ref = tag_ptr(ret_copy, true);
26208         return ret_ref;
26209 }
26210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26211         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
26212         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
26213         return ret_conv;
26214 }
26215
26216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26217         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
26218         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
26219         *ret_copy = PaymentPurpose_clone(orig_conv);
26220         int64_t ret_ref = tag_ptr(ret_copy, true);
26221         return ret_ref;
26222 }
26223
26224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
26225         LDKThirtyTwoBytes payment_preimage_ref;
26226         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
26227         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
26228         LDKThirtyTwoBytes payment_secret_ref;
26229         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
26230         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
26231         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
26232         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
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_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
26238         LDKThirtyTwoBytes a_ref;
26239         CHECK((*env)->GetArrayLength(env, a) == 32);
26240         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26241         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
26242         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
26243         int64_t ret_ref = tag_ptr(ret_copy, true);
26244         return ret_ref;
26245 }
26246
26247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26248         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
26249         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
26250         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
26251         return ret_conv;
26252 }
26253
26254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
26255         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
26256         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
26257         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26258         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26259         CVec_u8Z_free(ret_var);
26260         return ret_arr;
26261 }
26262
26263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26264         LDKu8slice ser_ref;
26265         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26266         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26267         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
26268         *ret_conv = PaymentPurpose_read(ser_ref);
26269         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26270         return tag_ptr(ret_conv, true);
26271 }
26272
26273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26274         if (!ptr_is_owned(this_ptr)) return;
26275         void* this_ptr_ptr = untag_ptr(this_ptr);
26276         CHECK_ACCESS(this_ptr_ptr);
26277         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
26278         FREE(untag_ptr(this_ptr));
26279         PathFailure_free(this_ptr_conv);
26280 }
26281
26282 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
26283         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
26284         *ret_copy = PathFailure_clone(arg);
26285         int64_t ret_ref = tag_ptr(ret_copy, true);
26286         return ret_ref;
26287 }
26288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26289         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
26290         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
26291         return ret_conv;
26292 }
26293
26294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26295         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
26296         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
26297         *ret_copy = PathFailure_clone(orig_conv);
26298         int64_t ret_ref = tag_ptr(ret_copy, true);
26299         return ret_ref;
26300 }
26301
26302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
26303         void* err_ptr = untag_ptr(err);
26304         CHECK_ACCESS(err_ptr);
26305         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
26306         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
26307         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
26308         *ret_copy = PathFailure_initial_send(err_conv);
26309         int64_t ret_ref = tag_ptr(ret_copy, true);
26310         return ret_ref;
26311 }
26312
26313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
26314         void* network_update_ptr = untag_ptr(network_update);
26315         CHECK_ACCESS(network_update_ptr);
26316         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
26317         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
26318         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
26319         *ret_copy = PathFailure_on_path(network_update_conv);
26320         int64_t ret_ref = tag_ptr(ret_copy, true);
26321         return ret_ref;
26322 }
26323
26324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26325         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
26326         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
26327         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
26328         return ret_conv;
26329 }
26330
26331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
26332         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
26333         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
26334         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26335         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26336         CVec_u8Z_free(ret_var);
26337         return ret_arr;
26338 }
26339
26340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26341         LDKu8slice ser_ref;
26342         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26343         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26344         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
26345         *ret_conv = PathFailure_read(ser_ref);
26346         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26347         return tag_ptr(ret_conv, true);
26348 }
26349
26350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26351         if (!ptr_is_owned(this_ptr)) return;
26352         void* this_ptr_ptr = untag_ptr(this_ptr);
26353         CHECK_ACCESS(this_ptr_ptr);
26354         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
26355         FREE(untag_ptr(this_ptr));
26356         ClosureReason_free(this_ptr_conv);
26357 }
26358
26359 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
26360         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26361         *ret_copy = ClosureReason_clone(arg);
26362         int64_t ret_ref = tag_ptr(ret_copy, true);
26363         return ret_ref;
26364 }
26365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26366         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
26367         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
26368         return ret_conv;
26369 }
26370
26371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26372         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
26373         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26374         *ret_copy = ClosureReason_clone(orig_conv);
26375         int64_t ret_ref = tag_ptr(ret_copy, true);
26376         return ret_ref;
26377 }
26378
26379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
26380         LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
26381         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26382         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
26383         int64_t ret_ref = tag_ptr(ret_copy, true);
26384         return ret_ref;
26385 }
26386
26387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
26388         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26389         *ret_copy = ClosureReason_holder_force_closed();
26390         int64_t ret_ref = tag_ptr(ret_copy, true);
26391         return ret_ref;
26392 }
26393
26394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
26395         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26396         *ret_copy = ClosureReason_cooperative_closure();
26397         int64_t ret_ref = tag_ptr(ret_copy, true);
26398         return ret_ref;
26399 }
26400
26401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
26402         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26403         *ret_copy = ClosureReason_commitment_tx_confirmed();
26404         int64_t ret_ref = tag_ptr(ret_copy, true);
26405         return ret_ref;
26406 }
26407
26408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
26409         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26410         *ret_copy = ClosureReason_funding_timed_out();
26411         int64_t ret_ref = tag_ptr(ret_copy, true);
26412         return ret_ref;
26413 }
26414
26415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
26416         LDKStr err_conv = java_to_owned_str(env, err);
26417         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26418         *ret_copy = ClosureReason_processing_error(err_conv);
26419         int64_t ret_ref = tag_ptr(ret_copy, true);
26420         return ret_ref;
26421 }
26422
26423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
26424         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26425         *ret_copy = ClosureReason_disconnected_peer();
26426         int64_t ret_ref = tag_ptr(ret_copy, true);
26427         return ret_ref;
26428 }
26429
26430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
26431         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
26432         *ret_copy = ClosureReason_outdated_channel_manager();
26433         int64_t ret_ref = tag_ptr(ret_copy, true);
26434         return ret_ref;
26435 }
26436
26437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26438         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
26439         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
26440         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
26441         return ret_conv;
26442 }
26443
26444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
26445         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
26446         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
26447         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26448         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26449         CVec_u8Z_free(ret_var);
26450         return ret_arr;
26451 }
26452
26453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26454         LDKu8slice ser_ref;
26455         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26456         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26457         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
26458         *ret_conv = ClosureReason_read(ser_ref);
26459         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26460         return tag_ptr(ret_conv, true);
26461 }
26462
26463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26464         if (!ptr_is_owned(this_ptr)) return;
26465         void* this_ptr_ptr = untag_ptr(this_ptr);
26466         CHECK_ACCESS(this_ptr_ptr);
26467         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
26468         FREE(untag_ptr(this_ptr));
26469         HTLCDestination_free(this_ptr_conv);
26470 }
26471
26472 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
26473         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
26474         *ret_copy = HTLCDestination_clone(arg);
26475         int64_t ret_ref = tag_ptr(ret_copy, true);
26476         return ret_ref;
26477 }
26478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26479         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
26480         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
26481         return ret_conv;
26482 }
26483
26484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26485         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
26486         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
26487         *ret_copy = HTLCDestination_clone(orig_conv);
26488         int64_t ret_ref = tag_ptr(ret_copy, true);
26489         return ret_ref;
26490 }
26491
26492 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) {
26493         LDKPublicKey node_id_ref;
26494         CHECK((*env)->GetArrayLength(env, node_id) == 33);
26495         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
26496         LDKThirtyTwoBytes channel_id_ref;
26497         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
26498         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
26499         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
26500         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
26501         int64_t ret_ref = tag_ptr(ret_copy, true);
26502         return ret_ref;
26503 }
26504
26505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
26506         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
26507         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
26508         int64_t ret_ref = tag_ptr(ret_copy, true);
26509         return ret_ref;
26510 }
26511
26512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
26513         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
26514         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
26515         int64_t ret_ref = tag_ptr(ret_copy, true);
26516         return ret_ref;
26517 }
26518
26519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
26520         LDKThirtyTwoBytes payment_hash_ref;
26521         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26522         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26523         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
26524         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
26525         int64_t ret_ref = tag_ptr(ret_copy, true);
26526         return ret_ref;
26527 }
26528
26529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26530         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
26531         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
26532         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
26533         return ret_conv;
26534 }
26535
26536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
26537         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
26538         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
26539         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26540         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26541         CVec_u8Z_free(ret_var);
26542         return ret_arr;
26543 }
26544
26545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26546         LDKu8slice ser_ref;
26547         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26548         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26549         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
26550         *ret_conv = HTLCDestination_read(ser_ref);
26551         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26552         return tag_ptr(ret_conv, true);
26553 }
26554
26555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26556         if (!ptr_is_owned(this_ptr)) return;
26557         void* this_ptr_ptr = untag_ptr(this_ptr);
26558         CHECK_ACCESS(this_ptr_ptr);
26559         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
26560         FREE(untag_ptr(this_ptr));
26561         Event_free(this_ptr_conv);
26562 }
26563
26564 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
26565         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26566         *ret_copy = Event_clone(arg);
26567         int64_t ret_ref = tag_ptr(ret_copy, true);
26568         return ret_ref;
26569 }
26570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26571         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
26572         int64_t ret_conv = Event_clone_ptr(arg_conv);
26573         return ret_conv;
26574 }
26575
26576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26577         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
26578         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26579         *ret_copy = Event_clone(orig_conv);
26580         int64_t ret_ref = tag_ptr(ret_copy, true);
26581         return ret_ref;
26582 }
26583
26584 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) {
26585         LDKThirtyTwoBytes temporary_channel_id_ref;
26586         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
26587         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
26588         LDKPublicKey counterparty_node_id_ref;
26589         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
26590         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
26591         LDKCVec_u8Z output_script_ref;
26592         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
26593         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
26594         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
26595         LDKU128 user_channel_id_ref;
26596         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
26597         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
26598         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26599         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
26600         int64_t ret_ref = tag_ptr(ret_copy, true);
26601         return ret_ref;
26602 }
26603
26604 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 amount_msat, int64_t purpose, int8_tArray via_channel_id, int64_t via_user_channel_id) {
26605         LDKPublicKey receiver_node_id_ref;
26606         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
26607         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
26608         LDKThirtyTwoBytes payment_hash_ref;
26609         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26610         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26611         void* purpose_ptr = untag_ptr(purpose);
26612         CHECK_ACCESS(purpose_ptr);
26613         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
26614         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
26615         LDKThirtyTwoBytes via_channel_id_ref;
26616         CHECK((*env)->GetArrayLength(env, via_channel_id) == 32);
26617         (*env)->GetByteArrayRegion(env, via_channel_id, 0, 32, via_channel_id_ref.data);
26618         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
26619         CHECK_ACCESS(via_user_channel_id_ptr);
26620         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
26621         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
26622         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26623         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_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_Event_1payment_1claimed(JNIEnv *env, jclass clz, int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose) {
26629         LDKPublicKey receiver_node_id_ref;
26630         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
26631         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
26632         LDKThirtyTwoBytes payment_hash_ref;
26633         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26634         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26635         void* purpose_ptr = untag_ptr(purpose);
26636         CHECK_ACCESS(purpose_ptr);
26637         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
26638         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
26639         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26640         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
26641         int64_t ret_ref = tag_ptr(ret_copy, true);
26642         return ret_ref;
26643 }
26644
26645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
26646         LDKThirtyTwoBytes payment_id_ref;
26647         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
26648         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
26649         LDKThirtyTwoBytes payment_preimage_ref;
26650         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
26651         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
26652         LDKThirtyTwoBytes payment_hash_ref;
26653         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26654         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26655         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
26656         CHECK_ACCESS(fee_paid_msat_ptr);
26657         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
26658         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
26659         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26660         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
26661         int64_t ret_ref = tag_ptr(ret_copy, true);
26662         return ret_ref;
26663 }
26664
26665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
26666         LDKThirtyTwoBytes payment_id_ref;
26667         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
26668         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
26669         LDKThirtyTwoBytes payment_hash_ref;
26670         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26671         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26672         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26673         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
26674         int64_t ret_ref = tag_ptr(ret_copy, true);
26675         return ret_ref;
26676 }
26677
26678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) {
26679         LDKThirtyTwoBytes payment_id_ref;
26680         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
26681         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
26682         LDKThirtyTwoBytes payment_hash_ref;
26683         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26684         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26685         LDKCVec_RouteHopZ path_constr;
26686         path_constr.datalen = (*env)->GetArrayLength(env, path);
26687         if (path_constr.datalen > 0)
26688                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26689         else
26690                 path_constr.data = NULL;
26691         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
26692         for (size_t k = 0; k < path_constr.datalen; k++) {
26693                 int64_t path_conv_10 = path_vals[k];
26694                 LDKRouteHop path_conv_10_conv;
26695                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
26696                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
26697                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
26698                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
26699                 path_constr.data[k] = path_conv_10_conv;
26700         }
26701         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
26702         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26703         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
26704         int64_t ret_ref = tag_ptr(ret_copy, true);
26705         return ret_ref;
26706 }
26707
26708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_tArray path, int64_t short_channel_id, int64_t retry) {
26709         LDKThirtyTwoBytes payment_id_ref;
26710         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
26711         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
26712         LDKThirtyTwoBytes payment_hash_ref;
26713         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26714         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26715         void* failure_ptr = untag_ptr(failure);
26716         CHECK_ACCESS(failure_ptr);
26717         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
26718         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
26719         LDKCVec_RouteHopZ path_constr;
26720         path_constr.datalen = (*env)->GetArrayLength(env, path);
26721         if (path_constr.datalen > 0)
26722                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26723         else
26724                 path_constr.data = NULL;
26725         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
26726         for (size_t k = 0; k < path_constr.datalen; k++) {
26727                 int64_t path_conv_10 = path_vals[k];
26728                 LDKRouteHop path_conv_10_conv;
26729                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
26730                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
26731                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
26732                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
26733                 path_constr.data[k] = path_conv_10_conv;
26734         }
26735         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
26736         void* short_channel_id_ptr = untag_ptr(short_channel_id);
26737         CHECK_ACCESS(short_channel_id_ptr);
26738         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
26739         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
26740         LDKRouteParameters retry_conv;
26741         retry_conv.inner = untag_ptr(retry);
26742         retry_conv.is_owned = ptr_is_owned(retry);
26743         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
26744         retry_conv = RouteParameters_clone(&retry_conv);
26745         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26746         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_constr, short_channel_id_conv, retry_conv);
26747         int64_t ret_ref = tag_ptr(ret_copy, true);
26748         return ret_ref;
26749 }
26750
26751 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_tArray path) {
26752         LDKThirtyTwoBytes payment_id_ref;
26753         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
26754         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
26755         LDKThirtyTwoBytes payment_hash_ref;
26756         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26757         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26758         LDKCVec_RouteHopZ path_constr;
26759         path_constr.datalen = (*env)->GetArrayLength(env, path);
26760         if (path_constr.datalen > 0)
26761                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26762         else
26763                 path_constr.data = NULL;
26764         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
26765         for (size_t k = 0; k < path_constr.datalen; k++) {
26766                 int64_t path_conv_10 = path_vals[k];
26767                 LDKRouteHop path_conv_10_conv;
26768                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
26769                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
26770                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
26771                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
26772                 path_constr.data[k] = path_conv_10_conv;
26773         }
26774         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
26775         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26776         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
26777         int64_t ret_ref = tag_ptr(ret_copy, true);
26778         return ret_ref;
26779 }
26780
26781 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_tArray path, int64_t short_channel_id) {
26782         LDKThirtyTwoBytes payment_id_ref;
26783         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
26784         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
26785         LDKThirtyTwoBytes payment_hash_ref;
26786         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26787         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26788         LDKCVec_RouteHopZ path_constr;
26789         path_constr.datalen = (*env)->GetArrayLength(env, path);
26790         if (path_constr.datalen > 0)
26791                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26792         else
26793                 path_constr.data = NULL;
26794         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
26795         for (size_t k = 0; k < path_constr.datalen; k++) {
26796                 int64_t path_conv_10 = path_vals[k];
26797                 LDKRouteHop path_conv_10_conv;
26798                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
26799                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
26800                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
26801                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
26802                 path_constr.data[k] = path_conv_10_conv;
26803         }
26804         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
26805         void* short_channel_id_ptr = untag_ptr(short_channel_id);
26806         CHECK_ACCESS(short_channel_id_ptr);
26807         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
26808         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
26809         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26810         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
26811         int64_t ret_ref = tag_ptr(ret_copy, true);
26812         return ret_ref;
26813 }
26814
26815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
26816         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26817         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
26818         int64_t ret_ref = tag_ptr(ret_copy, true);
26819         return ret_ref;
26820 }
26821
26822 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) {
26823         LDKThirtyTwoBytes intercept_id_ref;
26824         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
26825         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
26826         LDKThirtyTwoBytes payment_hash_ref;
26827         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
26828         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
26829         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26830         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
26831         int64_t ret_ref = tag_ptr(ret_copy, true);
26832         return ret_ref;
26833 }
26834
26835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
26836         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
26837         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
26838         if (outputs_constr.datalen > 0)
26839                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
26840         else
26841                 outputs_constr.data = NULL;
26842         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
26843         for (size_t b = 0; b < outputs_constr.datalen; b++) {
26844                 int64_t outputs_conv_27 = outputs_vals[b];
26845                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
26846                 CHECK_ACCESS(outputs_conv_27_ptr);
26847                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
26848                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
26849                 outputs_constr.data[b] = outputs_conv_27_conv;
26850         }
26851         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
26852         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26853         *ret_copy = Event_spendable_outputs(outputs_constr);
26854         int64_t ret_ref = tag_ptr(ret_copy, true);
26855         return ret_ref;
26856 }
26857
26858 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) {
26859         LDKThirtyTwoBytes prev_channel_id_ref;
26860         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
26861         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
26862         LDKThirtyTwoBytes next_channel_id_ref;
26863         CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
26864         (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
26865         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
26866         CHECK_ACCESS(fee_earned_msat_ptr);
26867         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
26868         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
26869         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26870         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
26871         int64_t ret_ref = tag_ptr(ret_copy, true);
26872         return ret_ref;
26873 }
26874
26875 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) {
26876         LDKThirtyTwoBytes channel_id_ref;
26877         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
26878         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
26879         LDKU128 user_channel_id_ref;
26880         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
26881         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
26882         LDKPublicKey counterparty_node_id_ref;
26883         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
26884         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
26885         LDKChannelTypeFeatures channel_type_conv;
26886         channel_type_conv.inner = untag_ptr(channel_type);
26887         channel_type_conv.is_owned = ptr_is_owned(channel_type);
26888         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
26889         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
26890         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26891         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
26892         int64_t ret_ref = tag_ptr(ret_copy, true);
26893         return ret_ref;
26894 }
26895
26896 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) {
26897         LDKThirtyTwoBytes channel_id_ref;
26898         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
26899         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
26900         LDKU128 user_channel_id_ref;
26901         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
26902         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
26903         void* reason_ptr = untag_ptr(reason);
26904         CHECK_ACCESS(reason_ptr);
26905         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
26906         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
26907         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26908         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
26909         int64_t ret_ref = tag_ptr(ret_copy, true);
26910         return ret_ref;
26911 }
26912
26913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
26914         LDKThirtyTwoBytes channel_id_ref;
26915         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
26916         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
26917         LDKTransaction transaction_ref;
26918         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
26919         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
26920         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
26921         transaction_ref.data_is_owned = true;
26922         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26923         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
26924         int64_t ret_ref = tag_ptr(ret_copy, true);
26925         return ret_ref;
26926 }
26927
26928 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) {
26929         LDKThirtyTwoBytes temporary_channel_id_ref;
26930         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
26931         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
26932         LDKPublicKey counterparty_node_id_ref;
26933         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
26934         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
26935         LDKChannelTypeFeatures channel_type_conv;
26936         channel_type_conv.inner = untag_ptr(channel_type);
26937         channel_type_conv.is_owned = ptr_is_owned(channel_type);
26938         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
26939         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
26940         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26941         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
26942         int64_t ret_ref = tag_ptr(ret_copy, true);
26943         return ret_ref;
26944 }
26945
26946 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) {
26947         LDKThirtyTwoBytes prev_channel_id_ref;
26948         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
26949         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
26950         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
26951         CHECK_ACCESS(failed_next_destination_ptr);
26952         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
26953         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
26954         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26955         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
26956         int64_t ret_ref = tag_ptr(ret_copy, true);
26957         return ret_ref;
26958 }
26959
26960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26961         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
26962         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
26963         jboolean ret_conv = Event_eq(a_conv, b_conv);
26964         return ret_conv;
26965 }
26966
26967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
26968         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
26969         LDKCVec_u8Z ret_var = Event_write(obj_conv);
26970         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26971         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26972         CVec_u8Z_free(ret_var);
26973         return ret_arr;
26974 }
26975
26976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26977         LDKu8slice ser_ref;
26978         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26979         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26980         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
26981         *ret_conv = Event_read(ser_ref);
26982         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26983         return tag_ptr(ret_conv, true);
26984 }
26985
26986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26987         if (!ptr_is_owned(this_ptr)) return;
26988         void* this_ptr_ptr = untag_ptr(this_ptr);
26989         CHECK_ACCESS(this_ptr_ptr);
26990         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
26991         FREE(untag_ptr(this_ptr));
26992         MessageSendEvent_free(this_ptr_conv);
26993 }
26994
26995 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
26996         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
26997         *ret_copy = MessageSendEvent_clone(arg);
26998         int64_t ret_ref = tag_ptr(ret_copy, true);
26999         return ret_ref;
27000 }
27001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27002         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
27003         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
27004         return ret_conv;
27005 }
27006
27007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27008         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
27009         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27010         *ret_copy = MessageSendEvent_clone(orig_conv);
27011         int64_t ret_ref = tag_ptr(ret_copy, true);
27012         return ret_ref;
27013 }
27014
27015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27016         LDKPublicKey node_id_ref;
27017         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27018         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27019         LDKAcceptChannel msg_conv;
27020         msg_conv.inner = untag_ptr(msg);
27021         msg_conv.is_owned = ptr_is_owned(msg);
27022         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27023         msg_conv = AcceptChannel_clone(&msg_conv);
27024         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27025         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
27026         int64_t ret_ref = tag_ptr(ret_copy, true);
27027         return ret_ref;
27028 }
27029
27030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27031         LDKPublicKey node_id_ref;
27032         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27033         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27034         LDKOpenChannel msg_conv;
27035         msg_conv.inner = untag_ptr(msg);
27036         msg_conv.is_owned = ptr_is_owned(msg);
27037         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27038         msg_conv = OpenChannel_clone(&msg_conv);
27039         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27040         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
27041         int64_t ret_ref = tag_ptr(ret_copy, true);
27042         return ret_ref;
27043 }
27044
27045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27046         LDKPublicKey node_id_ref;
27047         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27048         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27049         LDKFundingCreated msg_conv;
27050         msg_conv.inner = untag_ptr(msg);
27051         msg_conv.is_owned = ptr_is_owned(msg);
27052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27053         msg_conv = FundingCreated_clone(&msg_conv);
27054         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27055         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
27056         int64_t ret_ref = tag_ptr(ret_copy, true);
27057         return ret_ref;
27058 }
27059
27060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27061         LDKPublicKey node_id_ref;
27062         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27063         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27064         LDKFundingSigned msg_conv;
27065         msg_conv.inner = untag_ptr(msg);
27066         msg_conv.is_owned = ptr_is_owned(msg);
27067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27068         msg_conv = FundingSigned_clone(&msg_conv);
27069         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27070         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
27071         int64_t ret_ref = tag_ptr(ret_copy, true);
27072         return ret_ref;
27073 }
27074
27075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27076         LDKPublicKey node_id_ref;
27077         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27078         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27079         LDKChannelReady msg_conv;
27080         msg_conv.inner = untag_ptr(msg);
27081         msg_conv.is_owned = ptr_is_owned(msg);
27082         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27083         msg_conv = ChannelReady_clone(&msg_conv);
27084         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27085         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
27086         int64_t ret_ref = tag_ptr(ret_copy, true);
27087         return ret_ref;
27088 }
27089
27090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27091         LDKPublicKey node_id_ref;
27092         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27093         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27094         LDKAnnouncementSignatures msg_conv;
27095         msg_conv.inner = untag_ptr(msg);
27096         msg_conv.is_owned = ptr_is_owned(msg);
27097         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27098         msg_conv = AnnouncementSignatures_clone(&msg_conv);
27099         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27100         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
27101         int64_t ret_ref = tag_ptr(ret_copy, true);
27102         return ret_ref;
27103 }
27104
27105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
27106         LDKPublicKey node_id_ref;
27107         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27108         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27109         LDKCommitmentUpdate updates_conv;
27110         updates_conv.inner = untag_ptr(updates);
27111         updates_conv.is_owned = ptr_is_owned(updates);
27112         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
27113         updates_conv = CommitmentUpdate_clone(&updates_conv);
27114         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27115         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
27116         int64_t ret_ref = tag_ptr(ret_copy, true);
27117         return ret_ref;
27118 }
27119
27120 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) {
27121         LDKPublicKey node_id_ref;
27122         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27123         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27124         LDKRevokeAndACK msg_conv;
27125         msg_conv.inner = untag_ptr(msg);
27126         msg_conv.is_owned = ptr_is_owned(msg);
27127         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27128         msg_conv = RevokeAndACK_clone(&msg_conv);
27129         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27130         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
27131         int64_t ret_ref = tag_ptr(ret_copy, true);
27132         return ret_ref;
27133 }
27134
27135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27136         LDKPublicKey node_id_ref;
27137         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27138         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27139         LDKClosingSigned msg_conv;
27140         msg_conv.inner = untag_ptr(msg);
27141         msg_conv.is_owned = ptr_is_owned(msg);
27142         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27143         msg_conv = ClosingSigned_clone(&msg_conv);
27144         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27145         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
27146         int64_t ret_ref = tag_ptr(ret_copy, true);
27147         return ret_ref;
27148 }
27149
27150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27151         LDKPublicKey node_id_ref;
27152         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27153         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27154         LDKShutdown msg_conv;
27155         msg_conv.inner = untag_ptr(msg);
27156         msg_conv.is_owned = ptr_is_owned(msg);
27157         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27158         msg_conv = Shutdown_clone(&msg_conv);
27159         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27160         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
27161         int64_t ret_ref = tag_ptr(ret_copy, true);
27162         return ret_ref;
27163 }
27164
27165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27166         LDKPublicKey node_id_ref;
27167         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27168         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27169         LDKChannelReestablish msg_conv;
27170         msg_conv.inner = untag_ptr(msg);
27171         msg_conv.is_owned = ptr_is_owned(msg);
27172         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27173         msg_conv = ChannelReestablish_clone(&msg_conv);
27174         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27175         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
27176         int64_t ret_ref = tag_ptr(ret_copy, true);
27177         return ret_ref;
27178 }
27179
27180 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) {
27181         LDKPublicKey node_id_ref;
27182         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27183         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27184         LDKChannelAnnouncement msg_conv;
27185         msg_conv.inner = untag_ptr(msg);
27186         msg_conv.is_owned = ptr_is_owned(msg);
27187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27188         msg_conv = ChannelAnnouncement_clone(&msg_conv);
27189         LDKChannelUpdate update_msg_conv;
27190         update_msg_conv.inner = untag_ptr(update_msg);
27191         update_msg_conv.is_owned = ptr_is_owned(update_msg);
27192         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
27193         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
27194         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27195         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
27196         int64_t ret_ref = tag_ptr(ret_copy, true);
27197         return ret_ref;
27198 }
27199
27200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
27201         LDKChannelAnnouncement msg_conv;
27202         msg_conv.inner = untag_ptr(msg);
27203         msg_conv.is_owned = ptr_is_owned(msg);
27204         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27205         msg_conv = ChannelAnnouncement_clone(&msg_conv);
27206         LDKChannelUpdate update_msg_conv;
27207         update_msg_conv.inner = untag_ptr(update_msg);
27208         update_msg_conv.is_owned = ptr_is_owned(update_msg);
27209         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
27210         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
27211         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27212         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
27213         int64_t ret_ref = tag_ptr(ret_copy, true);
27214         return ret_ref;
27215 }
27216
27217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
27218         LDKChannelUpdate msg_conv;
27219         msg_conv.inner = untag_ptr(msg);
27220         msg_conv.is_owned = ptr_is_owned(msg);
27221         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27222         msg_conv = ChannelUpdate_clone(&msg_conv);
27223         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27224         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
27225         int64_t ret_ref = tag_ptr(ret_copy, true);
27226         return ret_ref;
27227 }
27228
27229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
27230         LDKNodeAnnouncement msg_conv;
27231         msg_conv.inner = untag_ptr(msg);
27232         msg_conv.is_owned = ptr_is_owned(msg);
27233         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27234         msg_conv = NodeAnnouncement_clone(&msg_conv);
27235         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27236         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
27237         int64_t ret_ref = tag_ptr(ret_copy, true);
27238         return ret_ref;
27239 }
27240
27241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
27242         LDKPublicKey node_id_ref;
27243         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27244         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27245         LDKChannelUpdate msg_conv;
27246         msg_conv.inner = untag_ptr(msg);
27247         msg_conv.is_owned = ptr_is_owned(msg);
27248         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27249         msg_conv = ChannelUpdate_clone(&msg_conv);
27250         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27251         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
27252         int64_t ret_ref = tag_ptr(ret_copy, true);
27253         return ret_ref;
27254 }
27255
27256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
27257         LDKPublicKey node_id_ref;
27258         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27259         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27260         void* action_ptr = untag_ptr(action);
27261         CHECK_ACCESS(action_ptr);
27262         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
27263         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
27264         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27265         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
27266         int64_t ret_ref = tag_ptr(ret_copy, true);
27267         return ret_ref;
27268 }
27269
27270 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) {
27271         LDKPublicKey node_id_ref;
27272         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27273         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27274         LDKQueryChannelRange msg_conv;
27275         msg_conv.inner = untag_ptr(msg);
27276         msg_conv.is_owned = ptr_is_owned(msg);
27277         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27278         msg_conv = QueryChannelRange_clone(&msg_conv);
27279         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27280         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
27281         int64_t ret_ref = tag_ptr(ret_copy, true);
27282         return ret_ref;
27283 }
27284
27285 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) {
27286         LDKPublicKey node_id_ref;
27287         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27288         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27289         LDKQueryShortChannelIds msg_conv;
27290         msg_conv.inner = untag_ptr(msg);
27291         msg_conv.is_owned = ptr_is_owned(msg);
27292         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27293         msg_conv = QueryShortChannelIds_clone(&msg_conv);
27294         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27295         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
27296         int64_t ret_ref = tag_ptr(ret_copy, true);
27297         return ret_ref;
27298 }
27299
27300 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) {
27301         LDKPublicKey node_id_ref;
27302         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27303         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27304         LDKReplyChannelRange msg_conv;
27305         msg_conv.inner = untag_ptr(msg);
27306         msg_conv.is_owned = ptr_is_owned(msg);
27307         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27308         msg_conv = ReplyChannelRange_clone(&msg_conv);
27309         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27310         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
27311         int64_t ret_ref = tag_ptr(ret_copy, true);
27312         return ret_ref;
27313 }
27314
27315 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) {
27316         LDKPublicKey node_id_ref;
27317         CHECK((*env)->GetArrayLength(env, node_id) == 33);
27318         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27319         LDKGossipTimestampFilter msg_conv;
27320         msg_conv.inner = untag_ptr(msg);
27321         msg_conv.is_owned = ptr_is_owned(msg);
27322         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
27323         msg_conv = GossipTimestampFilter_clone(&msg_conv);
27324         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
27325         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
27326         int64_t ret_ref = tag_ptr(ret_copy, true);
27327         return ret_ref;
27328 }
27329
27330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27331         if (!ptr_is_owned(this_ptr)) return;
27332         void* this_ptr_ptr = untag_ptr(this_ptr);
27333         CHECK_ACCESS(this_ptr_ptr);
27334         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
27335         FREE(untag_ptr(this_ptr));
27336         MessageSendEventsProvider_free(this_ptr_conv);
27337 }
27338
27339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27340         if (!ptr_is_owned(this_ptr)) return;
27341         void* this_ptr_ptr = untag_ptr(this_ptr);
27342         CHECK_ACCESS(this_ptr_ptr);
27343         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
27344         FREE(untag_ptr(this_ptr));
27345         OnionMessageProvider_free(this_ptr_conv);
27346 }
27347
27348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27349         if (!ptr_is_owned(this_ptr)) return;
27350         void* this_ptr_ptr = untag_ptr(this_ptr);
27351         CHECK_ACCESS(this_ptr_ptr);
27352         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
27353         FREE(untag_ptr(this_ptr));
27354         EventsProvider_free(this_ptr_conv);
27355 }
27356
27357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27358         if (!ptr_is_owned(this_ptr)) return;
27359         void* this_ptr_ptr = untag_ptr(this_ptr);
27360         CHECK_ACCESS(this_ptr_ptr);
27361         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
27362         FREE(untag_ptr(this_ptr));
27363         EventHandler_free(this_ptr_conv);
27364 }
27365
27366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27367         if (!ptr_is_owned(this_ptr)) return;
27368         void* this_ptr_ptr = untag_ptr(this_ptr);
27369         CHECK_ACCESS(this_ptr_ptr);
27370         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
27371         FREE(untag_ptr(this_ptr));
27372         APIError_free(this_ptr_conv);
27373 }
27374
27375 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
27376         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27377         *ret_copy = APIError_clone(arg);
27378         int64_t ret_ref = tag_ptr(ret_copy, true);
27379         return ret_ref;
27380 }
27381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27382         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
27383         int64_t ret_conv = APIError_clone_ptr(arg_conv);
27384         return ret_conv;
27385 }
27386
27387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27388         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
27389         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27390         *ret_copy = APIError_clone(orig_conv);
27391         int64_t ret_ref = tag_ptr(ret_copy, true);
27392         return ret_ref;
27393 }
27394
27395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
27396         LDKStr err_conv = java_to_owned_str(env, err);
27397         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27398         *ret_copy = APIError_apimisuse_error(err_conv);
27399         int64_t ret_ref = tag_ptr(ret_copy, true);
27400         return ret_ref;
27401 }
27402
27403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
27404         LDKStr err_conv = java_to_owned_str(env, err);
27405         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27406         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
27407         int64_t ret_ref = tag_ptr(ret_copy, true);
27408         return ret_ref;
27409 }
27410
27411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
27412         LDKStr err_conv = java_to_owned_str(env, err);
27413         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27414         *ret_copy = APIError_invalid_route(err_conv);
27415         int64_t ret_ref = tag_ptr(ret_copy, true);
27416         return ret_ref;
27417 }
27418
27419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
27420         LDKStr err_conv = java_to_owned_str(env, err);
27421         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27422         *ret_copy = APIError_channel_unavailable(err_conv);
27423         int64_t ret_ref = tag_ptr(ret_copy, true);
27424         return ret_ref;
27425 }
27426
27427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
27428         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27429         *ret_copy = APIError_monitor_update_in_progress();
27430         int64_t ret_ref = tag_ptr(ret_copy, true);
27431         return ret_ref;
27432 }
27433
27434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
27435         LDKShutdownScript script_conv;
27436         script_conv.inner = untag_ptr(script);
27437         script_conv.is_owned = ptr_is_owned(script);
27438         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
27439         script_conv = ShutdownScript_clone(&script_conv);
27440         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27441         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
27442         int64_t ret_ref = tag_ptr(ret_copy, true);
27443         return ret_ref;
27444 }
27445
27446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27447         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
27448         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
27449         jboolean ret_conv = APIError_eq(a_conv, b_conv);
27450         return ret_conv;
27451 }
27452
27453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
27454         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
27455         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
27456         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27457         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27458         CVec_u8Z_free(ret_var);
27459         return ret_arr;
27460 }
27461
27462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27463         LDKu8slice ser_ref;
27464         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27465         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27466         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27467         *ret_conv = APIError_read(ser_ref);
27468         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27469         return tag_ptr(ret_conv, true);
27470 }
27471
27472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27473         LDKBigSize this_obj_conv;
27474         this_obj_conv.inner = untag_ptr(this_obj);
27475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27477         BigSize_free(this_obj_conv);
27478 }
27479
27480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
27481         LDKBigSize this_ptr_conv;
27482         this_ptr_conv.inner = untag_ptr(this_ptr);
27483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27485         this_ptr_conv.is_owned = false;
27486         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
27487         return ret_conv;
27488 }
27489
27490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27491         LDKBigSize this_ptr_conv;
27492         this_ptr_conv.inner = untag_ptr(this_ptr);
27493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27495         this_ptr_conv.is_owned = false;
27496         BigSize_set_a(&this_ptr_conv, val);
27497 }
27498
27499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
27500         LDKBigSize ret_var = BigSize_new(a_arg);
27501         int64_t ret_ref = 0;
27502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27504         return ret_ref;
27505 }
27506
27507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27508         LDKHostname this_obj_conv;
27509         this_obj_conv.inner = untag_ptr(this_obj);
27510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27512         Hostname_free(this_obj_conv);
27513 }
27514
27515 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
27516         LDKHostname ret_var = Hostname_clone(arg);
27517         int64_t ret_ref = 0;
27518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27520         return ret_ref;
27521 }
27522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27523         LDKHostname arg_conv;
27524         arg_conv.inner = untag_ptr(arg);
27525         arg_conv.is_owned = ptr_is_owned(arg);
27526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27527         arg_conv.is_owned = false;
27528         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
27529         return ret_conv;
27530 }
27531
27532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27533         LDKHostname orig_conv;
27534         orig_conv.inner = untag_ptr(orig);
27535         orig_conv.is_owned = ptr_is_owned(orig);
27536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27537         orig_conv.is_owned = false;
27538         LDKHostname ret_var = Hostname_clone(&orig_conv);
27539         int64_t ret_ref = 0;
27540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27542         return ret_ref;
27543 }
27544
27545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27546         LDKHostname a_conv;
27547         a_conv.inner = untag_ptr(a);
27548         a_conv.is_owned = ptr_is_owned(a);
27549         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27550         a_conv.is_owned = false;
27551         LDKHostname b_conv;
27552         b_conv.inner = untag_ptr(b);
27553         b_conv.is_owned = ptr_is_owned(b);
27554         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27555         b_conv.is_owned = false;
27556         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
27557         return ret_conv;
27558 }
27559
27560 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
27561         LDKHostname this_arg_conv;
27562         this_arg_conv.inner = untag_ptr(this_arg);
27563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27565         this_arg_conv.is_owned = false;
27566         int8_t ret_conv = Hostname_len(&this_arg_conv);
27567         return ret_conv;
27568 }
27569
27570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
27571         LDKu8slice msg_ref;
27572         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
27573         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
27574         uint8_t sk_arr[32];
27575         CHECK((*env)->GetArrayLength(env, sk) == 32);
27576         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
27577         uint8_t (*sk_ref)[32] = &sk_arr;
27578         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
27579         *ret_conv = sign(msg_ref, sk_ref);
27580         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
27581         return tag_ptr(ret_conv, true);
27582 }
27583
27584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
27585         LDKu8slice msg_ref;
27586         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
27587         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
27588         LDKStr sig_conv = java_to_owned_str(env, sig);
27589         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
27590         *ret_conv = recover_pk(msg_ref, sig_conv);
27591         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
27592         return tag_ptr(ret_conv, true);
27593 }
27594
27595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
27596         LDKu8slice msg_ref;
27597         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
27598         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
27599         LDKStr sig_conv = java_to_owned_str(env, sig);
27600         LDKPublicKey pk_ref;
27601         CHECK((*env)->GetArrayLength(env, pk) == 33);
27602         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
27603         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
27604         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
27605         return ret_conv;
27606 }
27607
27608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
27609         LDKu8slice hrp_bytes_ref;
27610         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
27611         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
27612         LDKCVec_U5Z data_without_signature_constr;
27613         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
27614         if (data_without_signature_constr.datalen > 0)
27615                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
27616         else
27617                 data_without_signature_constr.data = NULL;
27618         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
27619         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
27620                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
27621                 
27622                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
27623         }
27624         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
27625         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
27626         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27627         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27628         CVec_u8Z_free(ret_var);
27629         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
27630         return ret_arr;
27631 }
27632
27633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27634         if (!ptr_is_owned(this_ptr)) return;
27635         void* this_ptr_ptr = untag_ptr(this_ptr);
27636         CHECK_ACCESS(this_ptr_ptr);
27637         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
27638         FREE(untag_ptr(this_ptr));
27639         Persister_free(this_ptr_conv);
27640 }
27641
27642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27643         LDKPrintableString this_obj_conv;
27644         this_obj_conv.inner = untag_ptr(this_obj);
27645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27647         PrintableString_free(this_obj_conv);
27648 }
27649
27650 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
27651         LDKPrintableString this_ptr_conv;
27652         this_ptr_conv.inner = untag_ptr(this_ptr);
27653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27655         this_ptr_conv.is_owned = false;
27656         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
27657         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27658         Str_free(ret_str);
27659         return ret_conv;
27660 }
27661
27662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
27663         LDKPrintableString this_ptr_conv;
27664         this_ptr_conv.inner = untag_ptr(this_ptr);
27665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27667         this_ptr_conv.is_owned = false;
27668         LDKStr val_conv = java_to_owned_str(env, val);
27669         PrintableString_set_a(&this_ptr_conv, val_conv);
27670 }
27671
27672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
27673         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
27674         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
27675         int64_t ret_ref = 0;
27676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27678         return ret_ref;
27679 }
27680
27681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27682         if (!ptr_is_owned(this_ptr)) return;
27683         void* this_ptr_ptr = untag_ptr(this_ptr);
27684         CHECK_ACCESS(this_ptr_ptr);
27685         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
27686         FREE(untag_ptr(this_ptr));
27687         FutureCallback_free(this_ptr_conv);
27688 }
27689
27690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27691         LDKFuture this_obj_conv;
27692         this_obj_conv.inner = untag_ptr(this_obj);
27693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27695         Future_free(this_obj_conv);
27696 }
27697
27698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
27699         LDKFuture this_arg_conv;
27700         this_arg_conv.inner = untag_ptr(this_arg);
27701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27703         this_arg_conv.is_owned = false;
27704         void* callback_ptr = untag_ptr(callback);
27705         CHECK_ACCESS(callback_ptr);
27706         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
27707         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
27708                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27709                 LDKFutureCallback_JCalls_cloned(&callback_conv);
27710         }
27711         Future_register_callback_fn(&this_arg_conv, callback_conv);
27712 }
27713
27714 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27715         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
27716         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
27717         return ret_conv;
27718 }
27719
27720 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
27721         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
27722         return ret_conv;
27723 }
27724
27725 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
27726         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
27727         return ret_conv;
27728 }
27729
27730 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
27731         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
27732         return ret_conv;
27733 }
27734
27735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
27736         jclass ret_conv = LDKLevel_to_java(env, Level_info());
27737         return ret_conv;
27738 }
27739
27740 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
27741         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
27742         return ret_conv;
27743 }
27744
27745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
27746         jclass ret_conv = LDKLevel_to_java(env, Level_error());
27747         return ret_conv;
27748 }
27749
27750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27751         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
27752         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
27753         jboolean ret_conv = Level_eq(a_conv, b_conv);
27754         return ret_conv;
27755 }
27756
27757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
27758         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
27759         int64_t ret_conv = Level_hash(o_conv);
27760         return ret_conv;
27761 }
27762
27763 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
27764         jclass ret_conv = LDKLevel_to_java(env, Level_max());
27765         return ret_conv;
27766 }
27767
27768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27769         LDKRecord this_obj_conv;
27770         this_obj_conv.inner = untag_ptr(this_obj);
27771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27773         Record_free(this_obj_conv);
27774 }
27775
27776 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
27777         LDKRecord this_ptr_conv;
27778         this_ptr_conv.inner = untag_ptr(this_ptr);
27779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27781         this_ptr_conv.is_owned = false;
27782         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
27783         return ret_conv;
27784 }
27785
27786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
27787         LDKRecord this_ptr_conv;
27788         this_ptr_conv.inner = untag_ptr(this_ptr);
27789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27791         this_ptr_conv.is_owned = false;
27792         LDKLevel val_conv = LDKLevel_from_java(env, val);
27793         Record_set_level(&this_ptr_conv, val_conv);
27794 }
27795
27796 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
27797         LDKRecord this_ptr_conv;
27798         this_ptr_conv.inner = untag_ptr(this_ptr);
27799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27801         this_ptr_conv.is_owned = false;
27802         LDKStr ret_str = Record_get_args(&this_ptr_conv);
27803         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27804         Str_free(ret_str);
27805         return ret_conv;
27806 }
27807
27808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
27809         LDKRecord this_ptr_conv;
27810         this_ptr_conv.inner = untag_ptr(this_ptr);
27811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27813         this_ptr_conv.is_owned = false;
27814         LDKStr val_conv = java_to_owned_str(env, val);
27815         Record_set_args(&this_ptr_conv, val_conv);
27816 }
27817
27818 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
27819         LDKRecord this_ptr_conv;
27820         this_ptr_conv.inner = untag_ptr(this_ptr);
27821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27823         this_ptr_conv.is_owned = false;
27824         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
27825         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27826         Str_free(ret_str);
27827         return ret_conv;
27828 }
27829
27830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
27831         LDKRecord this_ptr_conv;
27832         this_ptr_conv.inner = untag_ptr(this_ptr);
27833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27835         this_ptr_conv.is_owned = false;
27836         LDKStr val_conv = java_to_owned_str(env, val);
27837         Record_set_module_path(&this_ptr_conv, val_conv);
27838 }
27839
27840 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
27841         LDKRecord this_ptr_conv;
27842         this_ptr_conv.inner = untag_ptr(this_ptr);
27843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27845         this_ptr_conv.is_owned = false;
27846         LDKStr ret_str = Record_get_file(&this_ptr_conv);
27847         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27848         Str_free(ret_str);
27849         return ret_conv;
27850 }
27851
27852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
27853         LDKRecord this_ptr_conv;
27854         this_ptr_conv.inner = untag_ptr(this_ptr);
27855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27857         this_ptr_conv.is_owned = false;
27858         LDKStr val_conv = java_to_owned_str(env, val);
27859         Record_set_file(&this_ptr_conv, val_conv);
27860 }
27861
27862 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
27863         LDKRecord this_ptr_conv;
27864         this_ptr_conv.inner = untag_ptr(this_ptr);
27865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27867         this_ptr_conv.is_owned = false;
27868         int32_t ret_conv = Record_get_line(&this_ptr_conv);
27869         return ret_conv;
27870 }
27871
27872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27873         LDKRecord this_ptr_conv;
27874         this_ptr_conv.inner = untag_ptr(this_ptr);
27875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27877         this_ptr_conv.is_owned = false;
27878         Record_set_line(&this_ptr_conv, val);
27879 }
27880
27881 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
27882         LDKRecord ret_var = Record_clone(arg);
27883         int64_t ret_ref = 0;
27884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27886         return ret_ref;
27887 }
27888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27889         LDKRecord arg_conv;
27890         arg_conv.inner = untag_ptr(arg);
27891         arg_conv.is_owned = ptr_is_owned(arg);
27892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27893         arg_conv.is_owned = false;
27894         int64_t ret_conv = Record_clone_ptr(&arg_conv);
27895         return ret_conv;
27896 }
27897
27898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27899         LDKRecord orig_conv;
27900         orig_conv.inner = untag_ptr(orig);
27901         orig_conv.is_owned = ptr_is_owned(orig);
27902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27903         orig_conv.is_owned = false;
27904         LDKRecord ret_var = Record_clone(&orig_conv);
27905         int64_t ret_ref = 0;
27906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27908         return ret_ref;
27909 }
27910
27911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27912         if (!ptr_is_owned(this_ptr)) return;
27913         void* this_ptr_ptr = untag_ptr(this_ptr);
27914         CHECK_ACCESS(this_ptr_ptr);
27915         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
27916         FREE(untag_ptr(this_ptr));
27917         Logger_free(this_ptr_conv);
27918 }
27919
27920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27921         LDKChannelHandshakeConfig this_obj_conv;
27922         this_obj_conv.inner = untag_ptr(this_obj);
27923         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27925         ChannelHandshakeConfig_free(this_obj_conv);
27926 }
27927
27928 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
27929         LDKChannelHandshakeConfig this_ptr_conv;
27930         this_ptr_conv.inner = untag_ptr(this_ptr);
27931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27933         this_ptr_conv.is_owned = false;
27934         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
27935         return ret_conv;
27936 }
27937
27938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27939         LDKChannelHandshakeConfig this_ptr_conv;
27940         this_ptr_conv.inner = untag_ptr(this_ptr);
27941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27943         this_ptr_conv.is_owned = false;
27944         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
27945 }
27946
27947 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27948         LDKChannelHandshakeConfig this_ptr_conv;
27949         this_ptr_conv.inner = untag_ptr(this_ptr);
27950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27952         this_ptr_conv.is_owned = false;
27953         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
27954         return ret_conv;
27955 }
27956
27957 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) {
27958         LDKChannelHandshakeConfig this_ptr_conv;
27959         this_ptr_conv.inner = untag_ptr(this_ptr);
27960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27962         this_ptr_conv.is_owned = false;
27963         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
27964 }
27965
27966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27967         LDKChannelHandshakeConfig this_ptr_conv;
27968         this_ptr_conv.inner = untag_ptr(this_ptr);
27969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27971         this_ptr_conv.is_owned = false;
27972         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
27973         return ret_conv;
27974 }
27975
27976 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) {
27977         LDKChannelHandshakeConfig this_ptr_conv;
27978         this_ptr_conv.inner = untag_ptr(this_ptr);
27979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27981         this_ptr_conv.is_owned = false;
27982         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
27983 }
27984
27985 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) {
27986         LDKChannelHandshakeConfig this_ptr_conv;
27987         this_ptr_conv.inner = untag_ptr(this_ptr);
27988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27990         this_ptr_conv.is_owned = false;
27991         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
27992         return ret_conv;
27993 }
27994
27995 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) {
27996         LDKChannelHandshakeConfig this_ptr_conv;
27997         this_ptr_conv.inner = untag_ptr(this_ptr);
27998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28000         this_ptr_conv.is_owned = false;
28001         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
28002 }
28003
28004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
28005         LDKChannelHandshakeConfig this_ptr_conv;
28006         this_ptr_conv.inner = untag_ptr(this_ptr);
28007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28009         this_ptr_conv.is_owned = false;
28010         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
28011         return ret_conv;
28012 }
28013
28014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28015         LDKChannelHandshakeConfig this_ptr_conv;
28016         this_ptr_conv.inner = untag_ptr(this_ptr);
28017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28019         this_ptr_conv.is_owned = false;
28020         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
28021 }
28022
28023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
28024         LDKChannelHandshakeConfig this_ptr_conv;
28025         this_ptr_conv.inner = untag_ptr(this_ptr);
28026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28028         this_ptr_conv.is_owned = false;
28029         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
28030         return ret_conv;
28031 }
28032
28033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28034         LDKChannelHandshakeConfig this_ptr_conv;
28035         this_ptr_conv.inner = untag_ptr(this_ptr);
28036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28038         this_ptr_conv.is_owned = false;
28039         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
28040 }
28041
28042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28043         LDKChannelHandshakeConfig this_ptr_conv;
28044         this_ptr_conv.inner = untag_ptr(this_ptr);
28045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28047         this_ptr_conv.is_owned = false;
28048         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
28049         return ret_conv;
28050 }
28051
28052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28053         LDKChannelHandshakeConfig this_ptr_conv;
28054         this_ptr_conv.inner = untag_ptr(this_ptr);
28055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28057         this_ptr_conv.is_owned = false;
28058         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
28059 }
28060
28061 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28062         LDKChannelHandshakeConfig this_ptr_conv;
28063         this_ptr_conv.inner = untag_ptr(this_ptr);
28064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28066         this_ptr_conv.is_owned = false;
28067         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
28068         return ret_conv;
28069 }
28070
28071 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) {
28072         LDKChannelHandshakeConfig this_ptr_conv;
28073         this_ptr_conv.inner = untag_ptr(this_ptr);
28074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28076         this_ptr_conv.is_owned = false;
28077         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
28078 }
28079
28080 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) {
28081         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);
28082         int64_t ret_ref = 0;
28083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28085         return ret_ref;
28086 }
28087
28088 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
28089         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
28090         int64_t ret_ref = 0;
28091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28093         return ret_ref;
28094 }
28095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28096         LDKChannelHandshakeConfig arg_conv;
28097         arg_conv.inner = untag_ptr(arg);
28098         arg_conv.is_owned = ptr_is_owned(arg);
28099         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28100         arg_conv.is_owned = false;
28101         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
28102         return ret_conv;
28103 }
28104
28105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28106         LDKChannelHandshakeConfig orig_conv;
28107         orig_conv.inner = untag_ptr(orig);
28108         orig_conv.is_owned = ptr_is_owned(orig);
28109         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28110         orig_conv.is_owned = false;
28111         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
28112         int64_t ret_ref = 0;
28113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28115         return ret_ref;
28116 }
28117
28118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
28119         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
28120         int64_t ret_ref = 0;
28121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28123         return ret_ref;
28124 }
28125
28126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28127         LDKChannelHandshakeLimits this_obj_conv;
28128         this_obj_conv.inner = untag_ptr(this_obj);
28129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28131         ChannelHandshakeLimits_free(this_obj_conv);
28132 }
28133
28134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28135         LDKChannelHandshakeLimits this_ptr_conv;
28136         this_ptr_conv.inner = untag_ptr(this_ptr);
28137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28139         this_ptr_conv.is_owned = false;
28140         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
28141         return ret_conv;
28142 }
28143
28144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28145         LDKChannelHandshakeLimits this_ptr_conv;
28146         this_ptr_conv.inner = untag_ptr(this_ptr);
28147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28149         this_ptr_conv.is_owned = false;
28150         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
28151 }
28152
28153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28154         LDKChannelHandshakeLimits this_ptr_conv;
28155         this_ptr_conv.inner = untag_ptr(this_ptr);
28156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28158         this_ptr_conv.is_owned = false;
28159         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
28160         return ret_conv;
28161 }
28162
28163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28164         LDKChannelHandshakeLimits this_ptr_conv;
28165         this_ptr_conv.inner = untag_ptr(this_ptr);
28166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28168         this_ptr_conv.is_owned = false;
28169         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
28170 }
28171
28172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28173         LDKChannelHandshakeLimits this_ptr_conv;
28174         this_ptr_conv.inner = untag_ptr(this_ptr);
28175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28177         this_ptr_conv.is_owned = false;
28178         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
28179         return ret_conv;
28180 }
28181
28182 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) {
28183         LDKChannelHandshakeLimits this_ptr_conv;
28184         this_ptr_conv.inner = untag_ptr(this_ptr);
28185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28187         this_ptr_conv.is_owned = false;
28188         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
28189 }
28190
28191 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) {
28192         LDKChannelHandshakeLimits this_ptr_conv;
28193         this_ptr_conv.inner = untag_ptr(this_ptr);
28194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28196         this_ptr_conv.is_owned = false;
28197         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
28198         return ret_conv;
28199 }
28200
28201 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) {
28202         LDKChannelHandshakeLimits this_ptr_conv;
28203         this_ptr_conv.inner = untag_ptr(this_ptr);
28204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28206         this_ptr_conv.is_owned = false;
28207         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28208 }
28209
28210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28211         LDKChannelHandshakeLimits this_ptr_conv;
28212         this_ptr_conv.inner = untag_ptr(this_ptr);
28213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28215         this_ptr_conv.is_owned = false;
28216         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
28217         return ret_conv;
28218 }
28219
28220 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) {
28221         LDKChannelHandshakeLimits this_ptr_conv;
28222         this_ptr_conv.inner = untag_ptr(this_ptr);
28223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28225         this_ptr_conv.is_owned = false;
28226         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
28227 }
28228
28229 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
28230         LDKChannelHandshakeLimits this_ptr_conv;
28231         this_ptr_conv.inner = untag_ptr(this_ptr);
28232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28234         this_ptr_conv.is_owned = false;
28235         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
28236         return ret_conv;
28237 }
28238
28239 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) {
28240         LDKChannelHandshakeLimits this_ptr_conv;
28241         this_ptr_conv.inner = untag_ptr(this_ptr);
28242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28244         this_ptr_conv.is_owned = false;
28245         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
28246 }
28247
28248 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
28249         LDKChannelHandshakeLimits this_ptr_conv;
28250         this_ptr_conv.inner = untag_ptr(this_ptr);
28251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28253         this_ptr_conv.is_owned = false;
28254         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
28255         return ret_conv;
28256 }
28257
28258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28259         LDKChannelHandshakeLimits this_ptr_conv;
28260         this_ptr_conv.inner = untag_ptr(this_ptr);
28261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28263         this_ptr_conv.is_owned = false;
28264         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
28265 }
28266
28267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
28268         LDKChannelHandshakeLimits this_ptr_conv;
28269         this_ptr_conv.inner = untag_ptr(this_ptr);
28270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28272         this_ptr_conv.is_owned = false;
28273         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
28274         return ret_conv;
28275 }
28276
28277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28278         LDKChannelHandshakeLimits this_ptr_conv;
28279         this_ptr_conv.inner = untag_ptr(this_ptr);
28280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28282         this_ptr_conv.is_owned = false;
28283         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
28284 }
28285
28286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
28287         LDKChannelHandshakeLimits this_ptr_conv;
28288         this_ptr_conv.inner = untag_ptr(this_ptr);
28289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28291         this_ptr_conv.is_owned = false;
28292         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
28293         return ret_conv;
28294 }
28295
28296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28297         LDKChannelHandshakeLimits this_ptr_conv;
28298         this_ptr_conv.inner = untag_ptr(this_ptr);
28299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28301         this_ptr_conv.is_owned = false;
28302         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
28303 }
28304
28305 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28306         LDKChannelHandshakeLimits this_ptr_conv;
28307         this_ptr_conv.inner = untag_ptr(this_ptr);
28308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28310         this_ptr_conv.is_owned = false;
28311         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
28312         return ret_conv;
28313 }
28314
28315 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) {
28316         LDKChannelHandshakeLimits this_ptr_conv;
28317         this_ptr_conv.inner = untag_ptr(this_ptr);
28318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28320         this_ptr_conv.is_owned = false;
28321         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
28322 }
28323
28324 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) {
28325         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);
28326         int64_t ret_ref = 0;
28327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28329         return ret_ref;
28330 }
28331
28332 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
28333         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
28334         int64_t ret_ref = 0;
28335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28337         return ret_ref;
28338 }
28339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28340         LDKChannelHandshakeLimits arg_conv;
28341         arg_conv.inner = untag_ptr(arg);
28342         arg_conv.is_owned = ptr_is_owned(arg);
28343         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28344         arg_conv.is_owned = false;
28345         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
28346         return ret_conv;
28347 }
28348
28349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28350         LDKChannelHandshakeLimits orig_conv;
28351         orig_conv.inner = untag_ptr(orig);
28352         orig_conv.is_owned = ptr_is_owned(orig);
28353         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28354         orig_conv.is_owned = false;
28355         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
28356         int64_t ret_ref = 0;
28357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28359         return ret_ref;
28360 }
28361
28362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
28363         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
28364         int64_t ret_ref = 0;
28365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28367         return ret_ref;
28368 }
28369
28370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28371         LDKChannelConfig this_obj_conv;
28372         this_obj_conv.inner = untag_ptr(this_obj);
28373         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28375         ChannelConfig_free(this_obj_conv);
28376 }
28377
28378 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28379         LDKChannelConfig this_ptr_conv;
28380         this_ptr_conv.inner = untag_ptr(this_ptr);
28381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28383         this_ptr_conv.is_owned = false;
28384         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
28385         return ret_conv;
28386 }
28387
28388 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) {
28389         LDKChannelConfig this_ptr_conv;
28390         this_ptr_conv.inner = untag_ptr(this_ptr);
28391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28393         this_ptr_conv.is_owned = false;
28394         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
28395 }
28396
28397 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28398         LDKChannelConfig this_ptr_conv;
28399         this_ptr_conv.inner = untag_ptr(this_ptr);
28400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28402         this_ptr_conv.is_owned = false;
28403         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
28404         return ret_conv;
28405 }
28406
28407 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) {
28408         LDKChannelConfig this_ptr_conv;
28409         this_ptr_conv.inner = untag_ptr(this_ptr);
28410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28412         this_ptr_conv.is_owned = false;
28413         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
28414 }
28415
28416 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28417         LDKChannelConfig this_ptr_conv;
28418         this_ptr_conv.inner = untag_ptr(this_ptr);
28419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28421         this_ptr_conv.is_owned = false;
28422         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
28423         return ret_conv;
28424 }
28425
28426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28427         LDKChannelConfig this_ptr_conv;
28428         this_ptr_conv.inner = untag_ptr(this_ptr);
28429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28431         this_ptr_conv.is_owned = false;
28432         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
28433 }
28434
28435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28436         LDKChannelConfig this_ptr_conv;
28437         this_ptr_conv.inner = untag_ptr(this_ptr);
28438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28440         this_ptr_conv.is_owned = false;
28441         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
28442         return ret_conv;
28443 }
28444
28445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28446         LDKChannelConfig this_ptr_conv;
28447         this_ptr_conv.inner = untag_ptr(this_ptr);
28448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28450         this_ptr_conv.is_owned = false;
28451         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
28452 }
28453
28454 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) {
28455         LDKChannelConfig this_ptr_conv;
28456         this_ptr_conv.inner = untag_ptr(this_ptr);
28457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28459         this_ptr_conv.is_owned = false;
28460         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
28461         return ret_conv;
28462 }
28463
28464 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) {
28465         LDKChannelConfig this_ptr_conv;
28466         this_ptr_conv.inner = untag_ptr(this_ptr);
28467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28469         this_ptr_conv.is_owned = false;
28470         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
28471 }
28472
28473 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_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
28474         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
28475         int64_t ret_ref = 0;
28476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28478         return ret_ref;
28479 }
28480
28481 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
28482         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
28483         int64_t ret_ref = 0;
28484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28486         return ret_ref;
28487 }
28488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28489         LDKChannelConfig arg_conv;
28490         arg_conv.inner = untag_ptr(arg);
28491         arg_conv.is_owned = ptr_is_owned(arg);
28492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28493         arg_conv.is_owned = false;
28494         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
28495         return ret_conv;
28496 }
28497
28498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28499         LDKChannelConfig orig_conv;
28500         orig_conv.inner = untag_ptr(orig);
28501         orig_conv.is_owned = ptr_is_owned(orig);
28502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28503         orig_conv.is_owned = false;
28504         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
28505         int64_t ret_ref = 0;
28506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28508         return ret_ref;
28509 }
28510
28511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28512         LDKChannelConfig a_conv;
28513         a_conv.inner = untag_ptr(a);
28514         a_conv.is_owned = ptr_is_owned(a);
28515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28516         a_conv.is_owned = false;
28517         LDKChannelConfig b_conv;
28518         b_conv.inner = untag_ptr(b);
28519         b_conv.is_owned = ptr_is_owned(b);
28520         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28521         b_conv.is_owned = false;
28522         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
28523         return ret_conv;
28524 }
28525
28526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
28527         LDKChannelConfig ret_var = ChannelConfig_default();
28528         int64_t ret_ref = 0;
28529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28531         return ret_ref;
28532 }
28533
28534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
28535         LDKChannelConfig obj_conv;
28536         obj_conv.inner = untag_ptr(obj);
28537         obj_conv.is_owned = ptr_is_owned(obj);
28538         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28539         obj_conv.is_owned = false;
28540         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
28541         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28542         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28543         CVec_u8Z_free(ret_var);
28544         return ret_arr;
28545 }
28546
28547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28548         LDKu8slice ser_ref;
28549         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28550         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28551         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28552         *ret_conv = ChannelConfig_read(ser_ref);
28553         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28554         return tag_ptr(ret_conv, true);
28555 }
28556
28557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28558         LDKUserConfig this_obj_conv;
28559         this_obj_conv.inner = untag_ptr(this_obj);
28560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28562         UserConfig_free(this_obj_conv);
28563 }
28564
28565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
28566         LDKUserConfig this_ptr_conv;
28567         this_ptr_conv.inner = untag_ptr(this_ptr);
28568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28570         this_ptr_conv.is_owned = false;
28571         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
28572         int64_t ret_ref = 0;
28573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28575         return ret_ref;
28576 }
28577
28578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28579         LDKUserConfig this_ptr_conv;
28580         this_ptr_conv.inner = untag_ptr(this_ptr);
28581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28583         this_ptr_conv.is_owned = false;
28584         LDKChannelHandshakeConfig val_conv;
28585         val_conv.inner = untag_ptr(val);
28586         val_conv.is_owned = ptr_is_owned(val);
28587         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28588         val_conv = ChannelHandshakeConfig_clone(&val_conv);
28589         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
28590 }
28591
28592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
28593         LDKUserConfig this_ptr_conv;
28594         this_ptr_conv.inner = untag_ptr(this_ptr);
28595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28597         this_ptr_conv.is_owned = false;
28598         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
28599         int64_t ret_ref = 0;
28600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28602         return ret_ref;
28603 }
28604
28605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28606         LDKUserConfig this_ptr_conv;
28607         this_ptr_conv.inner = untag_ptr(this_ptr);
28608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28610         this_ptr_conv.is_owned = false;
28611         LDKChannelHandshakeLimits val_conv;
28612         val_conv.inner = untag_ptr(val);
28613         val_conv.is_owned = ptr_is_owned(val);
28614         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28615         val_conv = ChannelHandshakeLimits_clone(&val_conv);
28616         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
28617 }
28618
28619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
28620         LDKUserConfig this_ptr_conv;
28621         this_ptr_conv.inner = untag_ptr(this_ptr);
28622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28624         this_ptr_conv.is_owned = false;
28625         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
28626         int64_t ret_ref = 0;
28627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28629         return ret_ref;
28630 }
28631
28632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28633         LDKUserConfig this_ptr_conv;
28634         this_ptr_conv.inner = untag_ptr(this_ptr);
28635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28637         this_ptr_conv.is_owned = false;
28638         LDKChannelConfig val_conv;
28639         val_conv.inner = untag_ptr(val);
28640         val_conv.is_owned = ptr_is_owned(val);
28641         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28642         val_conv = ChannelConfig_clone(&val_conv);
28643         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
28644 }
28645
28646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
28647         LDKUserConfig this_ptr_conv;
28648         this_ptr_conv.inner = untag_ptr(this_ptr);
28649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28651         this_ptr_conv.is_owned = false;
28652         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
28653         return ret_conv;
28654 }
28655
28656 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) {
28657         LDKUserConfig this_ptr_conv;
28658         this_ptr_conv.inner = untag_ptr(this_ptr);
28659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28661         this_ptr_conv.is_owned = false;
28662         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
28663 }
28664
28665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
28666         LDKUserConfig this_ptr_conv;
28667         this_ptr_conv.inner = untag_ptr(this_ptr);
28668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28670         this_ptr_conv.is_owned = false;
28671         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
28672         return ret_conv;
28673 }
28674
28675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28676         LDKUserConfig this_ptr_conv;
28677         this_ptr_conv.inner = untag_ptr(this_ptr);
28678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28680         this_ptr_conv.is_owned = false;
28681         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
28682 }
28683
28684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
28685         LDKUserConfig this_ptr_conv;
28686         this_ptr_conv.inner = untag_ptr(this_ptr);
28687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28689         this_ptr_conv.is_owned = false;
28690         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
28691         return ret_conv;
28692 }
28693
28694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28695         LDKUserConfig this_ptr_conv;
28696         this_ptr_conv.inner = untag_ptr(this_ptr);
28697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28699         this_ptr_conv.is_owned = false;
28700         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
28701 }
28702
28703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
28704         LDKUserConfig this_ptr_conv;
28705         this_ptr_conv.inner = untag_ptr(this_ptr);
28706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28708         this_ptr_conv.is_owned = false;
28709         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
28710         return ret_conv;
28711 }
28712
28713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28714         LDKUserConfig this_ptr_conv;
28715         this_ptr_conv.inner = untag_ptr(this_ptr);
28716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28718         this_ptr_conv.is_owned = false;
28719         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
28720 }
28721
28722 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) {
28723         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
28724         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
28725         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
28726         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
28727         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
28728         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
28729         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
28730         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
28731         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
28732         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
28733         LDKChannelConfig channel_config_arg_conv;
28734         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
28735         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
28736         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
28737         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
28738         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);
28739         int64_t ret_ref = 0;
28740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28742         return ret_ref;
28743 }
28744
28745 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
28746         LDKUserConfig ret_var = UserConfig_clone(arg);
28747         int64_t ret_ref = 0;
28748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28750         return ret_ref;
28751 }
28752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28753         LDKUserConfig arg_conv;
28754         arg_conv.inner = untag_ptr(arg);
28755         arg_conv.is_owned = ptr_is_owned(arg);
28756         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28757         arg_conv.is_owned = false;
28758         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
28759         return ret_conv;
28760 }
28761
28762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28763         LDKUserConfig orig_conv;
28764         orig_conv.inner = untag_ptr(orig);
28765         orig_conv.is_owned = ptr_is_owned(orig);
28766         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28767         orig_conv.is_owned = false;
28768         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
28769         int64_t ret_ref = 0;
28770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28772         return ret_ref;
28773 }
28774
28775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
28776         LDKUserConfig ret_var = UserConfig_default();
28777         int64_t ret_ref = 0;
28778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28780         return ret_ref;
28781 }
28782
28783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28784         LDKBestBlock this_obj_conv;
28785         this_obj_conv.inner = untag_ptr(this_obj);
28786         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28788         BestBlock_free(this_obj_conv);
28789 }
28790
28791 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
28792         LDKBestBlock ret_var = BestBlock_clone(arg);
28793         int64_t ret_ref = 0;
28794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28796         return ret_ref;
28797 }
28798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28799         LDKBestBlock arg_conv;
28800         arg_conv.inner = untag_ptr(arg);
28801         arg_conv.is_owned = ptr_is_owned(arg);
28802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28803         arg_conv.is_owned = false;
28804         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
28805         return ret_conv;
28806 }
28807
28808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28809         LDKBestBlock orig_conv;
28810         orig_conv.inner = untag_ptr(orig);
28811         orig_conv.is_owned = ptr_is_owned(orig);
28812         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28813         orig_conv.is_owned = false;
28814         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
28815         int64_t ret_ref = 0;
28816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28818         return ret_ref;
28819 }
28820
28821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28822         LDKBestBlock a_conv;
28823         a_conv.inner = untag_ptr(a);
28824         a_conv.is_owned = ptr_is_owned(a);
28825         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28826         a_conv.is_owned = false;
28827         LDKBestBlock b_conv;
28828         b_conv.inner = untag_ptr(b);
28829         b_conv.is_owned = ptr_is_owned(b);
28830         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28831         b_conv.is_owned = false;
28832         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
28833         return ret_conv;
28834 }
28835
28836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
28837         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
28838         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
28839         int64_t ret_ref = 0;
28840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28842         return ret_ref;
28843 }
28844
28845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
28846         LDKThirtyTwoBytes block_hash_ref;
28847         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
28848         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
28849         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
28850         int64_t ret_ref = 0;
28851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28853         return ret_ref;
28854 }
28855
28856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
28857         LDKBestBlock this_arg_conv;
28858         this_arg_conv.inner = untag_ptr(this_arg);
28859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28861         this_arg_conv.is_owned = false;
28862         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28863         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
28864         return ret_arr;
28865 }
28866
28867 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
28868         LDKBestBlock this_arg_conv;
28869         this_arg_conv.inner = untag_ptr(this_arg);
28870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28872         this_arg_conv.is_owned = false;
28873         int32_t ret_conv = BestBlock_height(&this_arg_conv);
28874         return ret_conv;
28875 }
28876
28877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28878         if (!ptr_is_owned(this_ptr)) return;
28879         void* this_ptr_ptr = untag_ptr(this_ptr);
28880         CHECK_ACCESS(this_ptr_ptr);
28881         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
28882         FREE(untag_ptr(this_ptr));
28883         Listen_free(this_ptr_conv);
28884 }
28885
28886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28887         if (!ptr_is_owned(this_ptr)) return;
28888         void* this_ptr_ptr = untag_ptr(this_ptr);
28889         CHECK_ACCESS(this_ptr_ptr);
28890         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
28891         FREE(untag_ptr(this_ptr));
28892         Confirm_free(this_ptr_conv);
28893 }
28894
28895 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28896         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
28897         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
28898         return ret_conv;
28899 }
28900
28901 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
28902         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
28903         return ret_conv;
28904 }
28905
28906 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
28907         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
28908         return ret_conv;
28909 }
28910
28911 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1permanent_1failure(JNIEnv *env, jclass clz) {
28912         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_permanent_failure());
28913         return ret_conv;
28914 }
28915
28916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28917         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
28918         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
28919         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
28920         return ret_conv;
28921 }
28922
28923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28924         if (!ptr_is_owned(this_ptr)) return;
28925         void* this_ptr_ptr = untag_ptr(this_ptr);
28926         CHECK_ACCESS(this_ptr_ptr);
28927         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
28928         FREE(untag_ptr(this_ptr));
28929         Watch_free(this_ptr_conv);
28930 }
28931
28932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28933         if (!ptr_is_owned(this_ptr)) return;
28934         void* this_ptr_ptr = untag_ptr(this_ptr);
28935         CHECK_ACCESS(this_ptr_ptr);
28936         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
28937         FREE(untag_ptr(this_ptr));
28938         Filter_free(this_ptr_conv);
28939 }
28940
28941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28942         LDKWatchedOutput this_obj_conv;
28943         this_obj_conv.inner = untag_ptr(this_obj);
28944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28946         WatchedOutput_free(this_obj_conv);
28947 }
28948
28949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
28950         LDKWatchedOutput this_ptr_conv;
28951         this_ptr_conv.inner = untag_ptr(this_ptr);
28952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28954         this_ptr_conv.is_owned = false;
28955         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28956         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
28957         return ret_arr;
28958 }
28959
28960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28961         LDKWatchedOutput this_ptr_conv;
28962         this_ptr_conv.inner = untag_ptr(this_ptr);
28963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28965         this_ptr_conv.is_owned = false;
28966         LDKThirtyTwoBytes val_ref;
28967         CHECK((*env)->GetArrayLength(env, val) == 32);
28968         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28969         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
28970 }
28971
28972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28973         LDKWatchedOutput this_ptr_conv;
28974         this_ptr_conv.inner = untag_ptr(this_ptr);
28975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28977         this_ptr_conv.is_owned = false;
28978         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
28979         int64_t ret_ref = 0;
28980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28982         return ret_ref;
28983 }
28984
28985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28986         LDKWatchedOutput this_ptr_conv;
28987         this_ptr_conv.inner = untag_ptr(this_ptr);
28988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28990         this_ptr_conv.is_owned = false;
28991         LDKOutPoint val_conv;
28992         val_conv.inner = untag_ptr(val);
28993         val_conv.is_owned = ptr_is_owned(val);
28994         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28995         val_conv = OutPoint_clone(&val_conv);
28996         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
28997 }
28998
28999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29000         LDKWatchedOutput this_ptr_conv;
29001         this_ptr_conv.inner = untag_ptr(this_ptr);
29002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29004         this_ptr_conv.is_owned = false;
29005         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
29006         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29007         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29008         return ret_arr;
29009 }
29010
29011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29012         LDKWatchedOutput this_ptr_conv;
29013         this_ptr_conv.inner = untag_ptr(this_ptr);
29014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29016         this_ptr_conv.is_owned = false;
29017         LDKCVec_u8Z val_ref;
29018         val_ref.datalen = (*env)->GetArrayLength(env, val);
29019         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29020         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
29021         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
29022 }
29023
29024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
29025         LDKThirtyTwoBytes block_hash_arg_ref;
29026         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
29027         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
29028         LDKOutPoint outpoint_arg_conv;
29029         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
29030         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
29031         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
29032         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
29033         LDKCVec_u8Z script_pubkey_arg_ref;
29034         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
29035         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29036         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
29037         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
29038         int64_t ret_ref = 0;
29039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29041         return ret_ref;
29042 }
29043
29044 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
29045         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
29046         int64_t ret_ref = 0;
29047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29049         return ret_ref;
29050 }
29051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29052         LDKWatchedOutput arg_conv;
29053         arg_conv.inner = untag_ptr(arg);
29054         arg_conv.is_owned = ptr_is_owned(arg);
29055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29056         arg_conv.is_owned = false;
29057         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
29058         return ret_conv;
29059 }
29060
29061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29062         LDKWatchedOutput orig_conv;
29063         orig_conv.inner = untag_ptr(orig);
29064         orig_conv.is_owned = ptr_is_owned(orig);
29065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29066         orig_conv.is_owned = false;
29067         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
29068         int64_t ret_ref = 0;
29069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29071         return ret_ref;
29072 }
29073
29074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29075         LDKWatchedOutput a_conv;
29076         a_conv.inner = untag_ptr(a);
29077         a_conv.is_owned = ptr_is_owned(a);
29078         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29079         a_conv.is_owned = false;
29080         LDKWatchedOutput b_conv;
29081         b_conv.inner = untag_ptr(b);
29082         b_conv.is_owned = ptr_is_owned(b);
29083         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29084         b_conv.is_owned = false;
29085         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
29086         return ret_conv;
29087 }
29088
29089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
29090         LDKWatchedOutput o_conv;
29091         o_conv.inner = untag_ptr(o);
29092         o_conv.is_owned = ptr_is_owned(o);
29093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29094         o_conv.is_owned = false;
29095         int64_t ret_conv = WatchedOutput_hash(&o_conv);
29096         return ret_conv;
29097 }
29098
29099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29100         if (!ptr_is_owned(this_ptr)) return;
29101         void* this_ptr_ptr = untag_ptr(this_ptr);
29102         CHECK_ACCESS(this_ptr_ptr);
29103         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
29104         FREE(untag_ptr(this_ptr));
29105         BroadcasterInterface_free(this_ptr_conv);
29106 }
29107
29108 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29109         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
29110         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
29111         return ret_conv;
29112 }
29113
29114 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
29115         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
29116         return ret_conv;
29117 }
29118
29119 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
29120         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
29121         return ret_conv;
29122 }
29123
29124 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
29125         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
29126         return ret_conv;
29127 }
29128
29129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
29130         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
29131         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
29132         return ret_conv;
29133 }
29134
29135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29136         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
29137         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
29138         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
29139         return ret_conv;
29140 }
29141
29142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29143         if (!ptr_is_owned(this_ptr)) return;
29144         void* this_ptr_ptr = untag_ptr(this_ptr);
29145         CHECK_ACCESS(this_ptr_ptr);
29146         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
29147         FREE(untag_ptr(this_ptr));
29148         FeeEstimator_free(this_ptr_conv);
29149 }
29150
29151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29152         LDKMonitorUpdateId this_obj_conv;
29153         this_obj_conv.inner = untag_ptr(this_obj);
29154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29156         MonitorUpdateId_free(this_obj_conv);
29157 }
29158
29159 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
29160         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
29161         int64_t ret_ref = 0;
29162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29164         return ret_ref;
29165 }
29166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29167         LDKMonitorUpdateId arg_conv;
29168         arg_conv.inner = untag_ptr(arg);
29169         arg_conv.is_owned = ptr_is_owned(arg);
29170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29171         arg_conv.is_owned = false;
29172         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
29173         return ret_conv;
29174 }
29175
29176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29177         LDKMonitorUpdateId orig_conv;
29178         orig_conv.inner = untag_ptr(orig);
29179         orig_conv.is_owned = ptr_is_owned(orig);
29180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29181         orig_conv.is_owned = false;
29182         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
29183         int64_t ret_ref = 0;
29184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29186         return ret_ref;
29187 }
29188
29189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
29190         LDKMonitorUpdateId o_conv;
29191         o_conv.inner = untag_ptr(o);
29192         o_conv.is_owned = ptr_is_owned(o);
29193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29194         o_conv.is_owned = false;
29195         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
29196         return ret_conv;
29197 }
29198
29199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29200         LDKMonitorUpdateId a_conv;
29201         a_conv.inner = untag_ptr(a);
29202         a_conv.is_owned = ptr_is_owned(a);
29203         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29204         a_conv.is_owned = false;
29205         LDKMonitorUpdateId b_conv;
29206         b_conv.inner = untag_ptr(b);
29207         b_conv.is_owned = ptr_is_owned(b);
29208         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29209         b_conv.is_owned = false;
29210         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
29211         return ret_conv;
29212 }
29213
29214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29215         if (!ptr_is_owned(this_ptr)) return;
29216         void* this_ptr_ptr = untag_ptr(this_ptr);
29217         CHECK_ACCESS(this_ptr_ptr);
29218         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
29219         FREE(untag_ptr(this_ptr));
29220         Persist_free(this_ptr_conv);
29221 }
29222
29223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29224         LDKLockedChannelMonitor this_obj_conv;
29225         this_obj_conv.inner = untag_ptr(this_obj);
29226         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29228         LockedChannelMonitor_free(this_obj_conv);
29229 }
29230
29231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29232         LDKChainMonitor this_obj_conv;
29233         this_obj_conv.inner = untag_ptr(this_obj);
29234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29236         ChainMonitor_free(this_obj_conv);
29237 }
29238
29239 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) {
29240         void* chain_source_ptr = untag_ptr(chain_source);
29241         CHECK_ACCESS(chain_source_ptr);
29242         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
29243         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
29244         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
29245                 // Manually implement clone for Java trait instances
29246                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
29247                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29248                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
29249                 }
29250         }
29251         void* broadcaster_ptr = untag_ptr(broadcaster);
29252         CHECK_ACCESS(broadcaster_ptr);
29253         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
29254         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29255                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29256                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
29257         }
29258         void* logger_ptr = untag_ptr(logger);
29259         CHECK_ACCESS(logger_ptr);
29260         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29261         if (logger_conv.free == LDKLogger_JCalls_free) {
29262                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29263                 LDKLogger_JCalls_cloned(&logger_conv);
29264         }
29265         void* feeest_ptr = untag_ptr(feeest);
29266         CHECK_ACCESS(feeest_ptr);
29267         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
29268         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
29269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29270                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
29271         }
29272         void* persister_ptr = untag_ptr(persister);
29273         CHECK_ACCESS(persister_ptr);
29274         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
29275         if (persister_conv.free == LDKPersist_JCalls_free) {
29276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29277                 LDKPersist_JCalls_cloned(&persister_conv);
29278         }
29279         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
29280         int64_t ret_ref = 0;
29281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29283         return ret_ref;
29284 }
29285
29286 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) {
29287         LDKChainMonitor this_arg_conv;
29288         this_arg_conv.inner = untag_ptr(this_arg);
29289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29291         this_arg_conv.is_owned = false;
29292         LDKCVec_ChannelDetailsZ ignored_channels_constr;
29293         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
29294         if (ignored_channels_constr.datalen > 0)
29295                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29296         else
29297                 ignored_channels_constr.data = NULL;
29298         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
29299         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
29300                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
29301                 LDKChannelDetails ignored_channels_conv_16_conv;
29302                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
29303                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
29304                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
29305                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
29306                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
29307         }
29308         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
29309         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
29310         int64_tArray ret_arr = NULL;
29311         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29312         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29313         for (size_t j = 0; j < ret_var.datalen; j++) {
29314                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29315                 *ret_conv_9_copy = ret_var.data[j];
29316                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
29317                 ret_arr_ptr[j] = ret_conv_9_ref;
29318         }
29319         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29320         FREE(ret_var.data);
29321         return ret_arr;
29322 }
29323
29324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
29325         LDKChainMonitor this_arg_conv;
29326         this_arg_conv.inner = untag_ptr(this_arg);
29327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29329         this_arg_conv.is_owned = false;
29330         LDKOutPoint funding_txo_conv;
29331         funding_txo_conv.inner = untag_ptr(funding_txo);
29332         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
29333         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
29334         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
29335         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
29336         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
29337         return tag_ptr(ret_conv, true);
29338 }
29339
29340 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
29341         LDKChainMonitor this_arg_conv;
29342         this_arg_conv.inner = untag_ptr(this_arg);
29343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29345         this_arg_conv.is_owned = false;
29346         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
29347         int64_tArray ret_arr = NULL;
29348         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29349         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29350         for (size_t k = 0; k < ret_var.datalen; k++) {
29351                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
29352                 int64_t ret_conv_10_ref = 0;
29353                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
29354                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
29355                 ret_arr_ptr[k] = ret_conv_10_ref;
29356         }
29357         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29358         FREE(ret_var.data);
29359         return ret_arr;
29360 }
29361
29362 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
29363         LDKChainMonitor this_arg_conv;
29364         this_arg_conv.inner = untag_ptr(this_arg);
29365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29367         this_arg_conv.is_owned = false;
29368         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
29369         int64_tArray ret_arr = NULL;
29370         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29371         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29372         for (size_t p = 0; p < ret_var.datalen; p++) {
29373                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
29374                 *ret_conv_41_conv = ret_var.data[p];
29375                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
29376         }
29377         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29378         FREE(ret_var.data);
29379         return ret_arr;
29380 }
29381
29382 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) {
29383         LDKChainMonitor this_arg_conv;
29384         this_arg_conv.inner = untag_ptr(this_arg);
29385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29387         this_arg_conv.is_owned = false;
29388         LDKOutPoint funding_txo_conv;
29389         funding_txo_conv.inner = untag_ptr(funding_txo);
29390         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
29391         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
29392         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
29393         LDKMonitorUpdateId completed_update_id_conv;
29394         completed_update_id_conv.inner = untag_ptr(completed_update_id);
29395         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
29396         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
29397         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
29398         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29399         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
29400         return tag_ptr(ret_conv, true);
29401 }
29402
29403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
29404         LDKChainMonitor this_arg_conv;
29405         this_arg_conv.inner = untag_ptr(this_arg);
29406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29408         this_arg_conv.is_owned = false;
29409         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29410         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
29411         return tag_ptr(ret_ret, true);
29412 }
29413
29414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
29415         LDKChainMonitor this_arg_conv;
29416         this_arg_conv.inner = untag_ptr(this_arg);
29417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29419         this_arg_conv.is_owned = false;
29420         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29421         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
29422         return tag_ptr(ret_ret, true);
29423 }
29424
29425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
29426         LDKChainMonitor this_arg_conv;
29427         this_arg_conv.inner = untag_ptr(this_arg);
29428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29430         this_arg_conv.is_owned = false;
29431         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
29432         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
29433         return tag_ptr(ret_ret, true);
29434 }
29435
29436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29437         LDKChainMonitor this_arg_conv;
29438         this_arg_conv.inner = untag_ptr(this_arg);
29439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29441         this_arg_conv.is_owned = false;
29442         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29443         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
29444         return tag_ptr(ret_ret, true);
29445 }
29446
29447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29448         LDKChannelMonitorUpdate this_obj_conv;
29449         this_obj_conv.inner = untag_ptr(this_obj);
29450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29452         ChannelMonitorUpdate_free(this_obj_conv);
29453 }
29454
29455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29456         LDKChannelMonitorUpdate this_ptr_conv;
29457         this_ptr_conv.inner = untag_ptr(this_ptr);
29458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29460         this_ptr_conv.is_owned = false;
29461         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
29462         return ret_conv;
29463 }
29464
29465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29466         LDKChannelMonitorUpdate this_ptr_conv;
29467         this_ptr_conv.inner = untag_ptr(this_ptr);
29468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29470         this_ptr_conv.is_owned = false;
29471         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
29472 }
29473
29474 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
29475         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
29476         int64_t ret_ref = 0;
29477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29479         return ret_ref;
29480 }
29481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29482         LDKChannelMonitorUpdate arg_conv;
29483         arg_conv.inner = untag_ptr(arg);
29484         arg_conv.is_owned = ptr_is_owned(arg);
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29486         arg_conv.is_owned = false;
29487         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
29488         return ret_conv;
29489 }
29490
29491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29492         LDKChannelMonitorUpdate orig_conv;
29493         orig_conv.inner = untag_ptr(orig);
29494         orig_conv.is_owned = ptr_is_owned(orig);
29495         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29496         orig_conv.is_owned = false;
29497         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
29498         int64_t ret_ref = 0;
29499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29501         return ret_ref;
29502 }
29503
29504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
29505         LDKChannelMonitorUpdate obj_conv;
29506         obj_conv.inner = untag_ptr(obj);
29507         obj_conv.is_owned = ptr_is_owned(obj);
29508         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29509         obj_conv.is_owned = false;
29510         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
29511         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29512         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29513         CVec_u8Z_free(ret_var);
29514         return ret_arr;
29515 }
29516
29517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29518         LDKu8slice ser_ref;
29519         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29520         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29521         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
29522         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
29523         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29524         return tag_ptr(ret_conv, true);
29525 }
29526
29527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29528         if (!ptr_is_owned(this_ptr)) return;
29529         void* this_ptr_ptr = untag_ptr(this_ptr);
29530         CHECK_ACCESS(this_ptr_ptr);
29531         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
29532         FREE(untag_ptr(this_ptr));
29533         MonitorEvent_free(this_ptr_conv);
29534 }
29535
29536 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
29537         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
29538         *ret_copy = MonitorEvent_clone(arg);
29539         int64_t ret_ref = tag_ptr(ret_copy, true);
29540         return ret_ref;
29541 }
29542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29543         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
29544         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
29545         return ret_conv;
29546 }
29547
29548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29549         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
29550         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
29551         *ret_copy = MonitorEvent_clone(orig_conv);
29552         int64_t ret_ref = tag_ptr(ret_copy, true);
29553         return ret_ref;
29554 }
29555
29556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
29557         LDKHTLCUpdate a_conv;
29558         a_conv.inner = untag_ptr(a);
29559         a_conv.is_owned = ptr_is_owned(a);
29560         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29561         a_conv = HTLCUpdate_clone(&a_conv);
29562         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
29563         *ret_copy = MonitorEvent_htlcevent(a_conv);
29564         int64_t ret_ref = tag_ptr(ret_copy, true);
29565         return ret_ref;
29566 }
29567
29568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
29569         LDKOutPoint a_conv;
29570         a_conv.inner = untag_ptr(a);
29571         a_conv.is_owned = ptr_is_owned(a);
29572         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29573         a_conv = OutPoint_clone(&a_conv);
29574         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
29575         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
29576         int64_t ret_ref = tag_ptr(ret_copy, true);
29577         return ret_ref;
29578 }
29579
29580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
29581         LDKOutPoint funding_txo_conv;
29582         funding_txo_conv.inner = untag_ptr(funding_txo);
29583         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
29584         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
29585         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
29586         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
29587         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
29588         int64_t ret_ref = tag_ptr(ret_copy, true);
29589         return ret_ref;
29590 }
29591
29592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
29593         LDKOutPoint a_conv;
29594         a_conv.inner = untag_ptr(a);
29595         a_conv.is_owned = ptr_is_owned(a);
29596         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29597         a_conv = OutPoint_clone(&a_conv);
29598         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
29599         *ret_copy = MonitorEvent_update_failed(a_conv);
29600         int64_t ret_ref = tag_ptr(ret_copy, true);
29601         return ret_ref;
29602 }
29603
29604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29605         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
29606         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
29607         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
29608         return ret_conv;
29609 }
29610
29611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
29612         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
29613         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
29614         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29615         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29616         CVec_u8Z_free(ret_var);
29617         return ret_arr;
29618 }
29619
29620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29621         LDKu8slice ser_ref;
29622         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29623         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29624         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
29625         *ret_conv = MonitorEvent_read(ser_ref);
29626         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29627         return tag_ptr(ret_conv, true);
29628 }
29629
29630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29631         LDKHTLCUpdate this_obj_conv;
29632         this_obj_conv.inner = untag_ptr(this_obj);
29633         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29635         HTLCUpdate_free(this_obj_conv);
29636 }
29637
29638 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
29639         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
29640         int64_t ret_ref = 0;
29641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29643         return ret_ref;
29644 }
29645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29646         LDKHTLCUpdate arg_conv;
29647         arg_conv.inner = untag_ptr(arg);
29648         arg_conv.is_owned = ptr_is_owned(arg);
29649         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29650         arg_conv.is_owned = false;
29651         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
29652         return ret_conv;
29653 }
29654
29655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29656         LDKHTLCUpdate orig_conv;
29657         orig_conv.inner = untag_ptr(orig);
29658         orig_conv.is_owned = ptr_is_owned(orig);
29659         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29660         orig_conv.is_owned = false;
29661         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
29662         int64_t ret_ref = 0;
29663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29665         return ret_ref;
29666 }
29667
29668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29669         LDKHTLCUpdate a_conv;
29670         a_conv.inner = untag_ptr(a);
29671         a_conv.is_owned = ptr_is_owned(a);
29672         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29673         a_conv.is_owned = false;
29674         LDKHTLCUpdate b_conv;
29675         b_conv.inner = untag_ptr(b);
29676         b_conv.is_owned = ptr_is_owned(b);
29677         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29678         b_conv.is_owned = false;
29679         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
29680         return ret_conv;
29681 }
29682
29683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
29684         LDKHTLCUpdate obj_conv;
29685         obj_conv.inner = untag_ptr(obj);
29686         obj_conv.is_owned = ptr_is_owned(obj);
29687         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29688         obj_conv.is_owned = false;
29689         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
29690         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29691         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29692         CVec_u8Z_free(ret_var);
29693         return ret_arr;
29694 }
29695
29696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29697         LDKu8slice ser_ref;
29698         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29699         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29700         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29701         *ret_conv = HTLCUpdate_read(ser_ref);
29702         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29703         return tag_ptr(ret_conv, true);
29704 }
29705
29706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29707         if (!ptr_is_owned(this_ptr)) return;
29708         void* this_ptr_ptr = untag_ptr(this_ptr);
29709         CHECK_ACCESS(this_ptr_ptr);
29710         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
29711         FREE(untag_ptr(this_ptr));
29712         Balance_free(this_ptr_conv);
29713 }
29714
29715 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
29716         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29717         *ret_copy = Balance_clone(arg);
29718         int64_t ret_ref = tag_ptr(ret_copy, true);
29719         return ret_ref;
29720 }
29721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29722         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
29723         int64_t ret_conv = Balance_clone_ptr(arg_conv);
29724         return ret_conv;
29725 }
29726
29727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29728         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
29729         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29730         *ret_copy = Balance_clone(orig_conv);
29731         int64_t ret_ref = tag_ptr(ret_copy, true);
29732         return ret_ref;
29733 }
29734
29735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
29736         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29737         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
29738         int64_t ret_ref = tag_ptr(ret_copy, true);
29739         return ret_ref;
29740 }
29741
29742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
29743         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29744         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
29745         int64_t ret_ref = tag_ptr(ret_copy, true);
29746         return ret_ref;
29747 }
29748
29749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
29750         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29751         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
29752         int64_t ret_ref = tag_ptr(ret_copy, true);
29753         return ret_ref;
29754 }
29755
29756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1timeout_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
29757         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29758         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
29759         int64_t ret_ref = tag_ptr(ret_copy, true);
29760         return ret_ref;
29761 }
29762
29763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1preimage_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t expiry_height) {
29764         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29765         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
29766         int64_t ret_ref = tag_ptr(ret_copy, true);
29767         return ret_ref;
29768 }
29769
29770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
29771         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
29772         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
29773         int64_t ret_ref = tag_ptr(ret_copy, true);
29774         return ret_ref;
29775 }
29776
29777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29778         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
29779         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
29780         jboolean ret_conv = Balance_eq(a_conv, b_conv);
29781         return ret_conv;
29782 }
29783
29784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29785         LDKChannelMonitor this_obj_conv;
29786         this_obj_conv.inner = untag_ptr(this_obj);
29787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29789         ChannelMonitor_free(this_obj_conv);
29790 }
29791
29792 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
29793         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
29794         int64_t ret_ref = 0;
29795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29797         return ret_ref;
29798 }
29799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29800         LDKChannelMonitor arg_conv;
29801         arg_conv.inner = untag_ptr(arg);
29802         arg_conv.is_owned = ptr_is_owned(arg);
29803         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29804         arg_conv.is_owned = false;
29805         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
29806         return ret_conv;
29807 }
29808
29809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29810         LDKChannelMonitor orig_conv;
29811         orig_conv.inner = untag_ptr(orig);
29812         orig_conv.is_owned = ptr_is_owned(orig);
29813         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29814         orig_conv.is_owned = false;
29815         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
29816         int64_t ret_ref = 0;
29817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29819         return ret_ref;
29820 }
29821
29822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
29823         LDKChannelMonitor obj_conv;
29824         obj_conv.inner = untag_ptr(obj);
29825         obj_conv.is_owned = ptr_is_owned(obj);
29826         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29827         obj_conv.is_owned = false;
29828         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
29829         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29830         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29831         CVec_u8Z_free(ret_var);
29832         return ret_arr;
29833 }
29834
29835 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) {
29836         LDKChannelMonitor this_arg_conv;
29837         this_arg_conv.inner = untag_ptr(this_arg);
29838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29840         this_arg_conv.is_owned = false;
29841         LDKChannelMonitorUpdate updates_conv;
29842         updates_conv.inner = untag_ptr(updates);
29843         updates_conv.is_owned = ptr_is_owned(updates);
29844         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
29845         updates_conv.is_owned = false;
29846         void* broadcaster_ptr = untag_ptr(broadcaster);
29847         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
29848         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
29849         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29850         CHECK_ACCESS(fee_estimator_ptr);
29851         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29852         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29853                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29854                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29855         }
29856         void* logger_ptr = untag_ptr(logger);
29857         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
29858         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
29859         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
29860         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
29861         return tag_ptr(ret_conv, true);
29862 }
29863
29864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
29865         LDKChannelMonitor this_arg_conv;
29866         this_arg_conv.inner = untag_ptr(this_arg);
29867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29869         this_arg_conv.is_owned = false;
29870         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
29871         return ret_conv;
29872 }
29873
29874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
29875         LDKChannelMonitor this_arg_conv;
29876         this_arg_conv.inner = untag_ptr(this_arg);
29877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29879         this_arg_conv.is_owned = false;
29880         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
29881         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
29882         return tag_ptr(ret_conv, true);
29883 }
29884
29885 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
29886         LDKChannelMonitor this_arg_conv;
29887         this_arg_conv.inner = untag_ptr(this_arg);
29888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29890         this_arg_conv.is_owned = false;
29891         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
29892         int64_tArray ret_arr = NULL;
29893         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29894         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29895         for (size_t o = 0; o < ret_var.datalen; o++) {
29896                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
29897                 *ret_conv_40_conv = ret_var.data[o];
29898                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
29899         }
29900         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29901         FREE(ret_var.data);
29902         return ret_arr;
29903 }
29904
29905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
29906         LDKChannelMonitor this_arg_conv;
29907         this_arg_conv.inner = untag_ptr(this_arg);
29908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29910         this_arg_conv.is_owned = false;
29911         void* filter_ptr = untag_ptr(filter);
29912         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
29913         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
29914         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
29915 }
29916
29917 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
29918         LDKChannelMonitor this_arg_conv;
29919         this_arg_conv.inner = untag_ptr(this_arg);
29920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29922         this_arg_conv.is_owned = false;
29923         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
29924         int64_tArray ret_arr = NULL;
29925         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29926         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29927         for (size_t o = 0; o < ret_var.datalen; o++) {
29928                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
29929                 *ret_conv_14_copy = ret_var.data[o];
29930                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
29931                 ret_arr_ptr[o] = ret_conv_14_ref;
29932         }
29933         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29934         FREE(ret_var.data);
29935         return ret_arr;
29936 }
29937
29938 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
29939         LDKChannelMonitor this_arg_conv;
29940         this_arg_conv.inner = untag_ptr(this_arg);
29941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29943         this_arg_conv.is_owned = false;
29944         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
29945         int64_tArray ret_arr = NULL;
29946         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29947         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29948         for (size_t h = 0; h < ret_var.datalen; h++) {
29949                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
29950                 *ret_conv_7_copy = ret_var.data[h];
29951                 int64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
29952                 ret_arr_ptr[h] = ret_conv_7_ref;
29953         }
29954         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29955         FREE(ret_var.data);
29956         return ret_arr;
29957 }
29958
29959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
29960         LDKChannelMonitor this_arg_conv;
29961         this_arg_conv.inner = untag_ptr(this_arg);
29962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29964         this_arg_conv.is_owned = false;
29965         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29966         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
29967         return ret_arr;
29968 }
29969
29970 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) {
29971         LDKChannelMonitor this_arg_conv;
29972         this_arg_conv.inner = untag_ptr(this_arg);
29973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29975         this_arg_conv.is_owned = false;
29976         void* logger_ptr = untag_ptr(logger);
29977         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
29978         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
29979         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
29980         jobjectArray ret_arr = NULL;
29981         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
29982         ;
29983         for (size_t i = 0; i < ret_var.datalen; i++) {
29984                 LDKTransaction ret_conv_8_var = ret_var.data[i];
29985                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
29986                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
29987                 Transaction_free(ret_conv_8_var);
29988                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
29989         }
29990         
29991         FREE(ret_var.data);
29992         return ret_arr;
29993 }
29994
29995 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) {
29996         LDKChannelMonitor this_arg_conv;
29997         this_arg_conv.inner = untag_ptr(this_arg);
29998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30000         this_arg_conv.is_owned = false;
30001         uint8_t header_arr[80];
30002         CHECK((*env)->GetArrayLength(env, header) == 80);
30003         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
30004         uint8_t (*header_ref)[80] = &header_arr;
30005         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
30006         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
30007         if (txdata_constr.datalen > 0)
30008                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
30009         else
30010                 txdata_constr.data = NULL;
30011         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
30012         for (size_t c = 0; c < txdata_constr.datalen; c++) {
30013                 int64_t txdata_conv_28 = txdata_vals[c];
30014                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
30015                 CHECK_ACCESS(txdata_conv_28_ptr);
30016                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
30017                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
30018                 txdata_constr.data[c] = txdata_conv_28_conv;
30019         }
30020         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
30021         void* broadcaster_ptr = untag_ptr(broadcaster);
30022         CHECK_ACCESS(broadcaster_ptr);
30023         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30024         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30026                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30027         }
30028         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30029         CHECK_ACCESS(fee_estimator_ptr);
30030         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30031         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30033                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30034         }
30035         void* logger_ptr = untag_ptr(logger);
30036         CHECK_ACCESS(logger_ptr);
30037         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30038         if (logger_conv.free == LDKLogger_JCalls_free) {
30039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30040                 LDKLogger_JCalls_cloned(&logger_conv);
30041         }
30042         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);
30043         int64_tArray ret_arr = NULL;
30044         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30045         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30046         for (size_t n = 0; n < ret_var.datalen; n++) {
30047                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30048                 *ret_conv_39_conv = ret_var.data[n];
30049                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30050         }
30051         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30052         FREE(ret_var.data);
30053         return ret_arr;
30054 }
30055
30056 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) {
30057         LDKChannelMonitor this_arg_conv;
30058         this_arg_conv.inner = untag_ptr(this_arg);
30059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30061         this_arg_conv.is_owned = false;
30062         uint8_t header_arr[80];
30063         CHECK((*env)->GetArrayLength(env, header) == 80);
30064         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
30065         uint8_t (*header_ref)[80] = &header_arr;
30066         void* broadcaster_ptr = untag_ptr(broadcaster);
30067         CHECK_ACCESS(broadcaster_ptr);
30068         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30069         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30071                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30072         }
30073         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30074         CHECK_ACCESS(fee_estimator_ptr);
30075         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30076         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30078                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30079         }
30080         void* logger_ptr = untag_ptr(logger);
30081         CHECK_ACCESS(logger_ptr);
30082         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30083         if (logger_conv.free == LDKLogger_JCalls_free) {
30084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30085                 LDKLogger_JCalls_cloned(&logger_conv);
30086         }
30087         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30088 }
30089
30090 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) {
30091         LDKChannelMonitor this_arg_conv;
30092         this_arg_conv.inner = untag_ptr(this_arg);
30093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30095         this_arg_conv.is_owned = false;
30096         uint8_t header_arr[80];
30097         CHECK((*env)->GetArrayLength(env, header) == 80);
30098         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
30099         uint8_t (*header_ref)[80] = &header_arr;
30100         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
30101         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
30102         if (txdata_constr.datalen > 0)
30103                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
30104         else
30105                 txdata_constr.data = NULL;
30106         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
30107         for (size_t c = 0; c < txdata_constr.datalen; c++) {
30108                 int64_t txdata_conv_28 = txdata_vals[c];
30109                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
30110                 CHECK_ACCESS(txdata_conv_28_ptr);
30111                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
30112                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
30113                 txdata_constr.data[c] = txdata_conv_28_conv;
30114         }
30115         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
30116         void* broadcaster_ptr = untag_ptr(broadcaster);
30117         CHECK_ACCESS(broadcaster_ptr);
30118         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30119         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30120                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30121                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30122         }
30123         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30124         CHECK_ACCESS(fee_estimator_ptr);
30125         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30126         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30127                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30128                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30129         }
30130         void* logger_ptr = untag_ptr(logger);
30131         CHECK_ACCESS(logger_ptr);
30132         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30133         if (logger_conv.free == LDKLogger_JCalls_free) {
30134                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30135                 LDKLogger_JCalls_cloned(&logger_conv);
30136         }
30137         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);
30138         int64_tArray ret_arr = NULL;
30139         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30140         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30141         for (size_t n = 0; n < ret_var.datalen; n++) {
30142                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30143                 *ret_conv_39_conv = ret_var.data[n];
30144                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30145         }
30146         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30147         FREE(ret_var.data);
30148         return ret_arr;
30149 }
30150
30151 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) {
30152         LDKChannelMonitor this_arg_conv;
30153         this_arg_conv.inner = untag_ptr(this_arg);
30154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30156         this_arg_conv.is_owned = false;
30157         uint8_t txid_arr[32];
30158         CHECK((*env)->GetArrayLength(env, txid) == 32);
30159         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
30160         uint8_t (*txid_ref)[32] = &txid_arr;
30161         void* broadcaster_ptr = untag_ptr(broadcaster);
30162         CHECK_ACCESS(broadcaster_ptr);
30163         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30164         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30165                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30166                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30167         }
30168         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30169         CHECK_ACCESS(fee_estimator_ptr);
30170         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30171         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30172                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30173                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30174         }
30175         void* logger_ptr = untag_ptr(logger);
30176         CHECK_ACCESS(logger_ptr);
30177         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30178         if (logger_conv.free == LDKLogger_JCalls_free) {
30179                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30180                 LDKLogger_JCalls_cloned(&logger_conv);
30181         }
30182         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
30183 }
30184
30185 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) {
30186         LDKChannelMonitor this_arg_conv;
30187         this_arg_conv.inner = untag_ptr(this_arg);
30188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30190         this_arg_conv.is_owned = false;
30191         uint8_t header_arr[80];
30192         CHECK((*env)->GetArrayLength(env, header) == 80);
30193         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
30194         uint8_t (*header_ref)[80] = &header_arr;
30195         void* broadcaster_ptr = untag_ptr(broadcaster);
30196         CHECK_ACCESS(broadcaster_ptr);
30197         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30198         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30199                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30200                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30201         }
30202         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30203         CHECK_ACCESS(fee_estimator_ptr);
30204         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30205         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30206                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30207                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30208         }
30209         void* logger_ptr = untag_ptr(logger);
30210         CHECK_ACCESS(logger_ptr);
30211         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30212         if (logger_conv.free == LDKLogger_JCalls_free) {
30213                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30214                 LDKLogger_JCalls_cloned(&logger_conv);
30215         }
30216         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30217         int64_tArray ret_arr = NULL;
30218         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30219         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30220         for (size_t n = 0; n < ret_var.datalen; n++) {
30221                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30222                 *ret_conv_39_conv = ret_var.data[n];
30223                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30224         }
30225         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30226         FREE(ret_var.data);
30227         return ret_arr;
30228 }
30229
30230 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
30231         LDKChannelMonitor this_arg_conv;
30232         this_arg_conv.inner = untag_ptr(this_arg);
30233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30235         this_arg_conv.is_owned = false;
30236         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
30237         int64_tArray ret_arr = NULL;
30238         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30239         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30240         for (size_t z = 0; z < ret_var.datalen; z++) {
30241                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
30242                 *ret_conv_25_conv = ret_var.data[z];
30243                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
30244         }
30245         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30246         FREE(ret_var.data);
30247         return ret_arr;
30248 }
30249
30250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
30251         LDKChannelMonitor this_arg_conv;
30252         this_arg_conv.inner = untag_ptr(this_arg);
30253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30255         this_arg_conv.is_owned = false;
30256         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
30257         int64_t ret_ref = 0;
30258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30260         return ret_ref;
30261 }
30262
30263 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
30264         LDKChannelMonitor this_arg_conv;
30265         this_arg_conv.inner = untag_ptr(this_arg);
30266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30268         this_arg_conv.is_owned = false;
30269         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
30270         int64_tArray ret_arr = NULL;
30271         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30272         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30273         for (size_t j = 0; j < ret_var.datalen; j++) {
30274                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30275                 *ret_conv_9_copy = ret_var.data[j];
30276                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
30277                 ret_arr_ptr[j] = ret_conv_9_ref;
30278         }
30279         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30280         FREE(ret_var.data);
30281         return ret_arr;
30282 }
30283
30284 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) {
30285         LDKu8slice ser_ref;
30286         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30287         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30288         void* arg_a_ptr = untag_ptr(arg_a);
30289         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
30290         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
30291         void* arg_b_ptr = untag_ptr(arg_b);
30292         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
30293         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
30294         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
30295         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
30296         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30297         return tag_ptr(ret_conv, true);
30298 }
30299
30300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30301         LDKOutPoint this_obj_conv;
30302         this_obj_conv.inner = untag_ptr(this_obj);
30303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30305         OutPoint_free(this_obj_conv);
30306 }
30307
30308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
30309         LDKOutPoint this_ptr_conv;
30310         this_ptr_conv.inner = untag_ptr(this_ptr);
30311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30313         this_ptr_conv.is_owned = false;
30314         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30315         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
30316         return ret_arr;
30317 }
30318
30319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30320         LDKOutPoint this_ptr_conv;
30321         this_ptr_conv.inner = untag_ptr(this_ptr);
30322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30324         this_ptr_conv.is_owned = false;
30325         LDKThirtyTwoBytes val_ref;
30326         CHECK((*env)->GetArrayLength(env, val) == 32);
30327         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30328         OutPoint_set_txid(&this_ptr_conv, val_ref);
30329 }
30330
30331 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
30332         LDKOutPoint this_ptr_conv;
30333         this_ptr_conv.inner = untag_ptr(this_ptr);
30334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30336         this_ptr_conv.is_owned = false;
30337         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
30338         return ret_conv;
30339 }
30340
30341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30342         LDKOutPoint this_ptr_conv;
30343         this_ptr_conv.inner = untag_ptr(this_ptr);
30344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30346         this_ptr_conv.is_owned = false;
30347         OutPoint_set_index(&this_ptr_conv, val);
30348 }
30349
30350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
30351         LDKThirtyTwoBytes txid_arg_ref;
30352         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
30353         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
30354         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
30355         int64_t ret_ref = 0;
30356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30358         return ret_ref;
30359 }
30360
30361 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
30362         LDKOutPoint ret_var = OutPoint_clone(arg);
30363         int64_t ret_ref = 0;
30364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30366         return ret_ref;
30367 }
30368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30369         LDKOutPoint arg_conv;
30370         arg_conv.inner = untag_ptr(arg);
30371         arg_conv.is_owned = ptr_is_owned(arg);
30372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30373         arg_conv.is_owned = false;
30374         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
30375         return ret_conv;
30376 }
30377
30378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30379         LDKOutPoint orig_conv;
30380         orig_conv.inner = untag_ptr(orig);
30381         orig_conv.is_owned = ptr_is_owned(orig);
30382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30383         orig_conv.is_owned = false;
30384         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
30385         int64_t ret_ref = 0;
30386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30388         return ret_ref;
30389 }
30390
30391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30392         LDKOutPoint a_conv;
30393         a_conv.inner = untag_ptr(a);
30394         a_conv.is_owned = ptr_is_owned(a);
30395         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30396         a_conv.is_owned = false;
30397         LDKOutPoint b_conv;
30398         b_conv.inner = untag_ptr(b);
30399         b_conv.is_owned = ptr_is_owned(b);
30400         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30401         b_conv.is_owned = false;
30402         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
30403         return ret_conv;
30404 }
30405
30406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
30407         LDKOutPoint o_conv;
30408         o_conv.inner = untag_ptr(o);
30409         o_conv.is_owned = ptr_is_owned(o);
30410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30411         o_conv.is_owned = false;
30412         int64_t ret_conv = OutPoint_hash(&o_conv);
30413         return ret_conv;
30414 }
30415
30416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
30417         LDKOutPoint this_arg_conv;
30418         this_arg_conv.inner = untag_ptr(this_arg);
30419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30421         this_arg_conv.is_owned = false;
30422         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30423         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
30424         return ret_arr;
30425 }
30426
30427 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
30428         LDKOutPoint obj_conv;
30429         obj_conv.inner = untag_ptr(obj);
30430         obj_conv.is_owned = ptr_is_owned(obj);
30431         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30432         obj_conv.is_owned = false;
30433         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
30434         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30435         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30436         CVec_u8Z_free(ret_var);
30437         return ret_arr;
30438 }
30439
30440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30441         LDKu8slice ser_ref;
30442         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30443         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30444         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30445         *ret_conv = OutPoint_read(ser_ref);
30446         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30447         return tag_ptr(ret_conv, true);
30448 }
30449
30450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30451         LDKDelayedPaymentOutputDescriptor this_obj_conv;
30452         this_obj_conv.inner = untag_ptr(this_obj);
30453         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30455         DelayedPaymentOutputDescriptor_free(this_obj_conv);
30456 }
30457
30458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30459         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30460         this_ptr_conv.inner = untag_ptr(this_ptr);
30461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30463         this_ptr_conv.is_owned = false;
30464         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
30465         int64_t ret_ref = 0;
30466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30468         return ret_ref;
30469 }
30470
30471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30472         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30473         this_ptr_conv.inner = untag_ptr(this_ptr);
30474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30476         this_ptr_conv.is_owned = false;
30477         LDKOutPoint val_conv;
30478         val_conv.inner = untag_ptr(val);
30479         val_conv.is_owned = ptr_is_owned(val);
30480         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30481         val_conv = OutPoint_clone(&val_conv);
30482         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
30483 }
30484
30485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30486         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30487         this_ptr_conv.inner = untag_ptr(this_ptr);
30488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30490         this_ptr_conv.is_owned = false;
30491         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30492         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
30493         return ret_arr;
30494 }
30495
30496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30497         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30498         this_ptr_conv.inner = untag_ptr(this_ptr);
30499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30501         this_ptr_conv.is_owned = false;
30502         LDKPublicKey val_ref;
30503         CHECK((*env)->GetArrayLength(env, val) == 33);
30504         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30505         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
30506 }
30507
30508 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30509         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30510         this_ptr_conv.inner = untag_ptr(this_ptr);
30511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30513         this_ptr_conv.is_owned = false;
30514         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
30515         return ret_conv;
30516 }
30517
30518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30519         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30520         this_ptr_conv.inner = untag_ptr(this_ptr);
30521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30523         this_ptr_conv.is_owned = false;
30524         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
30525 }
30526
30527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
30528         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30529         this_ptr_conv.inner = untag_ptr(this_ptr);
30530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30532         this_ptr_conv.is_owned = false;
30533         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
30534         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
30535         return tag_ptr(ret_ref, true);
30536 }
30537
30538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30539         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30540         this_ptr_conv.inner = untag_ptr(this_ptr);
30541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30543         this_ptr_conv.is_owned = false;
30544         void* val_ptr = untag_ptr(val);
30545         CHECK_ACCESS(val_ptr);
30546         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
30547         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
30548         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
30549 }
30550
30551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30552         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30553         this_ptr_conv.inner = untag_ptr(this_ptr);
30554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30556         this_ptr_conv.is_owned = false;
30557         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30558         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
30559         return ret_arr;
30560 }
30561
30562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30563         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30564         this_ptr_conv.inner = untag_ptr(this_ptr);
30565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30567         this_ptr_conv.is_owned = false;
30568         LDKPublicKey val_ref;
30569         CHECK((*env)->GetArrayLength(env, val) == 33);
30570         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30571         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
30572 }
30573
30574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30575         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30576         this_ptr_conv.inner = untag_ptr(this_ptr);
30577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30579         this_ptr_conv.is_owned = false;
30580         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30581         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
30582         return ret_arr;
30583 }
30584
30585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30586         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30587         this_ptr_conv.inner = untag_ptr(this_ptr);
30588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30590         this_ptr_conv.is_owned = false;
30591         LDKThirtyTwoBytes val_ref;
30592         CHECK((*env)->GetArrayLength(env, val) == 32);
30593         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30594         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
30595 }
30596
30597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30598         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30599         this_ptr_conv.inner = untag_ptr(this_ptr);
30600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30602         this_ptr_conv.is_owned = false;
30603         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
30604         return ret_conv;
30605 }
30606
30607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30608         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
30609         this_ptr_conv.inner = untag_ptr(this_ptr);
30610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30612         this_ptr_conv.is_owned = false;
30613         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
30614 }
30615
30616 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) {
30617         LDKOutPoint outpoint_arg_conv;
30618         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
30619         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
30620         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
30621         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
30622         LDKPublicKey per_commitment_point_arg_ref;
30623         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
30624         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
30625         void* output_arg_ptr = untag_ptr(output_arg);
30626         CHECK_ACCESS(output_arg_ptr);
30627         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
30628         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
30629         LDKPublicKey revocation_pubkey_arg_ref;
30630         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
30631         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
30632         LDKThirtyTwoBytes channel_keys_id_arg_ref;
30633         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
30634         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
30635         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);
30636         int64_t ret_ref = 0;
30637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30639         return ret_ref;
30640 }
30641
30642 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
30643         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
30644         int64_t ret_ref = 0;
30645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30647         return ret_ref;
30648 }
30649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30650         LDKDelayedPaymentOutputDescriptor arg_conv;
30651         arg_conv.inner = untag_ptr(arg);
30652         arg_conv.is_owned = ptr_is_owned(arg);
30653         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30654         arg_conv.is_owned = false;
30655         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
30656         return ret_conv;
30657 }
30658
30659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30660         LDKDelayedPaymentOutputDescriptor orig_conv;
30661         orig_conv.inner = untag_ptr(orig);
30662         orig_conv.is_owned = ptr_is_owned(orig);
30663         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30664         orig_conv.is_owned = false;
30665         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
30666         int64_t ret_ref = 0;
30667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30669         return ret_ref;
30670 }
30671
30672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30673         LDKDelayedPaymentOutputDescriptor a_conv;
30674         a_conv.inner = untag_ptr(a);
30675         a_conv.is_owned = ptr_is_owned(a);
30676         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30677         a_conv.is_owned = false;
30678         LDKDelayedPaymentOutputDescriptor b_conv;
30679         b_conv.inner = untag_ptr(b);
30680         b_conv.is_owned = ptr_is_owned(b);
30681         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30682         b_conv.is_owned = false;
30683         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
30684         return ret_conv;
30685 }
30686
30687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
30688         LDKDelayedPaymentOutputDescriptor obj_conv;
30689         obj_conv.inner = untag_ptr(obj);
30690         obj_conv.is_owned = ptr_is_owned(obj);
30691         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30692         obj_conv.is_owned = false;
30693         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
30694         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30695         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30696         CVec_u8Z_free(ret_var);
30697         return ret_arr;
30698 }
30699
30700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30701         LDKu8slice ser_ref;
30702         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30703         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30704         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
30705         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
30706         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30707         return tag_ptr(ret_conv, true);
30708 }
30709
30710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30711         LDKStaticPaymentOutputDescriptor this_obj_conv;
30712         this_obj_conv.inner = untag_ptr(this_obj);
30713         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30715         StaticPaymentOutputDescriptor_free(this_obj_conv);
30716 }
30717
30718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30719         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30720         this_ptr_conv.inner = untag_ptr(this_ptr);
30721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30723         this_ptr_conv.is_owned = false;
30724         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
30725         int64_t ret_ref = 0;
30726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30728         return ret_ref;
30729 }
30730
30731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30732         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30733         this_ptr_conv.inner = untag_ptr(this_ptr);
30734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30736         this_ptr_conv.is_owned = false;
30737         LDKOutPoint val_conv;
30738         val_conv.inner = untag_ptr(val);
30739         val_conv.is_owned = ptr_is_owned(val);
30740         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30741         val_conv = OutPoint_clone(&val_conv);
30742         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
30743 }
30744
30745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
30746         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30747         this_ptr_conv.inner = untag_ptr(this_ptr);
30748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30750         this_ptr_conv.is_owned = false;
30751         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
30752         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
30753         return tag_ptr(ret_ref, true);
30754 }
30755
30756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30757         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30758         this_ptr_conv.inner = untag_ptr(this_ptr);
30759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30761         this_ptr_conv.is_owned = false;
30762         void* val_ptr = untag_ptr(val);
30763         CHECK_ACCESS(val_ptr);
30764         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
30765         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
30766         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
30767 }
30768
30769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30770         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30771         this_ptr_conv.inner = untag_ptr(this_ptr);
30772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30774         this_ptr_conv.is_owned = false;
30775         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30776         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
30777         return ret_arr;
30778 }
30779
30780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30781         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30782         this_ptr_conv.inner = untag_ptr(this_ptr);
30783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30785         this_ptr_conv.is_owned = false;
30786         LDKThirtyTwoBytes val_ref;
30787         CHECK((*env)->GetArrayLength(env, val) == 32);
30788         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30789         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
30790 }
30791
30792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30793         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30794         this_ptr_conv.inner = untag_ptr(this_ptr);
30795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30797         this_ptr_conv.is_owned = false;
30798         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
30799         return ret_conv;
30800 }
30801
30802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30803         LDKStaticPaymentOutputDescriptor this_ptr_conv;
30804         this_ptr_conv.inner = untag_ptr(this_ptr);
30805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30807         this_ptr_conv.is_owned = false;
30808         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
30809 }
30810
30811 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) {
30812         LDKOutPoint outpoint_arg_conv;
30813         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
30814         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
30815         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
30816         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
30817         void* output_arg_ptr = untag_ptr(output_arg);
30818         CHECK_ACCESS(output_arg_ptr);
30819         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
30820         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
30821         LDKThirtyTwoBytes channel_keys_id_arg_ref;
30822         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
30823         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
30824         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
30825         int64_t ret_ref = 0;
30826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30828         return ret_ref;
30829 }
30830
30831 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
30832         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
30833         int64_t ret_ref = 0;
30834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30836         return ret_ref;
30837 }
30838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30839         LDKStaticPaymentOutputDescriptor arg_conv;
30840         arg_conv.inner = untag_ptr(arg);
30841         arg_conv.is_owned = ptr_is_owned(arg);
30842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30843         arg_conv.is_owned = false;
30844         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
30845         return ret_conv;
30846 }
30847
30848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30849         LDKStaticPaymentOutputDescriptor orig_conv;
30850         orig_conv.inner = untag_ptr(orig);
30851         orig_conv.is_owned = ptr_is_owned(orig);
30852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30853         orig_conv.is_owned = false;
30854         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
30855         int64_t ret_ref = 0;
30856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30858         return ret_ref;
30859 }
30860
30861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30862         LDKStaticPaymentOutputDescriptor a_conv;
30863         a_conv.inner = untag_ptr(a);
30864         a_conv.is_owned = ptr_is_owned(a);
30865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30866         a_conv.is_owned = false;
30867         LDKStaticPaymentOutputDescriptor b_conv;
30868         b_conv.inner = untag_ptr(b);
30869         b_conv.is_owned = ptr_is_owned(b);
30870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30871         b_conv.is_owned = false;
30872         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
30873         return ret_conv;
30874 }
30875
30876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
30877         LDKStaticPaymentOutputDescriptor obj_conv;
30878         obj_conv.inner = untag_ptr(obj);
30879         obj_conv.is_owned = ptr_is_owned(obj);
30880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30881         obj_conv.is_owned = false;
30882         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
30883         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30884         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30885         CVec_u8Z_free(ret_var);
30886         return ret_arr;
30887 }
30888
30889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30890         LDKu8slice ser_ref;
30891         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30892         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30893         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
30894         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
30895         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30896         return tag_ptr(ret_conv, true);
30897 }
30898
30899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30900         if (!ptr_is_owned(this_ptr)) return;
30901         void* this_ptr_ptr = untag_ptr(this_ptr);
30902         CHECK_ACCESS(this_ptr_ptr);
30903         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
30904         FREE(untag_ptr(this_ptr));
30905         SpendableOutputDescriptor_free(this_ptr_conv);
30906 }
30907
30908 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
30909         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
30910         *ret_copy = SpendableOutputDescriptor_clone(arg);
30911         int64_t ret_ref = tag_ptr(ret_copy, true);
30912         return ret_ref;
30913 }
30914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30915         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
30916         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
30917         return ret_conv;
30918 }
30919
30920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30921         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
30922         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
30923         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
30924         int64_t ret_ref = tag_ptr(ret_copy, true);
30925         return ret_ref;
30926 }
30927
30928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
30929         LDKOutPoint outpoint_conv;
30930         outpoint_conv.inner = untag_ptr(outpoint);
30931         outpoint_conv.is_owned = ptr_is_owned(outpoint);
30932         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
30933         outpoint_conv = OutPoint_clone(&outpoint_conv);
30934         void* output_ptr = untag_ptr(output);
30935         CHECK_ACCESS(output_ptr);
30936         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
30937         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
30938         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
30939         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
30940         int64_t ret_ref = tag_ptr(ret_copy, true);
30941         return ret_ref;
30942 }
30943
30944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
30945         LDKDelayedPaymentOutputDescriptor a_conv;
30946         a_conv.inner = untag_ptr(a);
30947         a_conv.is_owned = ptr_is_owned(a);
30948         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30949         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
30950         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
30951         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
30952         int64_t ret_ref = tag_ptr(ret_copy, true);
30953         return ret_ref;
30954 }
30955
30956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
30957         LDKStaticPaymentOutputDescriptor a_conv;
30958         a_conv.inner = untag_ptr(a);
30959         a_conv.is_owned = ptr_is_owned(a);
30960         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30961         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
30962         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
30963         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
30964         int64_t ret_ref = tag_ptr(ret_copy, true);
30965         return ret_ref;
30966 }
30967
30968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30969         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
30970         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
30971         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
30972         return ret_conv;
30973 }
30974
30975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
30976         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
30977         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
30978         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30979         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30980         CVec_u8Z_free(ret_var);
30981         return ret_arr;
30982 }
30983
30984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30985         LDKu8slice ser_ref;
30986         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30987         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30988         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
30989         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
30990         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30991         return tag_ptr(ret_conv, true);
30992 }
30993
30994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30995         if (!ptr_is_owned(this_ptr)) return;
30996         void* this_ptr_ptr = untag_ptr(this_ptr);
30997         CHECK_ACCESS(this_ptr_ptr);
30998         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
30999         FREE(untag_ptr(this_ptr));
31000         ChannelSigner_free(this_ptr_conv);
31001 }
31002
31003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31004         if (!ptr_is_owned(this_ptr)) return;
31005         void* this_ptr_ptr = untag_ptr(this_ptr);
31006         CHECK_ACCESS(this_ptr_ptr);
31007         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
31008         FREE(untag_ptr(this_ptr));
31009         EcdsaChannelSigner_free(this_ptr_conv);
31010 }
31011
31012 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
31013         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
31014         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
31015         return tag_ptr(ret_ret, true);
31016 }
31017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31018         void* arg_ptr = untag_ptr(arg);
31019         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
31020         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
31021         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
31022         return ret_conv;
31023 }
31024
31025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31026         void* orig_ptr = untag_ptr(orig);
31027         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
31028         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
31029         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
31030         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
31031         return tag_ptr(ret_ret, true);
31032 }
31033
31034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31035         if (!ptr_is_owned(this_ptr)) return;
31036         void* this_ptr_ptr = untag_ptr(this_ptr);
31037         CHECK_ACCESS(this_ptr_ptr);
31038         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
31039         FREE(untag_ptr(this_ptr));
31040         WriteableEcdsaChannelSigner_free(this_ptr_conv);
31041 }
31042
31043 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31044         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
31045         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
31046         return ret_conv;
31047 }
31048
31049 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
31050         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
31051         return ret_conv;
31052 }
31053
31054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
31055         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
31056         return ret_conv;
31057 }
31058
31059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31060         if (!ptr_is_owned(this_ptr)) return;
31061         void* this_ptr_ptr = untag_ptr(this_ptr);
31062         CHECK_ACCESS(this_ptr_ptr);
31063         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
31064         FREE(untag_ptr(this_ptr));
31065         EntropySource_free(this_ptr_conv);
31066 }
31067
31068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31069         if (!ptr_is_owned(this_ptr)) return;
31070         void* this_ptr_ptr = untag_ptr(this_ptr);
31071         CHECK_ACCESS(this_ptr_ptr);
31072         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
31073         FREE(untag_ptr(this_ptr));
31074         NodeSigner_free(this_ptr_conv);
31075 }
31076
31077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31078         if (!ptr_is_owned(this_ptr)) return;
31079         void* this_ptr_ptr = untag_ptr(this_ptr);
31080         CHECK_ACCESS(this_ptr_ptr);
31081         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
31082         FREE(untag_ptr(this_ptr));
31083         SignerProvider_free(this_ptr_conv);
31084 }
31085
31086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31087         LDKInMemorySigner this_obj_conv;
31088         this_obj_conv.inner = untag_ptr(this_obj);
31089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31091         InMemorySigner_free(this_obj_conv);
31092 }
31093
31094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
31095         LDKInMemorySigner this_ptr_conv;
31096         this_ptr_conv.inner = untag_ptr(this_ptr);
31097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31099         this_ptr_conv.is_owned = false;
31100         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31101         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
31102         return ret_arr;
31103 }
31104
31105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31106         LDKInMemorySigner this_ptr_conv;
31107         this_ptr_conv.inner = untag_ptr(this_ptr);
31108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31110         this_ptr_conv.is_owned = false;
31111         LDKSecretKey val_ref;
31112         CHECK((*env)->GetArrayLength(env, val) == 32);
31113         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
31114         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
31115 }
31116
31117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
31118         LDKInMemorySigner this_ptr_conv;
31119         this_ptr_conv.inner = untag_ptr(this_ptr);
31120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31122         this_ptr_conv.is_owned = false;
31123         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31124         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
31125         return ret_arr;
31126 }
31127
31128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31129         LDKInMemorySigner this_ptr_conv;
31130         this_ptr_conv.inner = untag_ptr(this_ptr);
31131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31133         this_ptr_conv.is_owned = false;
31134         LDKSecretKey val_ref;
31135         CHECK((*env)->GetArrayLength(env, val) == 32);
31136         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
31137         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
31138 }
31139
31140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
31141         LDKInMemorySigner this_ptr_conv;
31142         this_ptr_conv.inner = untag_ptr(this_ptr);
31143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31145         this_ptr_conv.is_owned = false;
31146         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31147         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
31148         return ret_arr;
31149 }
31150
31151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31152         LDKInMemorySigner this_ptr_conv;
31153         this_ptr_conv.inner = untag_ptr(this_ptr);
31154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31156         this_ptr_conv.is_owned = false;
31157         LDKSecretKey val_ref;
31158         CHECK((*env)->GetArrayLength(env, val) == 32);
31159         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
31160         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
31161 }
31162
31163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
31164         LDKInMemorySigner this_ptr_conv;
31165         this_ptr_conv.inner = untag_ptr(this_ptr);
31166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31168         this_ptr_conv.is_owned = false;
31169         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31170         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
31171         return ret_arr;
31172 }
31173
31174 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) {
31175         LDKInMemorySigner this_ptr_conv;
31176         this_ptr_conv.inner = untag_ptr(this_ptr);
31177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31179         this_ptr_conv.is_owned = false;
31180         LDKSecretKey val_ref;
31181         CHECK((*env)->GetArrayLength(env, val) == 32);
31182         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
31183         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
31184 }
31185
31186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
31187         LDKInMemorySigner this_ptr_conv;
31188         this_ptr_conv.inner = untag_ptr(this_ptr);
31189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31191         this_ptr_conv.is_owned = false;
31192         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31193         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
31194         return ret_arr;
31195 }
31196
31197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31198         LDKInMemorySigner this_ptr_conv;
31199         this_ptr_conv.inner = untag_ptr(this_ptr);
31200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31202         this_ptr_conv.is_owned = false;
31203         LDKSecretKey val_ref;
31204         CHECK((*env)->GetArrayLength(env, val) == 32);
31205         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
31206         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
31207 }
31208
31209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
31210         LDKInMemorySigner this_ptr_conv;
31211         this_ptr_conv.inner = untag_ptr(this_ptr);
31212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31214         this_ptr_conv.is_owned = false;
31215         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31216         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
31217         return ret_arr;
31218 }
31219
31220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31221         LDKInMemorySigner this_ptr_conv;
31222         this_ptr_conv.inner = untag_ptr(this_ptr);
31223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31225         this_ptr_conv.is_owned = false;
31226         LDKThirtyTwoBytes val_ref;
31227         CHECK((*env)->GetArrayLength(env, val) == 32);
31228         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31229         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
31230 }
31231
31232 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
31233         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
31234         int64_t ret_ref = 0;
31235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31237         return ret_ref;
31238 }
31239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31240         LDKInMemorySigner arg_conv;
31241         arg_conv.inner = untag_ptr(arg);
31242         arg_conv.is_owned = ptr_is_owned(arg);
31243         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31244         arg_conv.is_owned = false;
31245         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
31246         return ret_conv;
31247 }
31248
31249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31250         LDKInMemorySigner orig_conv;
31251         orig_conv.inner = untag_ptr(orig);
31252         orig_conv.is_owned = ptr_is_owned(orig);
31253         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31254         orig_conv.is_owned = false;
31255         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
31256         int64_t ret_ref = 0;
31257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31259         return ret_ref;
31260 }
31261
31262 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) {
31263         LDKSecretKey funding_key_ref;
31264         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
31265         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
31266         LDKSecretKey revocation_base_key_ref;
31267         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
31268         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
31269         LDKSecretKey payment_key_ref;
31270         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
31271         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
31272         LDKSecretKey delayed_payment_base_key_ref;
31273         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
31274         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
31275         LDKSecretKey htlc_base_key_ref;
31276         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
31277         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
31278         LDKThirtyTwoBytes commitment_seed_ref;
31279         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
31280         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
31281         LDKThirtyTwoBytes channel_keys_id_ref;
31282         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
31283         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
31284         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);
31285         int64_t ret_ref = 0;
31286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31288         return ret_ref;
31289 }
31290
31291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
31292         LDKInMemorySigner this_arg_conv;
31293         this_arg_conv.inner = untag_ptr(this_arg);
31294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31296         this_arg_conv.is_owned = false;
31297         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
31298         int64_t ret_ref = 0;
31299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31301         return ret_ref;
31302 }
31303
31304 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
31305         LDKInMemorySigner this_arg_conv;
31306         this_arg_conv.inner = untag_ptr(this_arg);
31307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31309         this_arg_conv.is_owned = false;
31310         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
31311         return ret_conv;
31312 }
31313
31314 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
31315         LDKInMemorySigner this_arg_conv;
31316         this_arg_conv.inner = untag_ptr(this_arg);
31317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31319         this_arg_conv.is_owned = false;
31320         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
31321         return ret_conv;
31322 }
31323
31324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
31325         LDKInMemorySigner this_arg_conv;
31326         this_arg_conv.inner = untag_ptr(this_arg);
31327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31329         this_arg_conv.is_owned = false;
31330         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
31331         return ret_conv;
31332 }
31333
31334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
31335         LDKInMemorySigner this_arg_conv;
31336         this_arg_conv.inner = untag_ptr(this_arg);
31337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31339         this_arg_conv.is_owned = false;
31340         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
31341         int64_t ret_ref = 0;
31342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31344         return ret_ref;
31345 }
31346
31347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
31348         LDKInMemorySigner this_arg_conv;
31349         this_arg_conv.inner = untag_ptr(this_arg);
31350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31352         this_arg_conv.is_owned = false;
31353         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
31354         int64_t ret_ref = 0;
31355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31357         return ret_ref;
31358 }
31359
31360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
31361         LDKInMemorySigner this_arg_conv;
31362         this_arg_conv.inner = untag_ptr(this_arg);
31363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31365         this_arg_conv.is_owned = false;
31366         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
31367         return ret_conv;
31368 }
31369
31370 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) {
31371         LDKInMemorySigner this_arg_conv;
31372         this_arg_conv.inner = untag_ptr(this_arg);
31373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31375         this_arg_conv.is_owned = false;
31376         LDKTransaction spend_tx_ref;
31377         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
31378         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
31379         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
31380         spend_tx_ref.data_is_owned = true;
31381         LDKStaticPaymentOutputDescriptor descriptor_conv;
31382         descriptor_conv.inner = untag_ptr(descriptor);
31383         descriptor_conv.is_owned = ptr_is_owned(descriptor);
31384         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
31385         descriptor_conv.is_owned = false;
31386         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
31387         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
31388         return tag_ptr(ret_conv, true);
31389 }
31390
31391 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) {
31392         LDKInMemorySigner this_arg_conv;
31393         this_arg_conv.inner = untag_ptr(this_arg);
31394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31396         this_arg_conv.is_owned = false;
31397         LDKTransaction spend_tx_ref;
31398         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
31399         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
31400         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
31401         spend_tx_ref.data_is_owned = true;
31402         LDKDelayedPaymentOutputDescriptor descriptor_conv;
31403         descriptor_conv.inner = untag_ptr(descriptor);
31404         descriptor_conv.is_owned = ptr_is_owned(descriptor);
31405         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
31406         descriptor_conv.is_owned = false;
31407         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
31408         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
31409         return tag_ptr(ret_conv, true);
31410 }
31411
31412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
31413         LDKInMemorySigner this_arg_conv;
31414         this_arg_conv.inner = untag_ptr(this_arg);
31415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31417         this_arg_conv.is_owned = false;
31418         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
31419         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
31420         return tag_ptr(ret_ret, true);
31421 }
31422
31423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
31424         LDKInMemorySigner this_arg_conv;
31425         this_arg_conv.inner = untag_ptr(this_arg);
31426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31428         this_arg_conv.is_owned = false;
31429         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
31430         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
31431         return tag_ptr(ret_ret, true);
31432 }
31433
31434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
31435         LDKInMemorySigner this_arg_conv;
31436         this_arg_conv.inner = untag_ptr(this_arg);
31437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31439         this_arg_conv.is_owned = false;
31440         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
31441         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
31442         return tag_ptr(ret_ret, true);
31443 }
31444
31445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
31446         LDKInMemorySigner obj_conv;
31447         obj_conv.inner = untag_ptr(obj);
31448         obj_conv.is_owned = ptr_is_owned(obj);
31449         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31450         obj_conv.is_owned = false;
31451         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
31452         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31453         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31454         CVec_u8Z_free(ret_var);
31455         return ret_arr;
31456 }
31457
31458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31459         LDKu8slice ser_ref;
31460         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31461         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31462         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
31463         *ret_conv = InMemorySigner_read(ser_ref);
31464         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31465         return tag_ptr(ret_conv, true);
31466 }
31467
31468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31469         LDKKeysManager this_obj_conv;
31470         this_obj_conv.inner = untag_ptr(this_obj);
31471         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31473         KeysManager_free(this_obj_conv);
31474 }
31475
31476 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) {
31477         uint8_t seed_arr[32];
31478         CHECK((*env)->GetArrayLength(env, seed) == 32);
31479         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
31480         uint8_t (*seed_ref)[32] = &seed_arr;
31481         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
31482         int64_t ret_ref = 0;
31483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31485         return ret_ref;
31486 }
31487
31488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
31489         LDKKeysManager this_arg_conv;
31490         this_arg_conv.inner = untag_ptr(this_arg);
31491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31493         this_arg_conv.is_owned = false;
31494         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31495         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
31496         return ret_arr;
31497 }
31498
31499 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) {
31500         LDKKeysManager this_arg_conv;
31501         this_arg_conv.inner = untag_ptr(this_arg);
31502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31504         this_arg_conv.is_owned = false;
31505         uint8_t params_arr[32];
31506         CHECK((*env)->GetArrayLength(env, params) == 32);
31507         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
31508         uint8_t (*params_ref)[32] = &params_arr;
31509         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
31510         int64_t ret_ref = 0;
31511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31513         return ret_ref;
31514 }
31515
31516 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) {
31517         LDKKeysManager this_arg_conv;
31518         this_arg_conv.inner = untag_ptr(this_arg);
31519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31521         this_arg_conv.is_owned = false;
31522         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
31523         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
31524         if (descriptors_constr.datalen > 0)
31525                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
31526         else
31527                 descriptors_constr.data = NULL;
31528         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
31529         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
31530                 int64_t descriptors_conv_27 = descriptors_vals[b];
31531                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
31532                 CHECK_ACCESS(descriptors_conv_27_ptr);
31533                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
31534                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
31535                 descriptors_constr.data[b] = descriptors_conv_27_conv;
31536         }
31537         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
31538         LDKCVec_TxOutZ outputs_constr;
31539         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
31540         if (outputs_constr.datalen > 0)
31541                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
31542         else
31543                 outputs_constr.data = NULL;
31544         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
31545         for (size_t h = 0; h < outputs_constr.datalen; h++) {
31546                 int64_t outputs_conv_7 = outputs_vals[h];
31547                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
31548                 CHECK_ACCESS(outputs_conv_7_ptr);
31549                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
31550                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
31551                 outputs_constr.data[h] = outputs_conv_7_conv;
31552         }
31553         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
31554         LDKCVec_u8Z change_destination_script_ref;
31555         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
31556         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
31557         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
31558         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
31559         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
31560         return tag_ptr(ret_conv, true);
31561 }
31562
31563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
31564         LDKKeysManager this_arg_conv;
31565         this_arg_conv.inner = untag_ptr(this_arg);
31566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31568         this_arg_conv.is_owned = false;
31569         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
31570         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
31571         return tag_ptr(ret_ret, true);
31572 }
31573
31574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
31575         LDKKeysManager this_arg_conv;
31576         this_arg_conv.inner = untag_ptr(this_arg);
31577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31579         this_arg_conv.is_owned = false;
31580         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
31581         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
31582         return tag_ptr(ret_ret, true);
31583 }
31584
31585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31586         LDKKeysManager this_arg_conv;
31587         this_arg_conv.inner = untag_ptr(this_arg);
31588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31590         this_arg_conv.is_owned = false;
31591         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
31592         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
31593         return tag_ptr(ret_ret, true);
31594 }
31595
31596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31597         LDKPhantomKeysManager this_obj_conv;
31598         this_obj_conv.inner = untag_ptr(this_obj);
31599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31601         PhantomKeysManager_free(this_obj_conv);
31602 }
31603
31604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
31605         LDKPhantomKeysManager this_arg_conv;
31606         this_arg_conv.inner = untag_ptr(this_arg);
31607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31609         this_arg_conv.is_owned = false;
31610         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
31611         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
31612         return tag_ptr(ret_ret, true);
31613 }
31614
31615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
31616         LDKPhantomKeysManager this_arg_conv;
31617         this_arg_conv.inner = untag_ptr(this_arg);
31618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31620         this_arg_conv.is_owned = false;
31621         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
31622         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
31623         return tag_ptr(ret_ret, true);
31624 }
31625
31626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31627         LDKPhantomKeysManager this_arg_conv;
31628         this_arg_conv.inner = untag_ptr(this_arg);
31629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31631         this_arg_conv.is_owned = false;
31632         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
31633         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
31634         return tag_ptr(ret_ret, true);
31635 }
31636
31637 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) {
31638         uint8_t seed_arr[32];
31639         CHECK((*env)->GetArrayLength(env, seed) == 32);
31640         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
31641         uint8_t (*seed_ref)[32] = &seed_arr;
31642         uint8_t cross_node_seed_arr[32];
31643         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
31644         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
31645         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
31646         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
31647         int64_t ret_ref = 0;
31648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31650         return ret_ref;
31651 }
31652
31653 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) {
31654         LDKPhantomKeysManager this_arg_conv;
31655         this_arg_conv.inner = untag_ptr(this_arg);
31656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31658         this_arg_conv.is_owned = false;
31659         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
31660         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
31661         if (descriptors_constr.datalen > 0)
31662                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
31663         else
31664                 descriptors_constr.data = NULL;
31665         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
31666         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
31667                 int64_t descriptors_conv_27 = descriptors_vals[b];
31668                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
31669                 CHECK_ACCESS(descriptors_conv_27_ptr);
31670                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
31671                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
31672                 descriptors_constr.data[b] = descriptors_conv_27_conv;
31673         }
31674         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
31675         LDKCVec_TxOutZ outputs_constr;
31676         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
31677         if (outputs_constr.datalen > 0)
31678                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
31679         else
31680                 outputs_constr.data = NULL;
31681         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
31682         for (size_t h = 0; h < outputs_constr.datalen; h++) {
31683                 int64_t outputs_conv_7 = outputs_vals[h];
31684                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
31685                 CHECK_ACCESS(outputs_conv_7_ptr);
31686                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
31687                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
31688                 outputs_constr.data[h] = outputs_conv_7_conv;
31689         }
31690         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
31691         LDKCVec_u8Z change_destination_script_ref;
31692         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
31693         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
31694         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
31695         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
31696         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
31697         return tag_ptr(ret_conv, true);
31698 }
31699
31700 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) {
31701         LDKPhantomKeysManager this_arg_conv;
31702         this_arg_conv.inner = untag_ptr(this_arg);
31703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31705         this_arg_conv.is_owned = false;
31706         uint8_t params_arr[32];
31707         CHECK((*env)->GetArrayLength(env, params) == 32);
31708         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
31709         uint8_t (*params_ref)[32] = &params_arr;
31710         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
31711         int64_t ret_ref = 0;
31712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31714         return ret_ref;
31715 }
31716
31717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
31718         LDKPhantomKeysManager this_arg_conv;
31719         this_arg_conv.inner = untag_ptr(this_arg);
31720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31722         this_arg_conv.is_owned = false;
31723         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31724         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
31725         return ret_arr;
31726 }
31727
31728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
31729         LDKPhantomKeysManager this_arg_conv;
31730         this_arg_conv.inner = untag_ptr(this_arg);
31731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31733         this_arg_conv.is_owned = false;
31734         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31735         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
31736         return ret_arr;
31737 }
31738
31739 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31740         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
31741         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_clone(orig_conv));
31742         return ret_conv;
31743 }
31744
31745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
31746         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_temporary_node_failure());
31747         return ret_conv;
31748 }
31749
31750 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
31751         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_required_node_feature_missing());
31752         return ret_conv;
31753 }
31754
31755 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
31756         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_incorrect_or_unknown_payment_details());
31757         return ret_conv;
31758 }
31759
31760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31761         LDKChannelManager this_obj_conv;
31762         this_obj_conv.inner = untag_ptr(this_obj);
31763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31765         ChannelManager_free(this_obj_conv);
31766 }
31767
31768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31769         LDKChainParameters this_obj_conv;
31770         this_obj_conv.inner = untag_ptr(this_obj);
31771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31773         ChainParameters_free(this_obj_conv);
31774 }
31775
31776 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
31777         LDKChainParameters this_ptr_conv;
31778         this_ptr_conv.inner = untag_ptr(this_ptr);
31779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31781         this_ptr_conv.is_owned = false;
31782         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
31783         return ret_conv;
31784 }
31785
31786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
31787         LDKChainParameters this_ptr_conv;
31788         this_ptr_conv.inner = untag_ptr(this_ptr);
31789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31791         this_ptr_conv.is_owned = false;
31792         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
31793         ChainParameters_set_network(&this_ptr_conv, val_conv);
31794 }
31795
31796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
31797         LDKChainParameters this_ptr_conv;
31798         this_ptr_conv.inner = untag_ptr(this_ptr);
31799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31801         this_ptr_conv.is_owned = false;
31802         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
31803         int64_t ret_ref = 0;
31804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31806         return ret_ref;
31807 }
31808
31809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31810         LDKChainParameters this_ptr_conv;
31811         this_ptr_conv.inner = untag_ptr(this_ptr);
31812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31814         this_ptr_conv.is_owned = false;
31815         LDKBestBlock val_conv;
31816         val_conv.inner = untag_ptr(val);
31817         val_conv.is_owned = ptr_is_owned(val);
31818         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31819         val_conv = BestBlock_clone(&val_conv);
31820         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
31821 }
31822
31823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
31824         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
31825         LDKBestBlock best_block_arg_conv;
31826         best_block_arg_conv.inner = untag_ptr(best_block_arg);
31827         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
31828         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
31829         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
31830         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
31831         int64_t ret_ref = 0;
31832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31834         return ret_ref;
31835 }
31836
31837 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
31838         LDKChainParameters ret_var = ChainParameters_clone(arg);
31839         int64_t ret_ref = 0;
31840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31842         return ret_ref;
31843 }
31844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31845         LDKChainParameters arg_conv;
31846         arg_conv.inner = untag_ptr(arg);
31847         arg_conv.is_owned = ptr_is_owned(arg);
31848         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31849         arg_conv.is_owned = false;
31850         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
31851         return ret_conv;
31852 }
31853
31854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31855         LDKChainParameters orig_conv;
31856         orig_conv.inner = untag_ptr(orig);
31857         orig_conv.is_owned = ptr_is_owned(orig);
31858         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31859         orig_conv.is_owned = false;
31860         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
31861         int64_t ret_ref = 0;
31862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31864         return ret_ref;
31865 }
31866
31867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31868         LDKCounterpartyForwardingInfo this_obj_conv;
31869         this_obj_conv.inner = untag_ptr(this_obj);
31870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31872         CounterpartyForwardingInfo_free(this_obj_conv);
31873 }
31874
31875 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31876         LDKCounterpartyForwardingInfo this_ptr_conv;
31877         this_ptr_conv.inner = untag_ptr(this_ptr);
31878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31880         this_ptr_conv.is_owned = false;
31881         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
31882         return ret_conv;
31883 }
31884
31885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31886         LDKCounterpartyForwardingInfo this_ptr_conv;
31887         this_ptr_conv.inner = untag_ptr(this_ptr);
31888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31890         this_ptr_conv.is_owned = false;
31891         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
31892 }
31893
31894 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
31895         LDKCounterpartyForwardingInfo this_ptr_conv;
31896         this_ptr_conv.inner = untag_ptr(this_ptr);
31897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31899         this_ptr_conv.is_owned = false;
31900         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
31901         return ret_conv;
31902 }
31903
31904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31905         LDKCounterpartyForwardingInfo this_ptr_conv;
31906         this_ptr_conv.inner = untag_ptr(this_ptr);
31907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31909         this_ptr_conv.is_owned = false;
31910         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
31911 }
31912
31913 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
31914         LDKCounterpartyForwardingInfo this_ptr_conv;
31915         this_ptr_conv.inner = untag_ptr(this_ptr);
31916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31918         this_ptr_conv.is_owned = false;
31919         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
31920         return ret_conv;
31921 }
31922
31923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31924         LDKCounterpartyForwardingInfo this_ptr_conv;
31925         this_ptr_conv.inner = untag_ptr(this_ptr);
31926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31928         this_ptr_conv.is_owned = false;
31929         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
31930 }
31931
31932 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) {
31933         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
31934         int64_t ret_ref = 0;
31935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31937         return ret_ref;
31938 }
31939
31940 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
31941         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
31942         int64_t ret_ref = 0;
31943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31945         return ret_ref;
31946 }
31947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31948         LDKCounterpartyForwardingInfo arg_conv;
31949         arg_conv.inner = untag_ptr(arg);
31950         arg_conv.is_owned = ptr_is_owned(arg);
31951         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31952         arg_conv.is_owned = false;
31953         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
31954         return ret_conv;
31955 }
31956
31957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31958         LDKCounterpartyForwardingInfo orig_conv;
31959         orig_conv.inner = untag_ptr(orig);
31960         orig_conv.is_owned = ptr_is_owned(orig);
31961         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31962         orig_conv.is_owned = false;
31963         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
31964         int64_t ret_ref = 0;
31965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31967         return ret_ref;
31968 }
31969
31970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31971         LDKChannelCounterparty this_obj_conv;
31972         this_obj_conv.inner = untag_ptr(this_obj);
31973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31975         ChannelCounterparty_free(this_obj_conv);
31976 }
31977
31978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31979         LDKChannelCounterparty this_ptr_conv;
31980         this_ptr_conv.inner = untag_ptr(this_ptr);
31981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31983         this_ptr_conv.is_owned = false;
31984         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31985         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
31986         return ret_arr;
31987 }
31988
31989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31990         LDKChannelCounterparty this_ptr_conv;
31991         this_ptr_conv.inner = untag_ptr(this_ptr);
31992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31994         this_ptr_conv.is_owned = false;
31995         LDKPublicKey val_ref;
31996         CHECK((*env)->GetArrayLength(env, val) == 33);
31997         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31998         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
31999 }
32000
32001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
32002         LDKChannelCounterparty this_ptr_conv;
32003         this_ptr_conv.inner = untag_ptr(this_ptr);
32004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32006         this_ptr_conv.is_owned = false;
32007         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
32008         int64_t ret_ref = 0;
32009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32011         return ret_ref;
32012 }
32013
32014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32015         LDKChannelCounterparty this_ptr_conv;
32016         this_ptr_conv.inner = untag_ptr(this_ptr);
32017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32019         this_ptr_conv.is_owned = false;
32020         LDKInitFeatures val_conv;
32021         val_conv.inner = untag_ptr(val);
32022         val_conv.is_owned = ptr_is_owned(val);
32023         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32024         val_conv = InitFeatures_clone(&val_conv);
32025         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
32026 }
32027
32028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
32029         LDKChannelCounterparty this_ptr_conv;
32030         this_ptr_conv.inner = untag_ptr(this_ptr);
32031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32033         this_ptr_conv.is_owned = false;
32034         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
32035         return ret_conv;
32036 }
32037
32038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32039         LDKChannelCounterparty this_ptr_conv;
32040         this_ptr_conv.inner = untag_ptr(this_ptr);
32041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32043         this_ptr_conv.is_owned = false;
32044         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
32045 }
32046
32047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
32048         LDKChannelCounterparty this_ptr_conv;
32049         this_ptr_conv.inner = untag_ptr(this_ptr);
32050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32052         this_ptr_conv.is_owned = false;
32053         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
32054         int64_t ret_ref = 0;
32055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32057         return ret_ref;
32058 }
32059
32060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32061         LDKChannelCounterparty this_ptr_conv;
32062         this_ptr_conv.inner = untag_ptr(this_ptr);
32063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32065         this_ptr_conv.is_owned = false;
32066         LDKCounterpartyForwardingInfo val_conv;
32067         val_conv.inner = untag_ptr(val);
32068         val_conv.is_owned = ptr_is_owned(val);
32069         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32070         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
32071         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
32072 }
32073
32074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32075         LDKChannelCounterparty this_ptr_conv;
32076         this_ptr_conv.inner = untag_ptr(this_ptr);
32077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32079         this_ptr_conv.is_owned = false;
32080         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32081         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
32082         int64_t ret_ref = tag_ptr(ret_copy, true);
32083         return ret_ref;
32084 }
32085
32086 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) {
32087         LDKChannelCounterparty this_ptr_conv;
32088         this_ptr_conv.inner = untag_ptr(this_ptr);
32089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32091         this_ptr_conv.is_owned = false;
32092         void* val_ptr = untag_ptr(val);
32093         CHECK_ACCESS(val_ptr);
32094         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32095         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32096         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
32097 }
32098
32099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32100         LDKChannelCounterparty this_ptr_conv;
32101         this_ptr_conv.inner = untag_ptr(this_ptr);
32102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32104         this_ptr_conv.is_owned = false;
32105         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32106         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
32107         int64_t ret_ref = tag_ptr(ret_copy, true);
32108         return ret_ref;
32109 }
32110
32111 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) {
32112         LDKChannelCounterparty this_ptr_conv;
32113         this_ptr_conv.inner = untag_ptr(this_ptr);
32114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32116         this_ptr_conv.is_owned = false;
32117         void* val_ptr = untag_ptr(val);
32118         CHECK_ACCESS(val_ptr);
32119         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32120         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32121         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
32122 }
32123
32124 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) {
32125         LDKPublicKey node_id_arg_ref;
32126         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
32127         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
32128         LDKInitFeatures features_arg_conv;
32129         features_arg_conv.inner = untag_ptr(features_arg);
32130         features_arg_conv.is_owned = ptr_is_owned(features_arg);
32131         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32132         features_arg_conv = InitFeatures_clone(&features_arg_conv);
32133         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
32134         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
32135         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
32136         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
32137         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
32138         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
32139         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
32140         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
32141         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
32142         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
32143         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
32144         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
32145         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
32146         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);
32147         int64_t ret_ref = 0;
32148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32150         return ret_ref;
32151 }
32152
32153 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
32154         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
32155         int64_t ret_ref = 0;
32156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32158         return ret_ref;
32159 }
32160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32161         LDKChannelCounterparty arg_conv;
32162         arg_conv.inner = untag_ptr(arg);
32163         arg_conv.is_owned = ptr_is_owned(arg);
32164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32165         arg_conv.is_owned = false;
32166         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
32167         return ret_conv;
32168 }
32169
32170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32171         LDKChannelCounterparty orig_conv;
32172         orig_conv.inner = untag_ptr(orig);
32173         orig_conv.is_owned = ptr_is_owned(orig);
32174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32175         orig_conv.is_owned = false;
32176         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
32177         int64_t ret_ref = 0;
32178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32180         return ret_ref;
32181 }
32182
32183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32184         LDKChannelDetails this_obj_conv;
32185         this_obj_conv.inner = untag_ptr(this_obj);
32186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32188         ChannelDetails_free(this_obj_conv);
32189 }
32190
32191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32192         LDKChannelDetails this_ptr_conv;
32193         this_ptr_conv.inner = untag_ptr(this_ptr);
32194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32196         this_ptr_conv.is_owned = false;
32197         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32198         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
32199         return ret_arr;
32200 }
32201
32202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32203         LDKChannelDetails this_ptr_conv;
32204         this_ptr_conv.inner = untag_ptr(this_ptr);
32205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32207         this_ptr_conv.is_owned = false;
32208         LDKThirtyTwoBytes val_ref;
32209         CHECK((*env)->GetArrayLength(env, val) == 32);
32210         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32211         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
32212 }
32213
32214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
32215         LDKChannelDetails this_ptr_conv;
32216         this_ptr_conv.inner = untag_ptr(this_ptr);
32217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32219         this_ptr_conv.is_owned = false;
32220         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
32221         int64_t ret_ref = 0;
32222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32224         return ret_ref;
32225 }
32226
32227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32228         LDKChannelDetails this_ptr_conv;
32229         this_ptr_conv.inner = untag_ptr(this_ptr);
32230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32232         this_ptr_conv.is_owned = false;
32233         LDKChannelCounterparty val_conv;
32234         val_conv.inner = untag_ptr(val);
32235         val_conv.is_owned = ptr_is_owned(val);
32236         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32237         val_conv = ChannelCounterparty_clone(&val_conv);
32238         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
32239 }
32240
32241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
32242         LDKChannelDetails this_ptr_conv;
32243         this_ptr_conv.inner = untag_ptr(this_ptr);
32244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32246         this_ptr_conv.is_owned = false;
32247         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
32248         int64_t ret_ref = 0;
32249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32251         return ret_ref;
32252 }
32253
32254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32255         LDKChannelDetails this_ptr_conv;
32256         this_ptr_conv.inner = untag_ptr(this_ptr);
32257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32259         this_ptr_conv.is_owned = false;
32260         LDKOutPoint val_conv;
32261         val_conv.inner = untag_ptr(val);
32262         val_conv.is_owned = ptr_is_owned(val);
32263         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32264         val_conv = OutPoint_clone(&val_conv);
32265         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
32266 }
32267
32268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
32269         LDKChannelDetails this_ptr_conv;
32270         this_ptr_conv.inner = untag_ptr(this_ptr);
32271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32273         this_ptr_conv.is_owned = false;
32274         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
32275         int64_t ret_ref = 0;
32276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32278         return ret_ref;
32279 }
32280
32281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32282         LDKChannelDetails this_ptr_conv;
32283         this_ptr_conv.inner = untag_ptr(this_ptr);
32284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32286         this_ptr_conv.is_owned = false;
32287         LDKChannelTypeFeatures val_conv;
32288         val_conv.inner = untag_ptr(val);
32289         val_conv.is_owned = ptr_is_owned(val);
32290         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32291         val_conv = ChannelTypeFeatures_clone(&val_conv);
32292         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
32293 }
32294
32295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32296         LDKChannelDetails this_ptr_conv;
32297         this_ptr_conv.inner = untag_ptr(this_ptr);
32298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32300         this_ptr_conv.is_owned = false;
32301         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32302         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
32303         int64_t ret_ref = tag_ptr(ret_copy, true);
32304         return ret_ref;
32305 }
32306
32307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32308         LDKChannelDetails this_ptr_conv;
32309         this_ptr_conv.inner = untag_ptr(this_ptr);
32310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32312         this_ptr_conv.is_owned = false;
32313         void* val_ptr = untag_ptr(val);
32314         CHECK_ACCESS(val_ptr);
32315         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32316         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32317         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
32318 }
32319
32320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32321         LDKChannelDetails this_ptr_conv;
32322         this_ptr_conv.inner = untag_ptr(this_ptr);
32323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32325         this_ptr_conv.is_owned = false;
32326         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32327         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
32328         int64_t ret_ref = tag_ptr(ret_copy, true);
32329         return ret_ref;
32330 }
32331
32332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32333         LDKChannelDetails this_ptr_conv;
32334         this_ptr_conv.inner = untag_ptr(this_ptr);
32335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32337         this_ptr_conv.is_owned = false;
32338         void* val_ptr = untag_ptr(val);
32339         CHECK_ACCESS(val_ptr);
32340         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32341         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32342         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
32343 }
32344
32345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32346         LDKChannelDetails this_ptr_conv;
32347         this_ptr_conv.inner = untag_ptr(this_ptr);
32348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32350         this_ptr_conv.is_owned = false;
32351         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32352         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
32353         int64_t ret_ref = tag_ptr(ret_copy, true);
32354         return ret_ref;
32355 }
32356
32357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32358         LDKChannelDetails this_ptr_conv;
32359         this_ptr_conv.inner = untag_ptr(this_ptr);
32360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32362         this_ptr_conv.is_owned = false;
32363         void* val_ptr = untag_ptr(val);
32364         CHECK_ACCESS(val_ptr);
32365         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32366         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32367         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
32368 }
32369
32370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32371         LDKChannelDetails this_ptr_conv;
32372         this_ptr_conv.inner = untag_ptr(this_ptr);
32373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32375         this_ptr_conv.is_owned = false;
32376         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
32377         return ret_conv;
32378 }
32379
32380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32381         LDKChannelDetails this_ptr_conv;
32382         this_ptr_conv.inner = untag_ptr(this_ptr);
32383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32385         this_ptr_conv.is_owned = false;
32386         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
32387 }
32388
32389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
32390         LDKChannelDetails this_ptr_conv;
32391         this_ptr_conv.inner = untag_ptr(this_ptr);
32392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32394         this_ptr_conv.is_owned = false;
32395         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32396         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
32397         int64_t ret_ref = tag_ptr(ret_copy, true);
32398         return ret_ref;
32399 }
32400
32401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32402         LDKChannelDetails this_ptr_conv;
32403         this_ptr_conv.inner = untag_ptr(this_ptr);
32404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32406         this_ptr_conv.is_owned = false;
32407         void* val_ptr = untag_ptr(val);
32408         CHECK_ACCESS(val_ptr);
32409         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32410         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32411         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
32412 }
32413
32414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32415         LDKChannelDetails this_ptr_conv;
32416         this_ptr_conv.inner = untag_ptr(this_ptr);
32417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32419         this_ptr_conv.is_owned = false;
32420         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
32421         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
32422         return ret_arr;
32423 }
32424
32425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32426         LDKChannelDetails this_ptr_conv;
32427         this_ptr_conv.inner = untag_ptr(this_ptr);
32428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32430         this_ptr_conv.is_owned = false;
32431         LDKU128 val_ref;
32432         CHECK((*env)->GetArrayLength(env, val) == 16);
32433         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
32434         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
32435 }
32436
32437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32438         LDKChannelDetails this_ptr_conv;
32439         this_ptr_conv.inner = untag_ptr(this_ptr);
32440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32442         this_ptr_conv.is_owned = false;
32443         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
32444         return ret_conv;
32445 }
32446
32447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32448         LDKChannelDetails this_ptr_conv;
32449         this_ptr_conv.inner = untag_ptr(this_ptr);
32450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32452         this_ptr_conv.is_owned = false;
32453         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
32454 }
32455
32456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32457         LDKChannelDetails this_ptr_conv;
32458         this_ptr_conv.inner = untag_ptr(this_ptr);
32459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32461         this_ptr_conv.is_owned = false;
32462         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
32463         return ret_conv;
32464 }
32465
32466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32467         LDKChannelDetails this_ptr_conv;
32468         this_ptr_conv.inner = untag_ptr(this_ptr);
32469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32471         this_ptr_conv.is_owned = false;
32472         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
32473 }
32474
32475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32476         LDKChannelDetails this_ptr_conv;
32477         this_ptr_conv.inner = untag_ptr(this_ptr);
32478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32480         this_ptr_conv.is_owned = false;
32481         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
32482         return ret_conv;
32483 }
32484
32485 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) {
32486         LDKChannelDetails this_ptr_conv;
32487         this_ptr_conv.inner = untag_ptr(this_ptr);
32488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32490         this_ptr_conv.is_owned = false;
32491         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
32492 }
32493
32494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32495         LDKChannelDetails this_ptr_conv;
32496         this_ptr_conv.inner = untag_ptr(this_ptr);
32497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32499         this_ptr_conv.is_owned = false;
32500         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
32501         return ret_conv;
32502 }
32503
32504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32505         LDKChannelDetails this_ptr_conv;
32506         this_ptr_conv.inner = untag_ptr(this_ptr);
32507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32509         this_ptr_conv.is_owned = false;
32510         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
32511 }
32512
32513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
32514         LDKChannelDetails this_ptr_conv;
32515         this_ptr_conv.inner = untag_ptr(this_ptr);
32516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32518         this_ptr_conv.is_owned = false;
32519         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
32520         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
32521         int64_t ret_ref = tag_ptr(ret_copy, true);
32522         return ret_ref;
32523 }
32524
32525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32526         LDKChannelDetails this_ptr_conv;
32527         this_ptr_conv.inner = untag_ptr(this_ptr);
32528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32530         this_ptr_conv.is_owned = false;
32531         void* val_ptr = untag_ptr(val);
32532         CHECK_ACCESS(val_ptr);
32533         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
32534         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
32535         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
32536 }
32537
32538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
32539         LDKChannelDetails this_ptr_conv;
32540         this_ptr_conv.inner = untag_ptr(this_ptr);
32541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32543         this_ptr_conv.is_owned = false;
32544         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
32545         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
32546         int64_t ret_ref = tag_ptr(ret_copy, true);
32547         return ret_ref;
32548 }
32549
32550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32551         LDKChannelDetails this_ptr_conv;
32552         this_ptr_conv.inner = untag_ptr(this_ptr);
32553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32555         this_ptr_conv.is_owned = false;
32556         void* val_ptr = untag_ptr(val);
32557         CHECK_ACCESS(val_ptr);
32558         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
32559         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
32560         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
32561 }
32562
32563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
32564         LDKChannelDetails this_ptr_conv;
32565         this_ptr_conv.inner = untag_ptr(this_ptr);
32566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32568         this_ptr_conv.is_owned = false;
32569         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
32570         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
32571         int64_t ret_ref = tag_ptr(ret_copy, true);
32572         return ret_ref;
32573 }
32574
32575 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) {
32576         LDKChannelDetails this_ptr_conv;
32577         this_ptr_conv.inner = untag_ptr(this_ptr);
32578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32580         this_ptr_conv.is_owned = false;
32581         void* val_ptr = untag_ptr(val);
32582         CHECK_ACCESS(val_ptr);
32583         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
32584         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
32585         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
32586 }
32587
32588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
32589         LDKChannelDetails this_ptr_conv;
32590         this_ptr_conv.inner = untag_ptr(this_ptr);
32591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32593         this_ptr_conv.is_owned = false;
32594         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
32595         return ret_conv;
32596 }
32597
32598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
32599         LDKChannelDetails this_ptr_conv;
32600         this_ptr_conv.inner = untag_ptr(this_ptr);
32601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32603         this_ptr_conv.is_owned = false;
32604         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
32605 }
32606
32607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
32608         LDKChannelDetails this_ptr_conv;
32609         this_ptr_conv.inner = untag_ptr(this_ptr);
32610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32612         this_ptr_conv.is_owned = false;
32613         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
32614         return ret_conv;
32615 }
32616
32617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
32618         LDKChannelDetails this_ptr_conv;
32619         this_ptr_conv.inner = untag_ptr(this_ptr);
32620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32622         this_ptr_conv.is_owned = false;
32623         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
32624 }
32625
32626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
32627         LDKChannelDetails this_ptr_conv;
32628         this_ptr_conv.inner = untag_ptr(this_ptr);
32629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32631         this_ptr_conv.is_owned = false;
32632         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
32633         return ret_conv;
32634 }
32635
32636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
32637         LDKChannelDetails this_ptr_conv;
32638         this_ptr_conv.inner = untag_ptr(this_ptr);
32639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32641         this_ptr_conv.is_owned = false;
32642         ChannelDetails_set_is_usable(&this_ptr_conv, val);
32643 }
32644
32645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
32646         LDKChannelDetails this_ptr_conv;
32647         this_ptr_conv.inner = untag_ptr(this_ptr);
32648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32650         this_ptr_conv.is_owned = false;
32651         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
32652         return ret_conv;
32653 }
32654
32655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
32656         LDKChannelDetails this_ptr_conv;
32657         this_ptr_conv.inner = untag_ptr(this_ptr);
32658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32660         this_ptr_conv.is_owned = false;
32661         ChannelDetails_set_is_public(&this_ptr_conv, val);
32662 }
32663
32664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32665         LDKChannelDetails 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32671         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
32672         int64_t ret_ref = tag_ptr(ret_copy, true);
32673         return ret_ref;
32674 }
32675
32676 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) {
32677         LDKChannelDetails this_ptr_conv;
32678         this_ptr_conv.inner = untag_ptr(this_ptr);
32679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32681         this_ptr_conv.is_owned = false;
32682         void* val_ptr = untag_ptr(val);
32683         CHECK_ACCESS(val_ptr);
32684         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32685         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32686         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
32687 }
32688
32689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32690         LDKChannelDetails this_ptr_conv;
32691         this_ptr_conv.inner = untag_ptr(this_ptr);
32692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32694         this_ptr_conv.is_owned = false;
32695         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32696         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
32697         int64_t ret_ref = tag_ptr(ret_copy, true);
32698         return ret_ref;
32699 }
32700
32701 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) {
32702         LDKChannelDetails this_ptr_conv;
32703         this_ptr_conv.inner = untag_ptr(this_ptr);
32704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32706         this_ptr_conv.is_owned = false;
32707         void* val_ptr = untag_ptr(val);
32708         CHECK_ACCESS(val_ptr);
32709         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32710         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32711         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
32712 }
32713
32714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
32715         LDKChannelDetails this_ptr_conv;
32716         this_ptr_conv.inner = untag_ptr(this_ptr);
32717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32719         this_ptr_conv.is_owned = false;
32720         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
32721         int64_t ret_ref = 0;
32722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32724         return ret_ref;
32725 }
32726
32727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32728         LDKChannelDetails this_ptr_conv;
32729         this_ptr_conv.inner = untag_ptr(this_ptr);
32730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32732         this_ptr_conv.is_owned = false;
32733         LDKChannelConfig val_conv;
32734         val_conv.inner = untag_ptr(val);
32735         val_conv.is_owned = ptr_is_owned(val);
32736         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32737         val_conv = ChannelConfig_clone(&val_conv);
32738         ChannelDetails_set_config(&this_ptr_conv, val_conv);
32739 }
32740
32741 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 balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_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, 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) {
32742         LDKThirtyTwoBytes channel_id_arg_ref;
32743         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32744         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32745         LDKChannelCounterparty counterparty_arg_conv;
32746         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
32747         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
32748         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
32749         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
32750         LDKOutPoint funding_txo_arg_conv;
32751         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
32752         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
32753         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
32754         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
32755         LDKChannelTypeFeatures channel_type_arg_conv;
32756         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
32757         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
32758         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
32759         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
32760         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
32761         CHECK_ACCESS(short_channel_id_arg_ptr);
32762         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
32763         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
32764         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
32765         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
32766         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
32767         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
32768         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
32769         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
32770         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
32771         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
32772         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
32773         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
32774         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
32775         LDKU128 user_channel_id_arg_ref;
32776         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
32777         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
32778         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
32779         CHECK_ACCESS(confirmations_required_arg_ptr);
32780         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
32781         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
32782         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
32783         CHECK_ACCESS(confirmations_arg_ptr);
32784         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
32785         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
32786         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
32787         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
32788         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
32789         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
32790         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
32791         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
32792         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
32793         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
32794         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
32795         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
32796         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
32797         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
32798         LDKChannelConfig config_arg_conv;
32799         config_arg_conv.inner = untag_ptr(config_arg);
32800         config_arg_conv.is_owned = ptr_is_owned(config_arg);
32801         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
32802         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
32803         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, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_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, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
32804         int64_t ret_ref = 0;
32805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32807         return ret_ref;
32808 }
32809
32810 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
32811         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
32812         int64_t ret_ref = 0;
32813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32815         return ret_ref;
32816 }
32817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32818         LDKChannelDetails arg_conv;
32819         arg_conv.inner = untag_ptr(arg);
32820         arg_conv.is_owned = ptr_is_owned(arg);
32821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32822         arg_conv.is_owned = false;
32823         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
32824         return ret_conv;
32825 }
32826
32827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32828         LDKChannelDetails orig_conv;
32829         orig_conv.inner = untag_ptr(orig);
32830         orig_conv.is_owned = ptr_is_owned(orig);
32831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32832         orig_conv.is_owned = false;
32833         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
32834         int64_t ret_ref = 0;
32835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32837         return ret_ref;
32838 }
32839
32840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
32841         LDKChannelDetails this_arg_conv;
32842         this_arg_conv.inner = untag_ptr(this_arg);
32843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32845         this_arg_conv.is_owned = false;
32846         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32847         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
32848         int64_t ret_ref = tag_ptr(ret_copy, true);
32849         return ret_ref;
32850 }
32851
32852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
32853         LDKChannelDetails this_arg_conv;
32854         this_arg_conv.inner = untag_ptr(this_arg);
32855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32857         this_arg_conv.is_owned = false;
32858         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32859         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
32860         int64_t ret_ref = tag_ptr(ret_copy, true);
32861         return ret_ref;
32862 }
32863
32864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32865         if (!ptr_is_owned(this_ptr)) return;
32866         void* this_ptr_ptr = untag_ptr(this_ptr);
32867         CHECK_ACCESS(this_ptr_ptr);
32868         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
32869         FREE(untag_ptr(this_ptr));
32870         RecentPaymentDetails_free(this_ptr_conv);
32871 }
32872
32873 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
32874         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32875         *ret_copy = RecentPaymentDetails_clone(arg);
32876         int64_t ret_ref = tag_ptr(ret_copy, true);
32877         return ret_ref;
32878 }
32879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32880         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
32881         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
32882         return ret_conv;
32883 }
32884
32885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32886         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
32887         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32888         *ret_copy = RecentPaymentDetails_clone(orig_conv);
32889         int64_t ret_ref = tag_ptr(ret_copy, true);
32890         return ret_ref;
32891 }
32892
32893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t total_msat) {
32894         LDKThirtyTwoBytes payment_hash_ref;
32895         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
32896         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
32897         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32898         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
32899         int64_t ret_ref = tag_ptr(ret_copy, true);
32900         return ret_ref;
32901 }
32902
32903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
32904         LDKThirtyTwoBytes payment_hash_ref;
32905         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
32906         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
32907         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32908         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref);
32909         int64_t ret_ref = tag_ptr(ret_copy, true);
32910         return ret_ref;
32911 }
32912
32913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
32914         LDKThirtyTwoBytes payment_hash_ref;
32915         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
32916         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
32917         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32918         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
32919         int64_t ret_ref = tag_ptr(ret_copy, true);
32920         return ret_ref;
32921 }
32922
32923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32924         LDKPhantomRouteHints this_obj_conv;
32925         this_obj_conv.inner = untag_ptr(this_obj);
32926         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32928         PhantomRouteHints_free(this_obj_conv);
32929 }
32930
32931 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
32932         LDKPhantomRouteHints this_ptr_conv;
32933         this_ptr_conv.inner = untag_ptr(this_ptr);
32934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32936         this_ptr_conv.is_owned = false;
32937         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
32938         int64_tArray ret_arr = NULL;
32939         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
32940         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
32941         for (size_t q = 0; q < ret_var.datalen; q++) {
32942                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32943                 int64_t ret_conv_16_ref = 0;
32944                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32945                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32946                 ret_arr_ptr[q] = ret_conv_16_ref;
32947         }
32948         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
32949         FREE(ret_var.data);
32950         return ret_arr;
32951 }
32952
32953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
32954         LDKPhantomRouteHints this_ptr_conv;
32955         this_ptr_conv.inner = untag_ptr(this_ptr);
32956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32958         this_ptr_conv.is_owned = false;
32959         LDKCVec_ChannelDetailsZ val_constr;
32960         val_constr.datalen = (*env)->GetArrayLength(env, val);
32961         if (val_constr.datalen > 0)
32962                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
32963         else
32964                 val_constr.data = NULL;
32965         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32966         for (size_t q = 0; q < val_constr.datalen; q++) {
32967                 int64_t val_conv_16 = val_vals[q];
32968                 LDKChannelDetails val_conv_16_conv;
32969                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
32970                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
32971                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32972                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
32973                 val_constr.data[q] = val_conv_16_conv;
32974         }
32975         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32976         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
32977 }
32978
32979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
32980         LDKPhantomRouteHints this_ptr_conv;
32981         this_ptr_conv.inner = untag_ptr(this_ptr);
32982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32984         this_ptr_conv.is_owned = false;
32985         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
32986         return ret_conv;
32987 }
32988
32989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32990         LDKPhantomRouteHints this_ptr_conv;
32991         this_ptr_conv.inner = untag_ptr(this_ptr);
32992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32994         this_ptr_conv.is_owned = false;
32995         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
32996 }
32997
32998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32999         LDKPhantomRouteHints this_ptr_conv;
33000         this_ptr_conv.inner = untag_ptr(this_ptr);
33001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33003         this_ptr_conv.is_owned = false;
33004         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33005         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
33006         return ret_arr;
33007 }
33008
33009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33010         LDKPhantomRouteHints this_ptr_conv;
33011         this_ptr_conv.inner = untag_ptr(this_ptr);
33012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33014         this_ptr_conv.is_owned = false;
33015         LDKPublicKey val_ref;
33016         CHECK((*env)->GetArrayLength(env, val) == 33);
33017         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33018         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
33019 }
33020
33021 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) {
33022         LDKCVec_ChannelDetailsZ channels_arg_constr;
33023         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
33024         if (channels_arg_constr.datalen > 0)
33025                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
33026         else
33027                 channels_arg_constr.data = NULL;
33028         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
33029         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
33030                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
33031                 LDKChannelDetails channels_arg_conv_16_conv;
33032                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
33033                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
33034                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
33035                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
33036                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
33037         }
33038         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
33039         LDKPublicKey real_node_pubkey_arg_ref;
33040         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
33041         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
33042         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
33043         int64_t ret_ref = 0;
33044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33046         return ret_ref;
33047 }
33048
33049 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
33050         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
33051         int64_t ret_ref = 0;
33052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33054         return ret_ref;
33055 }
33056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33057         LDKPhantomRouteHints arg_conv;
33058         arg_conv.inner = untag_ptr(arg);
33059         arg_conv.is_owned = ptr_is_owned(arg);
33060         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33061         arg_conv.is_owned = false;
33062         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
33063         return ret_conv;
33064 }
33065
33066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33067         LDKPhantomRouteHints orig_conv;
33068         orig_conv.inner = untag_ptr(orig);
33069         orig_conv.is_owned = ptr_is_owned(orig);
33070         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33071         orig_conv.is_owned = false;
33072         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
33073         int64_t ret_ref = 0;
33074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33076         return ret_ref;
33077 }
33078
33079 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) {
33080         void* fee_est_ptr = untag_ptr(fee_est);
33081         CHECK_ACCESS(fee_est_ptr);
33082         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
33083         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
33084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33085                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
33086         }
33087         void* chain_monitor_ptr = untag_ptr(chain_monitor);
33088         CHECK_ACCESS(chain_monitor_ptr);
33089         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
33090         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
33091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33092                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
33093         }
33094         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
33095         CHECK_ACCESS(tx_broadcaster_ptr);
33096         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
33097         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
33098                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33099                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
33100         }
33101         void* router_ptr = untag_ptr(router);
33102         CHECK_ACCESS(router_ptr);
33103         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
33104         if (router_conv.free == LDKRouter_JCalls_free) {
33105                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33106                 LDKRouter_JCalls_cloned(&router_conv);
33107         }
33108         void* logger_ptr = untag_ptr(logger);
33109         CHECK_ACCESS(logger_ptr);
33110         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33111         if (logger_conv.free == LDKLogger_JCalls_free) {
33112                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33113                 LDKLogger_JCalls_cloned(&logger_conv);
33114         }
33115         void* entropy_source_ptr = untag_ptr(entropy_source);
33116         CHECK_ACCESS(entropy_source_ptr);
33117         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
33118         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
33119                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33120                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
33121         }
33122         void* node_signer_ptr = untag_ptr(node_signer);
33123         CHECK_ACCESS(node_signer_ptr);
33124         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
33125         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
33126                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33127                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
33128         }
33129         void* signer_provider_ptr = untag_ptr(signer_provider);
33130         CHECK_ACCESS(signer_provider_ptr);
33131         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
33132         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
33133                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33134                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
33135         }
33136         LDKUserConfig config_conv;
33137         config_conv.inner = untag_ptr(config);
33138         config_conv.is_owned = ptr_is_owned(config);
33139         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
33140         config_conv = UserConfig_clone(&config_conv);
33141         LDKChainParameters params_conv;
33142         params_conv.inner = untag_ptr(params);
33143         params_conv.is_owned = ptr_is_owned(params);
33144         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
33145         params_conv = ChainParameters_clone(&params_conv);
33146         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);
33147         int64_t ret_ref = 0;
33148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33150         return ret_ref;
33151 }
33152
33153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
33154         LDKChannelManager this_arg_conv;
33155         this_arg_conv.inner = untag_ptr(this_arg);
33156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33158         this_arg_conv.is_owned = false;
33159         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
33160         int64_t ret_ref = 0;
33161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33163         return ret_ref;
33164 }
33165
33166 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) {
33167         LDKChannelManager this_arg_conv;
33168         this_arg_conv.inner = untag_ptr(this_arg);
33169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33171         this_arg_conv.is_owned = false;
33172         LDKPublicKey their_network_key_ref;
33173         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
33174         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
33175         LDKU128 user_channel_id_ref;
33176         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
33177         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
33178         LDKUserConfig override_config_conv;
33179         override_config_conv.inner = untag_ptr(override_config);
33180         override_config_conv.is_owned = ptr_is_owned(override_config);
33181         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
33182         override_config_conv = UserConfig_clone(&override_config_conv);
33183         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
33184         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
33185         return tag_ptr(ret_conv, true);
33186 }
33187
33188 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
33189         LDKChannelManager this_arg_conv;
33190         this_arg_conv.inner = untag_ptr(this_arg);
33191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33193         this_arg_conv.is_owned = false;
33194         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
33195         int64_tArray ret_arr = NULL;
33196         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33197         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33198         for (size_t q = 0; q < ret_var.datalen; q++) {
33199                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
33200                 int64_t ret_conv_16_ref = 0;
33201                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
33202                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
33203                 ret_arr_ptr[q] = ret_conv_16_ref;
33204         }
33205         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33206         FREE(ret_var.data);
33207         return ret_arr;
33208 }
33209
33210 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
33211         LDKChannelManager this_arg_conv;
33212         this_arg_conv.inner = untag_ptr(this_arg);
33213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33215         this_arg_conv.is_owned = false;
33216         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
33217         int64_tArray ret_arr = NULL;
33218         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33219         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33220         for (size_t q = 0; q < ret_var.datalen; q++) {
33221                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
33222                 int64_t ret_conv_16_ref = 0;
33223                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
33224                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
33225                 ret_arr_ptr[q] = ret_conv_16_ref;
33226         }
33227         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33228         FREE(ret_var.data);
33229         return ret_arr;
33230 }
33231
33232 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
33233         LDKChannelManager this_arg_conv;
33234         this_arg_conv.inner = untag_ptr(this_arg);
33235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33237         this_arg_conv.is_owned = false;
33238         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
33239         int64_tArray ret_arr = NULL;
33240         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33241         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33242         for (size_t w = 0; w < ret_var.datalen; w++) {
33243                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
33244                 *ret_conv_22_copy = ret_var.data[w];
33245                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
33246                 ret_arr_ptr[w] = ret_conv_22_ref;
33247         }
33248         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33249         FREE(ret_var.data);
33250         return ret_arr;
33251 }
33252
33253 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) {
33254         LDKChannelManager this_arg_conv;
33255         this_arg_conv.inner = untag_ptr(this_arg);
33256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33258         this_arg_conv.is_owned = false;
33259         uint8_t channel_id_arr[32];
33260         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
33261         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
33262         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
33263         LDKPublicKey counterparty_node_id_ref;
33264         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33265         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33266         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33267         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
33268         return tag_ptr(ret_conv, true);
33269 }
33270
33271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int32_t target_feerate_sats_per_1000_weight) {
33272         LDKChannelManager this_arg_conv;
33273         this_arg_conv.inner = untag_ptr(this_arg);
33274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33276         this_arg_conv.is_owned = false;
33277         uint8_t channel_id_arr[32];
33278         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
33279         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
33280         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
33281         LDKPublicKey counterparty_node_id_ref;
33282         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33283         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33284         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33285         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
33286         return tag_ptr(ret_conv, true);
33287 }
33288
33289 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) {
33290         LDKChannelManager this_arg_conv;
33291         this_arg_conv.inner = untag_ptr(this_arg);
33292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33294         this_arg_conv.is_owned = false;
33295         uint8_t channel_id_arr[32];
33296         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
33297         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
33298         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
33299         LDKPublicKey counterparty_node_id_ref;
33300         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33301         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33302         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33303         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
33304         return tag_ptr(ret_conv, true);
33305 }
33306
33307 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) {
33308         LDKChannelManager this_arg_conv;
33309         this_arg_conv.inner = untag_ptr(this_arg);
33310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33312         this_arg_conv.is_owned = false;
33313         uint8_t channel_id_arr[32];
33314         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
33315         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
33316         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
33317         LDKPublicKey counterparty_node_id_ref;
33318         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33319         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33320         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33321         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
33322         return tag_ptr(ret_conv, true);
33323 }
33324
33325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
33326         LDKChannelManager this_arg_conv;
33327         this_arg_conv.inner = untag_ptr(this_arg);
33328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33330         this_arg_conv.is_owned = false;
33331         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
33332 }
33333
33334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
33335         LDKChannelManager this_arg_conv;
33336         this_arg_conv.inner = untag_ptr(this_arg);
33337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33339         this_arg_conv.is_owned = false;
33340         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
33341 }
33342
33343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id) {
33344         LDKChannelManager this_arg_conv;
33345         this_arg_conv.inner = untag_ptr(this_arg);
33346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33348         this_arg_conv.is_owned = false;
33349         LDKRoute route_conv;
33350         route_conv.inner = untag_ptr(route);
33351         route_conv.is_owned = ptr_is_owned(route);
33352         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
33353         route_conv.is_owned = false;
33354         LDKThirtyTwoBytes payment_hash_ref;
33355         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33356         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
33357         LDKThirtyTwoBytes payment_secret_ref;
33358         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
33359         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
33360         LDKThirtyTwoBytes payment_id_ref;
33361         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
33362         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
33363         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
33364         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref);
33365         return tag_ptr(ret_conv, true);
33366 }
33367
33368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
33369         LDKChannelManager this_arg_conv;
33370         this_arg_conv.inner = untag_ptr(this_arg);
33371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33373         this_arg_conv.is_owned = false;
33374         LDKThirtyTwoBytes payment_hash_ref;
33375         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33376         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
33377         LDKThirtyTwoBytes payment_secret_ref;
33378         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
33379         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
33380         LDKThirtyTwoBytes payment_id_ref;
33381         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
33382         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
33383         LDKRouteParameters route_params_conv;
33384         route_params_conv.inner = untag_ptr(route_params);
33385         route_params_conv.is_owned = ptr_is_owned(route_params);
33386         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
33387         route_params_conv = RouteParameters_clone(&route_params_conv);
33388         void* retry_strategy_ptr = untag_ptr(retry_strategy);
33389         CHECK_ACCESS(retry_strategy_ptr);
33390         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
33391         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
33392         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
33393         *ret_conv = ChannelManager_send_payment_with_retry(&this_arg_conv, payment_hash_ref, payment_secret_ref, payment_id_ref, route_params_conv, retry_strategy_conv);
33394         return tag_ptr(ret_conv, true);
33395 }
33396
33397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
33398         LDKChannelManager this_arg_conv;
33399         this_arg_conv.inner = untag_ptr(this_arg);
33400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33402         this_arg_conv.is_owned = false;
33403         LDKThirtyTwoBytes payment_id_ref;
33404         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
33405         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
33406         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
33407 }
33408
33409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage, int8_tArray payment_id) {
33410         LDKChannelManager this_arg_conv;
33411         this_arg_conv.inner = untag_ptr(this_arg);
33412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33414         this_arg_conv.is_owned = false;
33415         LDKRoute route_conv;
33416         route_conv.inner = untag_ptr(route);
33417         route_conv.is_owned = ptr_is_owned(route);
33418         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
33419         route_conv.is_owned = false;
33420         LDKThirtyTwoBytes payment_preimage_ref;
33421         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
33422         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
33423         LDKThirtyTwoBytes payment_id_ref;
33424         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
33425         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
33426         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
33427         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, payment_id_ref);
33428         return tag_ptr(ret_conv, true);
33429 }
33430
33431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
33432         LDKChannelManager this_arg_conv;
33433         this_arg_conv.inner = untag_ptr(this_arg);
33434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33436         this_arg_conv.is_owned = false;
33437         LDKThirtyTwoBytes payment_preimage_ref;
33438         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
33439         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
33440         LDKThirtyTwoBytes payment_id_ref;
33441         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
33442         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
33443         LDKRouteParameters route_params_conv;
33444         route_params_conv.inner = untag_ptr(route_params);
33445         route_params_conv.is_owned = ptr_is_owned(route_params);
33446         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
33447         route_params_conv = RouteParameters_clone(&route_params_conv);
33448         void* retry_strategy_ptr = untag_ptr(retry_strategy);
33449         CHECK_ACCESS(retry_strategy_ptr);
33450         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
33451         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
33452         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
33453         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_ref, payment_id_ref, route_params_conv, retry_strategy_conv);
33454         return tag_ptr(ret_conv, true);
33455 }
33456
33457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) {
33458         LDKChannelManager this_arg_conv;
33459         this_arg_conv.inner = untag_ptr(this_arg);
33460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33462         this_arg_conv.is_owned = false;
33463         LDKCVec_RouteHopZ hops_constr;
33464         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
33465         if (hops_constr.datalen > 0)
33466                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33467         else
33468                 hops_constr.data = NULL;
33469         int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
33470         for (size_t k = 0; k < hops_constr.datalen; k++) {
33471                 int64_t hops_conv_10 = hops_vals[k];
33472                 LDKRouteHop hops_conv_10_conv;
33473                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
33474                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
33475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
33476                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
33477                 hops_constr.data[k] = hops_conv_10_conv;
33478         }
33479         (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
33480         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
33481         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
33482         return tag_ptr(ret_conv, true);
33483 }
33484
33485 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) {
33486         LDKChannelManager this_arg_conv;
33487         this_arg_conv.inner = untag_ptr(this_arg);
33488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33490         this_arg_conv.is_owned = false;
33491         uint8_t temporary_channel_id_arr[32];
33492         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
33493         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
33494         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33495         LDKPublicKey counterparty_node_id_ref;
33496         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33497         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33498         LDKTransaction funding_transaction_ref;
33499         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
33500         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
33501         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
33502         funding_transaction_ref.data_is_owned = true;
33503         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33504         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
33505         return tag_ptr(ret_conv, true);
33506 }
33507
33508 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) {
33509         LDKChannelManager this_arg_conv;
33510         this_arg_conv.inner = untag_ptr(this_arg);
33511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33513         this_arg_conv.is_owned = false;
33514         LDKPublicKey counterparty_node_id_ref;
33515         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33516         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33517         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
33518         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
33519         if (channel_ids_constr.datalen > 0)
33520                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
33521         else
33522                 channel_ids_constr.data = NULL;
33523         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
33524                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
33525                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
33526                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
33527                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
33528                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
33529         }
33530         LDKChannelConfig config_conv;
33531         config_conv.inner = untag_ptr(config);
33532         config_conv.is_owned = ptr_is_owned(config);
33533         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
33534         config_conv.is_owned = false;
33535         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33536         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
33537         return tag_ptr(ret_conv, true);
33538 }
33539
33540 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) {
33541         LDKChannelManager this_arg_conv;
33542         this_arg_conv.inner = untag_ptr(this_arg);
33543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33545         this_arg_conv.is_owned = false;
33546         LDKThirtyTwoBytes intercept_id_ref;
33547         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
33548         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
33549         uint8_t next_hop_channel_id_arr[32];
33550         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
33551         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
33552         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
33553         LDKPublicKey next_node_id_ref;
33554         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
33555         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
33556         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33557         *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);
33558         return tag_ptr(ret_conv, true);
33559 }
33560
33561 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) {
33562         LDKChannelManager this_arg_conv;
33563         this_arg_conv.inner = untag_ptr(this_arg);
33564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33566         this_arg_conv.is_owned = false;
33567         LDKThirtyTwoBytes intercept_id_ref;
33568         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
33569         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
33570         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33571         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
33572         return tag_ptr(ret_conv, true);
33573 }
33574
33575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
33576         LDKChannelManager this_arg_conv;
33577         this_arg_conv.inner = untag_ptr(this_arg);
33578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33580         this_arg_conv.is_owned = false;
33581         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
33582 }
33583
33584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
33585         LDKChannelManager this_arg_conv;
33586         this_arg_conv.inner = untag_ptr(this_arg);
33587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33589         this_arg_conv.is_owned = false;
33590         ChannelManager_timer_tick_occurred(&this_arg_conv);
33591 }
33592
33593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
33594         LDKChannelManager this_arg_conv;
33595         this_arg_conv.inner = untag_ptr(this_arg);
33596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33598         this_arg_conv.is_owned = false;
33599         uint8_t payment_hash_arr[32];
33600         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33601         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
33602         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
33603         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
33604 }
33605
33606 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) {
33607         LDKChannelManager this_arg_conv;
33608         this_arg_conv.inner = untag_ptr(this_arg);
33609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33611         this_arg_conv.is_owned = false;
33612         uint8_t payment_hash_arr[32];
33613         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33614         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
33615         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
33616         LDKFailureCode failure_code_conv = LDKFailureCode_from_java(env, failure_code);
33617         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
33618 }
33619
33620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
33621         LDKChannelManager this_arg_conv;
33622         this_arg_conv.inner = untag_ptr(this_arg);
33623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33625         this_arg_conv.is_owned = false;
33626         LDKThirtyTwoBytes payment_preimage_ref;
33627         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
33628         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
33629         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
33630 }
33631
33632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
33633         LDKChannelManager this_arg_conv;
33634         this_arg_conv.inner = untag_ptr(this_arg);
33635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33637         this_arg_conv.is_owned = false;
33638         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33639         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
33640         return ret_arr;
33641 }
33642
33643 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) {
33644         LDKChannelManager this_arg_conv;
33645         this_arg_conv.inner = untag_ptr(this_arg);
33646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33648         this_arg_conv.is_owned = false;
33649         uint8_t temporary_channel_id_arr[32];
33650         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
33651         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
33652         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33653         LDKPublicKey counterparty_node_id_ref;
33654         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33655         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33656         LDKU128 user_channel_id_ref;
33657         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
33658         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
33659         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33660         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
33661         return tag_ptr(ret_conv, true);
33662 }
33663
33664 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) {
33665         LDKChannelManager this_arg_conv;
33666         this_arg_conv.inner = untag_ptr(this_arg);
33667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33669         this_arg_conv.is_owned = false;
33670         uint8_t temporary_channel_id_arr[32];
33671         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
33672         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
33673         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33674         LDKPublicKey counterparty_node_id_ref;
33675         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
33676         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
33677         LDKU128 user_channel_id_ref;
33678         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
33679         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
33680         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33681         *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);
33682         return tag_ptr(ret_conv, true);
33683 }
33684
33685 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) {
33686         LDKChannelManager this_arg_conv;
33687         this_arg_conv.inner = untag_ptr(this_arg);
33688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33690         this_arg_conv.is_owned = false;
33691         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33692         CHECK_ACCESS(min_value_msat_ptr);
33693         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33694         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33695         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
33696         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
33697         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
33698         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
33699         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
33700         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
33701         return tag_ptr(ret_conv, true);
33702 }
33703
33704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
33705         LDKChannelManager this_arg_conv;
33706         this_arg_conv.inner = untag_ptr(this_arg);
33707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33709         this_arg_conv.is_owned = false;
33710         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33711         CHECK_ACCESS(min_value_msat_ptr);
33712         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33713         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33714         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
33715         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
33716         return tag_ptr(ret_conv, true);
33717 }
33718
33719 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) {
33720         LDKChannelManager this_arg_conv;
33721         this_arg_conv.inner = untag_ptr(this_arg);
33722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33724         this_arg_conv.is_owned = false;
33725         LDKThirtyTwoBytes payment_hash_ref;
33726         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33727         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
33728         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33729         CHECK_ACCESS(min_value_msat_ptr);
33730         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33731         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33732         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
33733         CHECK_ACCESS(min_final_cltv_expiry_ptr);
33734         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
33735         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
33736         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
33737         *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);
33738         return tag_ptr(ret_conv, true);
33739 }
33740
33741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
33742         LDKChannelManager this_arg_conv;
33743         this_arg_conv.inner = untag_ptr(this_arg);
33744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33746         this_arg_conv.is_owned = false;
33747         LDKThirtyTwoBytes payment_hash_ref;
33748         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33749         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
33750         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33751         CHECK_ACCESS(min_value_msat_ptr);
33752         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33753         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33754         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
33755         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
33756         return tag_ptr(ret_conv, true);
33757 }
33758
33759 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) {
33760         LDKChannelManager this_arg_conv;
33761         this_arg_conv.inner = untag_ptr(this_arg);
33762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33764         this_arg_conv.is_owned = false;
33765         LDKThirtyTwoBytes payment_hash_ref;
33766         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33767         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
33768         LDKThirtyTwoBytes payment_secret_ref;
33769         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
33770         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
33771         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
33772         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
33773         return tag_ptr(ret_conv, true);
33774 }
33775
33776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
33777         LDKChannelManager this_arg_conv;
33778         this_arg_conv.inner = untag_ptr(this_arg);
33779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33781         this_arg_conv.is_owned = false;
33782         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
33783         return ret_conv;
33784 }
33785
33786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
33787         LDKChannelManager this_arg_conv;
33788         this_arg_conv.inner = untag_ptr(this_arg);
33789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33791         this_arg_conv.is_owned = false;
33792         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
33793         int64_t ret_ref = 0;
33794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33796         return ret_ref;
33797 }
33798
33799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
33800         LDKChannelManager this_arg_conv;
33801         this_arg_conv.inner = untag_ptr(this_arg);
33802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33804         this_arg_conv.is_owned = false;
33805         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
33806         return ret_conv;
33807 }
33808
33809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
33810         LDKChannelManager this_arg_conv;
33811         this_arg_conv.inner = untag_ptr(this_arg);
33812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33814         this_arg_conv.is_owned = false;
33815         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
33816         int64_t ret_ref = 0;
33817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33819         return ret_ref;
33820 }
33821
33822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
33823         LDKChannelManager this_arg_conv;
33824         this_arg_conv.inner = untag_ptr(this_arg);
33825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33827         this_arg_conv.is_owned = false;
33828         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33829         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
33830         return tag_ptr(ret_ret, true);
33831 }
33832
33833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
33834         LDKChannelManager this_arg_conv;
33835         this_arg_conv.inner = untag_ptr(this_arg);
33836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33838         this_arg_conv.is_owned = false;
33839         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
33840         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
33841         return tag_ptr(ret_ret, true);
33842 }
33843
33844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
33845         LDKChannelManager this_arg_conv;
33846         this_arg_conv.inner = untag_ptr(this_arg);
33847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33849         this_arg_conv.is_owned = false;
33850         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
33851         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
33852         return tag_ptr(ret_ret, true);
33853 }
33854
33855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
33856         LDKChannelManager this_arg_conv;
33857         this_arg_conv.inner = untag_ptr(this_arg);
33858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33860         this_arg_conv.is_owned = false;
33861         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
33862         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
33863         return tag_ptr(ret_ret, true);
33864 }
33865
33866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
33867         LDKChannelManager this_arg_conv;
33868         this_arg_conv.inner = untag_ptr(this_arg);
33869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33871         this_arg_conv.is_owned = false;
33872         jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
33873         return ret_conv;
33874 }
33875
33876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
33877         LDKChannelManager this_arg_conv;
33878         this_arg_conv.inner = untag_ptr(this_arg);
33879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33881         this_arg_conv.is_owned = false;
33882         ChannelManager_await_persistable_update(&this_arg_conv);
33883 }
33884
33885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1persistable_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
33886         LDKChannelManager this_arg_conv;
33887         this_arg_conv.inner = untag_ptr(this_arg);
33888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33890         this_arg_conv.is_owned = false;
33891         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
33892         int64_t ret_ref = 0;
33893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33895         return ret_ref;
33896 }
33897
33898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
33899         LDKChannelManager this_arg_conv;
33900         this_arg_conv.inner = untag_ptr(this_arg);
33901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33903         this_arg_conv.is_owned = false;
33904         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
33905         int64_t ret_ref = 0;
33906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33908         return ret_ref;
33909 }
33910
33911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
33912         LDKChannelManager this_arg_conv;
33913         this_arg_conv.inner = untag_ptr(this_arg);
33914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33916         this_arg_conv.is_owned = false;
33917         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
33918         int64_t ret_ref = 0;
33919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33921         return ret_ref;
33922 }
33923
33924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
33925         LDKChannelManager this_arg_conv;
33926         this_arg_conv.inner = untag_ptr(this_arg);
33927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33929         this_arg_conv.is_owned = false;
33930         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
33931         int64_t ret_ref = 0;
33932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33934         return ret_ref;
33935 }
33936
33937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
33938         LDKChannelManager this_arg_conv;
33939         this_arg_conv.inner = untag_ptr(this_arg);
33940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33942         this_arg_conv.is_owned = false;
33943         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
33944         int64_t ret_ref = 0;
33945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33947         return ret_ref;
33948 }
33949
33950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
33951         LDKChannelManager this_arg_conv;
33952         this_arg_conv.inner = untag_ptr(this_arg);
33953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33955         this_arg_conv.is_owned = false;
33956         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
33957         int64_t ret_ref = 0;
33958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33960         return ret_ref;
33961 }
33962
33963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
33964         LDKChannelManager this_arg_conv;
33965         this_arg_conv.inner = untag_ptr(this_arg);
33966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33968         this_arg_conv.is_owned = false;
33969         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33970         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
33971         return tag_ptr(ret_ret, true);
33972 }
33973
33974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t _config) {
33975         LDKUserConfig _config_conv;
33976         _config_conv.inner = untag_ptr(_config);
33977         _config_conv.is_owned = ptr_is_owned(_config);
33978         CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv);
33979         _config_conv.is_owned = false;
33980         LDKInitFeatures ret_var = provided_init_features(&_config_conv);
33981         int64_t ret_ref = 0;
33982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33984         return ret_ref;
33985 }
33986
33987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
33988         LDKCounterpartyForwardingInfo obj_conv;
33989         obj_conv.inner = untag_ptr(obj);
33990         obj_conv.is_owned = ptr_is_owned(obj);
33991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33992         obj_conv.is_owned = false;
33993         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
33994         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33995         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33996         CVec_u8Z_free(ret_var);
33997         return ret_arr;
33998 }
33999
34000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34001         LDKu8slice ser_ref;
34002         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34003         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34004         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
34005         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
34006         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34007         return tag_ptr(ret_conv, true);
34008 }
34009
34010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
34011         LDKChannelCounterparty obj_conv;
34012         obj_conv.inner = untag_ptr(obj);
34013         obj_conv.is_owned = ptr_is_owned(obj);
34014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34015         obj_conv.is_owned = false;
34016         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
34017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34019         CVec_u8Z_free(ret_var);
34020         return ret_arr;
34021 }
34022
34023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34024         LDKu8slice ser_ref;
34025         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34026         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34027         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
34028         *ret_conv = ChannelCounterparty_read(ser_ref);
34029         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34030         return tag_ptr(ret_conv, true);
34031 }
34032
34033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
34034         LDKChannelDetails obj_conv;
34035         obj_conv.inner = untag_ptr(obj);
34036         obj_conv.is_owned = ptr_is_owned(obj);
34037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34038         obj_conv.is_owned = false;
34039         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
34040         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34041         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34042         CVec_u8Z_free(ret_var);
34043         return ret_arr;
34044 }
34045
34046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34047         LDKu8slice ser_ref;
34048         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34049         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34050         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
34051         *ret_conv = ChannelDetails_read(ser_ref);
34052         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34053         return tag_ptr(ret_conv, true);
34054 }
34055
34056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
34057         LDKPhantomRouteHints obj_conv;
34058         obj_conv.inner = untag_ptr(obj);
34059         obj_conv.is_owned = ptr_is_owned(obj);
34060         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34061         obj_conv.is_owned = false;
34062         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
34063         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34064         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34065         CVec_u8Z_free(ret_var);
34066         return ret_arr;
34067 }
34068
34069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34070         LDKu8slice ser_ref;
34071         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34072         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34073         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
34074         *ret_conv = PhantomRouteHints_read(ser_ref);
34075         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34076         return tag_ptr(ret_conv, true);
34077 }
34078
34079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
34080         LDKChannelManager obj_conv;
34081         obj_conv.inner = untag_ptr(obj);
34082         obj_conv.is_owned = ptr_is_owned(obj);
34083         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34084         obj_conv.is_owned = false;
34085         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
34086         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34087         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34088         CVec_u8Z_free(ret_var);
34089         return ret_arr;
34090 }
34091
34092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34093         LDKChannelManagerReadArgs this_obj_conv;
34094         this_obj_conv.inner = untag_ptr(this_obj);
34095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34097         ChannelManagerReadArgs_free(this_obj_conv);
34098 }
34099
34100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
34101         LDKChannelManagerReadArgs this_ptr_conv;
34102         this_ptr_conv.inner = untag_ptr(this_ptr);
34103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34105         this_ptr_conv.is_owned = false;
34106         // WARNING: This object doesn't live past this scope, needs clone!
34107         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
34108         return ret_ret;
34109 }
34110
34111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34112         LDKChannelManagerReadArgs this_ptr_conv;
34113         this_ptr_conv.inner = untag_ptr(this_ptr);
34114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34116         this_ptr_conv.is_owned = false;
34117         void* val_ptr = untag_ptr(val);
34118         CHECK_ACCESS(val_ptr);
34119         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
34120         if (val_conv.free == LDKEntropySource_JCalls_free) {
34121                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34122                 LDKEntropySource_JCalls_cloned(&val_conv);
34123         }
34124         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
34125 }
34126
34127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
34128         LDKChannelManagerReadArgs this_ptr_conv;
34129         this_ptr_conv.inner = untag_ptr(this_ptr);
34130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34132         this_ptr_conv.is_owned = false;
34133         // WARNING: This object doesn't live past this scope, needs clone!
34134         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
34135         return ret_ret;
34136 }
34137
34138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34139         LDKChannelManagerReadArgs 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         void* val_ptr = untag_ptr(val);
34145         CHECK_ACCESS(val_ptr);
34146         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
34147         if (val_conv.free == LDKNodeSigner_JCalls_free) {
34148                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34149                 LDKNodeSigner_JCalls_cloned(&val_conv);
34150         }
34151         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
34152 }
34153
34154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
34155         LDKChannelManagerReadArgs this_ptr_conv;
34156         this_ptr_conv.inner = untag_ptr(this_ptr);
34157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34159         this_ptr_conv.is_owned = false;
34160         // WARNING: This object doesn't live past this scope, needs clone!
34161         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
34162         return ret_ret;
34163 }
34164
34165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34166         LDKChannelManagerReadArgs this_ptr_conv;
34167         this_ptr_conv.inner = untag_ptr(this_ptr);
34168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34170         this_ptr_conv.is_owned = false;
34171         void* val_ptr = untag_ptr(val);
34172         CHECK_ACCESS(val_ptr);
34173         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
34174         if (val_conv.free == LDKSignerProvider_JCalls_free) {
34175                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34176                 LDKSignerProvider_JCalls_cloned(&val_conv);
34177         }
34178         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
34179 }
34180
34181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
34182         LDKChannelManagerReadArgs this_ptr_conv;
34183         this_ptr_conv.inner = untag_ptr(this_ptr);
34184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34186         this_ptr_conv.is_owned = false;
34187         // WARNING: This object doesn't live past this scope, needs clone!
34188         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
34189         return ret_ret;
34190 }
34191
34192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34193         LDKChannelManagerReadArgs this_ptr_conv;
34194         this_ptr_conv.inner = untag_ptr(this_ptr);
34195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34197         this_ptr_conv.is_owned = false;
34198         void* val_ptr = untag_ptr(val);
34199         CHECK_ACCESS(val_ptr);
34200         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
34201         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
34202                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34203                 LDKFeeEstimator_JCalls_cloned(&val_conv);
34204         }
34205         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
34206 }
34207
34208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
34209         LDKChannelManagerReadArgs this_ptr_conv;
34210         this_ptr_conv.inner = untag_ptr(this_ptr);
34211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34213         this_ptr_conv.is_owned = false;
34214         // WARNING: This object doesn't live past this scope, needs clone!
34215         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
34216         return ret_ret;
34217 }
34218
34219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34220         LDKChannelManagerReadArgs this_ptr_conv;
34221         this_ptr_conv.inner = untag_ptr(this_ptr);
34222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34224         this_ptr_conv.is_owned = false;
34225         void* val_ptr = untag_ptr(val);
34226         CHECK_ACCESS(val_ptr);
34227         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
34228         if (val_conv.free == LDKWatch_JCalls_free) {
34229                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34230                 LDKWatch_JCalls_cloned(&val_conv);
34231         }
34232         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
34233 }
34234
34235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
34236         LDKChannelManagerReadArgs this_ptr_conv;
34237         this_ptr_conv.inner = untag_ptr(this_ptr);
34238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34240         this_ptr_conv.is_owned = false;
34241         // WARNING: This object doesn't live past this scope, needs clone!
34242         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
34243         return ret_ret;
34244 }
34245
34246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34247         LDKChannelManagerReadArgs this_ptr_conv;
34248         this_ptr_conv.inner = untag_ptr(this_ptr);
34249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34251         this_ptr_conv.is_owned = false;
34252         void* val_ptr = untag_ptr(val);
34253         CHECK_ACCESS(val_ptr);
34254         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
34255         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
34256                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34257                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
34258         }
34259         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
34260 }
34261
34262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
34263         LDKChannelManagerReadArgs this_ptr_conv;
34264         this_ptr_conv.inner = untag_ptr(this_ptr);
34265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34267         this_ptr_conv.is_owned = false;
34268         // WARNING: This object doesn't live past this scope, needs clone!
34269         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
34270         return ret_ret;
34271 }
34272
34273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34274         LDKChannelManagerReadArgs this_ptr_conv;
34275         this_ptr_conv.inner = untag_ptr(this_ptr);
34276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34278         this_ptr_conv.is_owned = false;
34279         void* val_ptr = untag_ptr(val);
34280         CHECK_ACCESS(val_ptr);
34281         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
34282         if (val_conv.free == LDKRouter_JCalls_free) {
34283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34284                 LDKRouter_JCalls_cloned(&val_conv);
34285         }
34286         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
34287 }
34288
34289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
34290         LDKChannelManagerReadArgs this_ptr_conv;
34291         this_ptr_conv.inner = untag_ptr(this_ptr);
34292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34294         this_ptr_conv.is_owned = false;
34295         // WARNING: This object doesn't live past this scope, needs clone!
34296         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
34297         return ret_ret;
34298 }
34299
34300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34301         LDKChannelManagerReadArgs this_ptr_conv;
34302         this_ptr_conv.inner = untag_ptr(this_ptr);
34303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34305         this_ptr_conv.is_owned = false;
34306         void* val_ptr = untag_ptr(val);
34307         CHECK_ACCESS(val_ptr);
34308         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
34309         if (val_conv.free == LDKLogger_JCalls_free) {
34310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34311                 LDKLogger_JCalls_cloned(&val_conv);
34312         }
34313         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
34314 }
34315
34316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
34317         LDKChannelManagerReadArgs this_ptr_conv;
34318         this_ptr_conv.inner = untag_ptr(this_ptr);
34319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34321         this_ptr_conv.is_owned = false;
34322         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
34323         int64_t ret_ref = 0;
34324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34326         return ret_ref;
34327 }
34328
34329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34330         LDKChannelManagerReadArgs this_ptr_conv;
34331         this_ptr_conv.inner = untag_ptr(this_ptr);
34332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34334         this_ptr_conv.is_owned = false;
34335         LDKUserConfig val_conv;
34336         val_conv.inner = untag_ptr(val);
34337         val_conv.is_owned = ptr_is_owned(val);
34338         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34339         val_conv = UserConfig_clone(&val_conv);
34340         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
34341 }
34342
34343 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) {
34344         void* entropy_source_ptr = untag_ptr(entropy_source);
34345         CHECK_ACCESS(entropy_source_ptr);
34346         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
34347         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
34348                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34349                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34350         }
34351         void* node_signer_ptr = untag_ptr(node_signer);
34352         CHECK_ACCESS(node_signer_ptr);
34353         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
34354         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
34355                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34356                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
34357         }
34358         void* signer_provider_ptr = untag_ptr(signer_provider);
34359         CHECK_ACCESS(signer_provider_ptr);
34360         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34361         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34362                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34363                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34364         }
34365         void* fee_estimator_ptr = untag_ptr(fee_estimator);
34366         CHECK_ACCESS(fee_estimator_ptr);
34367         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
34368         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
34369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34370                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
34371         }
34372         void* chain_monitor_ptr = untag_ptr(chain_monitor);
34373         CHECK_ACCESS(chain_monitor_ptr);
34374         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
34375         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
34376                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34377                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
34378         }
34379         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
34380         CHECK_ACCESS(tx_broadcaster_ptr);
34381         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
34382         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34384                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
34385         }
34386         void* router_ptr = untag_ptr(router);
34387         CHECK_ACCESS(router_ptr);
34388         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
34389         if (router_conv.free == LDKRouter_JCalls_free) {
34390                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34391                 LDKRouter_JCalls_cloned(&router_conv);
34392         }
34393         void* logger_ptr = untag_ptr(logger);
34394         CHECK_ACCESS(logger_ptr);
34395         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34396         if (logger_conv.free == LDKLogger_JCalls_free) {
34397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34398                 LDKLogger_JCalls_cloned(&logger_conv);
34399         }
34400         LDKUserConfig default_config_conv;
34401         default_config_conv.inner = untag_ptr(default_config);
34402         default_config_conv.is_owned = ptr_is_owned(default_config);
34403         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
34404         default_config_conv = UserConfig_clone(&default_config_conv);
34405         LDKCVec_ChannelMonitorZ channel_monitors_constr;
34406         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
34407         if (channel_monitors_constr.datalen > 0)
34408                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
34409         else
34410                 channel_monitors_constr.data = NULL;
34411         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
34412         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
34413                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
34414                 LDKChannelMonitor channel_monitors_conv_16_conv;
34415                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
34416                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
34417                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
34418                 channel_monitors_conv_16_conv.is_owned = false;
34419                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
34420         }
34421         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
34422         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);
34423         int64_t ret_ref = 0;
34424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34426         return ret_ref;
34427 }
34428
34429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
34430         LDKu8slice ser_ref;
34431         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34432         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34433         LDKChannelManagerReadArgs arg_conv;
34434         arg_conv.inner = untag_ptr(arg);
34435         arg_conv.is_owned = ptr_is_owned(arg);
34436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34437         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
34438         
34439         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
34440         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
34441         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34442         return tag_ptr(ret_conv, true);
34443 }
34444
34445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34446         LDKExpandedKey this_obj_conv;
34447         this_obj_conv.inner = untag_ptr(this_obj);
34448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34450         ExpandedKey_free(this_obj_conv);
34451 }
34452
34453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
34454         uint8_t key_material_arr[32];
34455         CHECK((*env)->GetArrayLength(env, key_material) == 32);
34456         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
34457         uint8_t (*key_material_ref)[32] = &key_material_arr;
34458         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
34459         int64_t ret_ref = 0;
34460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34462         return ret_ref;
34463 }
34464
34465 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) {
34466         LDKExpandedKey keys_conv;
34467         keys_conv.inner = untag_ptr(keys);
34468         keys_conv.is_owned = ptr_is_owned(keys);
34469         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34470         keys_conv.is_owned = false;
34471         void* min_value_msat_ptr = untag_ptr(min_value_msat);
34472         CHECK_ACCESS(min_value_msat_ptr);
34473         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
34474         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
34475         void* entropy_source_ptr = untag_ptr(entropy_source);
34476         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
34477         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
34478         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
34479         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
34480         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
34481         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
34482         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
34483         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
34484         return tag_ptr(ret_conv, true);
34485 }
34486
34487 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) {
34488         LDKExpandedKey keys_conv;
34489         keys_conv.inner = untag_ptr(keys);
34490         keys_conv.is_owned = ptr_is_owned(keys);
34491         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34492         keys_conv.is_owned = false;
34493         void* min_value_msat_ptr = untag_ptr(min_value_msat);
34494         CHECK_ACCESS(min_value_msat_ptr);
34495         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
34496         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
34497         LDKThirtyTwoBytes payment_hash_ref;
34498         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
34499         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
34500         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
34501         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
34502         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
34503         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
34504         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
34505         *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);
34506         return tag_ptr(ret_conv, true);
34507 }
34508
34509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34510         if (!ptr_is_owned(this_ptr)) return;
34511         void* this_ptr_ptr = untag_ptr(this_ptr);
34512         CHECK_ACCESS(this_ptr_ptr);
34513         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
34514         FREE(untag_ptr(this_ptr));
34515         DecodeError_free(this_ptr_conv);
34516 }
34517
34518 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
34519         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34520         *ret_copy = DecodeError_clone(arg);
34521         int64_t ret_ref = tag_ptr(ret_copy, true);
34522         return ret_ref;
34523 }
34524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34525         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
34526         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
34527         return ret_conv;
34528 }
34529
34530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34531         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
34532         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34533         *ret_copy = DecodeError_clone(orig_conv);
34534         int64_t ret_ref = tag_ptr(ret_copy, true);
34535         return ret_ref;
34536 }
34537
34538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
34539         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34540         *ret_copy = DecodeError_unknown_version();
34541         int64_t ret_ref = tag_ptr(ret_copy, true);
34542         return ret_ref;
34543 }
34544
34545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
34546         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34547         *ret_copy = DecodeError_unknown_required_feature();
34548         int64_t ret_ref = tag_ptr(ret_copy, true);
34549         return ret_ref;
34550 }
34551
34552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
34553         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34554         *ret_copy = DecodeError_invalid_value();
34555         int64_t ret_ref = tag_ptr(ret_copy, true);
34556         return ret_ref;
34557 }
34558
34559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
34560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34561         *ret_copy = DecodeError_short_read();
34562         int64_t ret_ref = tag_ptr(ret_copy, true);
34563         return ret_ref;
34564 }
34565
34566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
34567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34568         *ret_copy = DecodeError_bad_length_descriptor();
34569         int64_t ret_ref = tag_ptr(ret_copy, true);
34570         return ret_ref;
34571 }
34572
34573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
34574         LDKIOError a_conv = LDKIOError_from_java(env, a);
34575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34576         *ret_copy = DecodeError_io(a_conv);
34577         int64_t ret_ref = tag_ptr(ret_copy, true);
34578         return ret_ref;
34579 }
34580
34581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
34582         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34583         *ret_copy = DecodeError_unsupported_compression();
34584         int64_t ret_ref = tag_ptr(ret_copy, true);
34585         return ret_ref;
34586 }
34587
34588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34589         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
34590         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
34591         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
34592         return ret_conv;
34593 }
34594
34595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34596         LDKInit this_obj_conv;
34597         this_obj_conv.inner = untag_ptr(this_obj);
34598         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34600         Init_free(this_obj_conv);
34601 }
34602
34603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
34604         LDKInit this_ptr_conv;
34605         this_ptr_conv.inner = untag_ptr(this_ptr);
34606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34608         this_ptr_conv.is_owned = false;
34609         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
34610         int64_t ret_ref = 0;
34611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34613         return ret_ref;
34614 }
34615
34616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34617         LDKInit this_ptr_conv;
34618         this_ptr_conv.inner = untag_ptr(this_ptr);
34619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34621         this_ptr_conv.is_owned = false;
34622         LDKInitFeatures val_conv;
34623         val_conv.inner = untag_ptr(val);
34624         val_conv.is_owned = ptr_is_owned(val);
34625         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34626         val_conv = InitFeatures_clone(&val_conv);
34627         Init_set_features(&this_ptr_conv, val_conv);
34628 }
34629
34630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
34631         LDKInit this_ptr_conv;
34632         this_ptr_conv.inner = untag_ptr(this_ptr);
34633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34635         this_ptr_conv.is_owned = false;
34636         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
34637         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
34638         int64_t ret_ref = tag_ptr(ret_copy, true);
34639         return ret_ref;
34640 }
34641
34642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34643         LDKInit this_ptr_conv;
34644         this_ptr_conv.inner = untag_ptr(this_ptr);
34645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34647         this_ptr_conv.is_owned = false;
34648         void* val_ptr = untag_ptr(val);
34649         CHECK_ACCESS(val_ptr);
34650         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
34651         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
34652         Init_set_remote_network_address(&this_ptr_conv, val_conv);
34653 }
34654
34655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t remote_network_address_arg) {
34656         LDKInitFeatures features_arg_conv;
34657         features_arg_conv.inner = untag_ptr(features_arg);
34658         features_arg_conv.is_owned = ptr_is_owned(features_arg);
34659         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34660         features_arg_conv = InitFeatures_clone(&features_arg_conv);
34661         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
34662         CHECK_ACCESS(remote_network_address_arg_ptr);
34663         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
34664         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
34665         int64_t ret_ref = 0;
34666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34668         return ret_ref;
34669 }
34670
34671 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
34672         LDKInit ret_var = Init_clone(arg);
34673         int64_t ret_ref = 0;
34674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34676         return ret_ref;
34677 }
34678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34679         LDKInit arg_conv;
34680         arg_conv.inner = untag_ptr(arg);
34681         arg_conv.is_owned = ptr_is_owned(arg);
34682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34683         arg_conv.is_owned = false;
34684         int64_t ret_conv = Init_clone_ptr(&arg_conv);
34685         return ret_conv;
34686 }
34687
34688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34689         LDKInit orig_conv;
34690         orig_conv.inner = untag_ptr(orig);
34691         orig_conv.is_owned = ptr_is_owned(orig);
34692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34693         orig_conv.is_owned = false;
34694         LDKInit ret_var = Init_clone(&orig_conv);
34695         int64_t ret_ref = 0;
34696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34698         return ret_ref;
34699 }
34700
34701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34702         LDKInit a_conv;
34703         a_conv.inner = untag_ptr(a);
34704         a_conv.is_owned = ptr_is_owned(a);
34705         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34706         a_conv.is_owned = false;
34707         LDKInit b_conv;
34708         b_conv.inner = untag_ptr(b);
34709         b_conv.is_owned = ptr_is_owned(b);
34710         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34711         b_conv.is_owned = false;
34712         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
34713         return ret_conv;
34714 }
34715
34716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34717         LDKErrorMessage this_obj_conv;
34718         this_obj_conv.inner = untag_ptr(this_obj);
34719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34721         ErrorMessage_free(this_obj_conv);
34722 }
34723
34724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34725         LDKErrorMessage this_ptr_conv;
34726         this_ptr_conv.inner = untag_ptr(this_ptr);
34727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34729         this_ptr_conv.is_owned = false;
34730         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34731         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
34732         return ret_arr;
34733 }
34734
34735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34736         LDKErrorMessage this_ptr_conv;
34737         this_ptr_conv.inner = untag_ptr(this_ptr);
34738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34740         this_ptr_conv.is_owned = false;
34741         LDKThirtyTwoBytes val_ref;
34742         CHECK((*env)->GetArrayLength(env, val) == 32);
34743         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34744         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
34745 }
34746
34747 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
34748         LDKErrorMessage this_ptr_conv;
34749         this_ptr_conv.inner = untag_ptr(this_ptr);
34750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34752         this_ptr_conv.is_owned = false;
34753         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
34754         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34755         Str_free(ret_str);
34756         return ret_conv;
34757 }
34758
34759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
34760         LDKErrorMessage this_ptr_conv;
34761         this_ptr_conv.inner = untag_ptr(this_ptr);
34762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34764         this_ptr_conv.is_owned = false;
34765         LDKStr val_conv = java_to_owned_str(env, val);
34766         ErrorMessage_set_data(&this_ptr_conv, val_conv);
34767 }
34768
34769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
34770         LDKThirtyTwoBytes channel_id_arg_ref;
34771         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34772         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34773         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
34774         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
34775         int64_t ret_ref = 0;
34776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34778         return ret_ref;
34779 }
34780
34781 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
34782         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
34783         int64_t ret_ref = 0;
34784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34786         return ret_ref;
34787 }
34788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34789         LDKErrorMessage arg_conv;
34790         arg_conv.inner = untag_ptr(arg);
34791         arg_conv.is_owned = ptr_is_owned(arg);
34792         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34793         arg_conv.is_owned = false;
34794         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
34795         return ret_conv;
34796 }
34797
34798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34799         LDKErrorMessage orig_conv;
34800         orig_conv.inner = untag_ptr(orig);
34801         orig_conv.is_owned = ptr_is_owned(orig);
34802         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34803         orig_conv.is_owned = false;
34804         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
34805         int64_t ret_ref = 0;
34806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34808         return ret_ref;
34809 }
34810
34811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34812         LDKErrorMessage a_conv;
34813         a_conv.inner = untag_ptr(a);
34814         a_conv.is_owned = ptr_is_owned(a);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34816         a_conv.is_owned = false;
34817         LDKErrorMessage b_conv;
34818         b_conv.inner = untag_ptr(b);
34819         b_conv.is_owned = ptr_is_owned(b);
34820         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34821         b_conv.is_owned = false;
34822         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
34823         return ret_conv;
34824 }
34825
34826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34827         LDKWarningMessage this_obj_conv;
34828         this_obj_conv.inner = untag_ptr(this_obj);
34829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34831         WarningMessage_free(this_obj_conv);
34832 }
34833
34834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34835         LDKWarningMessage this_ptr_conv;
34836         this_ptr_conv.inner = untag_ptr(this_ptr);
34837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34839         this_ptr_conv.is_owned = false;
34840         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34841         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
34842         return ret_arr;
34843 }
34844
34845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34846         LDKWarningMessage this_ptr_conv;
34847         this_ptr_conv.inner = untag_ptr(this_ptr);
34848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34850         this_ptr_conv.is_owned = false;
34851         LDKThirtyTwoBytes val_ref;
34852         CHECK((*env)->GetArrayLength(env, val) == 32);
34853         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34854         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
34855 }
34856
34857 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
34858         LDKWarningMessage this_ptr_conv;
34859         this_ptr_conv.inner = untag_ptr(this_ptr);
34860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34862         this_ptr_conv.is_owned = false;
34863         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
34864         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34865         Str_free(ret_str);
34866         return ret_conv;
34867 }
34868
34869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
34870         LDKWarningMessage this_ptr_conv;
34871         this_ptr_conv.inner = untag_ptr(this_ptr);
34872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34874         this_ptr_conv.is_owned = false;
34875         LDKStr val_conv = java_to_owned_str(env, val);
34876         WarningMessage_set_data(&this_ptr_conv, val_conv);
34877 }
34878
34879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
34880         LDKThirtyTwoBytes channel_id_arg_ref;
34881         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34882         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34883         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
34884         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
34885         int64_t ret_ref = 0;
34886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34888         return ret_ref;
34889 }
34890
34891 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
34892         LDKWarningMessage ret_var = WarningMessage_clone(arg);
34893         int64_t ret_ref = 0;
34894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34896         return ret_ref;
34897 }
34898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34899         LDKWarningMessage arg_conv;
34900         arg_conv.inner = untag_ptr(arg);
34901         arg_conv.is_owned = ptr_is_owned(arg);
34902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34903         arg_conv.is_owned = false;
34904         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
34905         return ret_conv;
34906 }
34907
34908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34909         LDKWarningMessage orig_conv;
34910         orig_conv.inner = untag_ptr(orig);
34911         orig_conv.is_owned = ptr_is_owned(orig);
34912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34913         orig_conv.is_owned = false;
34914         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
34915         int64_t ret_ref = 0;
34916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34918         return ret_ref;
34919 }
34920
34921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34922         LDKWarningMessage a_conv;
34923         a_conv.inner = untag_ptr(a);
34924         a_conv.is_owned = ptr_is_owned(a);
34925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34926         a_conv.is_owned = false;
34927         LDKWarningMessage b_conv;
34928         b_conv.inner = untag_ptr(b);
34929         b_conv.is_owned = ptr_is_owned(b);
34930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34931         b_conv.is_owned = false;
34932         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
34933         return ret_conv;
34934 }
34935
34936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34937         LDKPing this_obj_conv;
34938         this_obj_conv.inner = untag_ptr(this_obj);
34939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34941         Ping_free(this_obj_conv);
34942 }
34943
34944 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
34945         LDKPing this_ptr_conv;
34946         this_ptr_conv.inner = untag_ptr(this_ptr);
34947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34949         this_ptr_conv.is_owned = false;
34950         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
34951         return ret_conv;
34952 }
34953
34954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34955         LDKPing this_ptr_conv;
34956         this_ptr_conv.inner = untag_ptr(this_ptr);
34957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34959         this_ptr_conv.is_owned = false;
34960         Ping_set_ponglen(&this_ptr_conv, val);
34961 }
34962
34963 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
34964         LDKPing 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         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
34970         return ret_conv;
34971 }
34972
34973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34974         LDKPing this_ptr_conv;
34975         this_ptr_conv.inner = untag_ptr(this_ptr);
34976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34978         this_ptr_conv.is_owned = false;
34979         Ping_set_byteslen(&this_ptr_conv, val);
34980 }
34981
34982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
34983         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
34984         int64_t ret_ref = 0;
34985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34987         return ret_ref;
34988 }
34989
34990 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
34991         LDKPing ret_var = Ping_clone(arg);
34992         int64_t ret_ref = 0;
34993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34995         return ret_ref;
34996 }
34997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34998         LDKPing arg_conv;
34999         arg_conv.inner = untag_ptr(arg);
35000         arg_conv.is_owned = ptr_is_owned(arg);
35001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35002         arg_conv.is_owned = false;
35003         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
35004         return ret_conv;
35005 }
35006
35007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35008         LDKPing orig_conv;
35009         orig_conv.inner = untag_ptr(orig);
35010         orig_conv.is_owned = ptr_is_owned(orig);
35011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35012         orig_conv.is_owned = false;
35013         LDKPing ret_var = Ping_clone(&orig_conv);
35014         int64_t ret_ref = 0;
35015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35017         return ret_ref;
35018 }
35019
35020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35021         LDKPing a_conv;
35022         a_conv.inner = untag_ptr(a);
35023         a_conv.is_owned = ptr_is_owned(a);
35024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35025         a_conv.is_owned = false;
35026         LDKPing b_conv;
35027         b_conv.inner = untag_ptr(b);
35028         b_conv.is_owned = ptr_is_owned(b);
35029         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35030         b_conv.is_owned = false;
35031         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
35032         return ret_conv;
35033 }
35034
35035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35036         LDKPong this_obj_conv;
35037         this_obj_conv.inner = untag_ptr(this_obj);
35038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35040         Pong_free(this_obj_conv);
35041 }
35042
35043 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
35044         LDKPong this_ptr_conv;
35045         this_ptr_conv.inner = untag_ptr(this_ptr);
35046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35048         this_ptr_conv.is_owned = false;
35049         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
35050         return ret_conv;
35051 }
35052
35053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35054         LDKPong this_ptr_conv;
35055         this_ptr_conv.inner = untag_ptr(this_ptr);
35056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35058         this_ptr_conv.is_owned = false;
35059         Pong_set_byteslen(&this_ptr_conv, val);
35060 }
35061
35062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
35063         LDKPong ret_var = Pong_new(byteslen_arg);
35064         int64_t ret_ref = 0;
35065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35067         return ret_ref;
35068 }
35069
35070 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
35071         LDKPong ret_var = Pong_clone(arg);
35072         int64_t ret_ref = 0;
35073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35075         return ret_ref;
35076 }
35077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35078         LDKPong arg_conv;
35079         arg_conv.inner = untag_ptr(arg);
35080         arg_conv.is_owned = ptr_is_owned(arg);
35081         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35082         arg_conv.is_owned = false;
35083         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
35084         return ret_conv;
35085 }
35086
35087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35088         LDKPong orig_conv;
35089         orig_conv.inner = untag_ptr(orig);
35090         orig_conv.is_owned = ptr_is_owned(orig);
35091         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35092         orig_conv.is_owned = false;
35093         LDKPong ret_var = Pong_clone(&orig_conv);
35094         int64_t ret_ref = 0;
35095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35097         return ret_ref;
35098 }
35099
35100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35101         LDKPong a_conv;
35102         a_conv.inner = untag_ptr(a);
35103         a_conv.is_owned = ptr_is_owned(a);
35104         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35105         a_conv.is_owned = false;
35106         LDKPong b_conv;
35107         b_conv.inner = untag_ptr(b);
35108         b_conv.is_owned = ptr_is_owned(b);
35109         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35110         b_conv.is_owned = false;
35111         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
35112         return ret_conv;
35113 }
35114
35115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35116         LDKOpenChannel this_obj_conv;
35117         this_obj_conv.inner = untag_ptr(this_obj);
35118         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35120         OpenChannel_free(this_obj_conv);
35121 }
35122
35123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35124         LDKOpenChannel this_ptr_conv;
35125         this_ptr_conv.inner = untag_ptr(this_ptr);
35126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35128         this_ptr_conv.is_owned = false;
35129         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35130         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
35131         return ret_arr;
35132 }
35133
35134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35135         LDKOpenChannel this_ptr_conv;
35136         this_ptr_conv.inner = untag_ptr(this_ptr);
35137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35139         this_ptr_conv.is_owned = false;
35140         LDKThirtyTwoBytes val_ref;
35141         CHECK((*env)->GetArrayLength(env, val) == 32);
35142         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35143         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
35144 }
35145
35146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35147         LDKOpenChannel this_ptr_conv;
35148         this_ptr_conv.inner = untag_ptr(this_ptr);
35149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35151         this_ptr_conv.is_owned = false;
35152         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35153         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
35154         return ret_arr;
35155 }
35156
35157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35158         LDKOpenChannel this_ptr_conv;
35159         this_ptr_conv.inner = untag_ptr(this_ptr);
35160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35162         this_ptr_conv.is_owned = false;
35163         LDKThirtyTwoBytes val_ref;
35164         CHECK((*env)->GetArrayLength(env, val) == 32);
35165         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35166         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
35167 }
35168
35169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35170         LDKOpenChannel this_ptr_conv;
35171         this_ptr_conv.inner = untag_ptr(this_ptr);
35172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35174         this_ptr_conv.is_owned = false;
35175         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
35176         return ret_conv;
35177 }
35178
35179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35180         LDKOpenChannel this_ptr_conv;
35181         this_ptr_conv.inner = untag_ptr(this_ptr);
35182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35184         this_ptr_conv.is_owned = false;
35185         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
35186 }
35187
35188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35189         LDKOpenChannel this_ptr_conv;
35190         this_ptr_conv.inner = untag_ptr(this_ptr);
35191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35193         this_ptr_conv.is_owned = false;
35194         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
35195         return ret_conv;
35196 }
35197
35198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35199         LDKOpenChannel this_ptr_conv;
35200         this_ptr_conv.inner = untag_ptr(this_ptr);
35201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35203         this_ptr_conv.is_owned = false;
35204         OpenChannel_set_push_msat(&this_ptr_conv, val);
35205 }
35206
35207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35208         LDKOpenChannel this_ptr_conv;
35209         this_ptr_conv.inner = untag_ptr(this_ptr);
35210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35212         this_ptr_conv.is_owned = false;
35213         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
35214         return ret_conv;
35215 }
35216
35217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35218         LDKOpenChannel this_ptr_conv;
35219         this_ptr_conv.inner = untag_ptr(this_ptr);
35220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35222         this_ptr_conv.is_owned = false;
35223         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
35224 }
35225
35226 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) {
35227         LDKOpenChannel this_ptr_conv;
35228         this_ptr_conv.inner = untag_ptr(this_ptr);
35229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35231         this_ptr_conv.is_owned = false;
35232         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
35233         return ret_conv;
35234 }
35235
35236 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) {
35237         LDKOpenChannel this_ptr_conv;
35238         this_ptr_conv.inner = untag_ptr(this_ptr);
35239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35241         this_ptr_conv.is_owned = false;
35242         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35243 }
35244
35245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35246         LDKOpenChannel this_ptr_conv;
35247         this_ptr_conv.inner = untag_ptr(this_ptr);
35248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35250         this_ptr_conv.is_owned = false;
35251         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
35252         return ret_conv;
35253 }
35254
35255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35256         LDKOpenChannel this_ptr_conv;
35257         this_ptr_conv.inner = untag_ptr(this_ptr);
35258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35260         this_ptr_conv.is_owned = false;
35261         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
35262 }
35263
35264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35265         LDKOpenChannel this_ptr_conv;
35266         this_ptr_conv.inner = untag_ptr(this_ptr);
35267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35269         this_ptr_conv.is_owned = false;
35270         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
35271         return ret_conv;
35272 }
35273
35274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35275         LDKOpenChannel this_ptr_conv;
35276         this_ptr_conv.inner = untag_ptr(this_ptr);
35277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35279         this_ptr_conv.is_owned = false;
35280         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
35281 }
35282
35283 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
35284         LDKOpenChannel this_ptr_conv;
35285         this_ptr_conv.inner = untag_ptr(this_ptr);
35286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35288         this_ptr_conv.is_owned = false;
35289         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
35290         return ret_conv;
35291 }
35292
35293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35294         LDKOpenChannel this_ptr_conv;
35295         this_ptr_conv.inner = untag_ptr(this_ptr);
35296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35298         this_ptr_conv.is_owned = false;
35299         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
35300 }
35301
35302 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
35303         LDKOpenChannel this_ptr_conv;
35304         this_ptr_conv.inner = untag_ptr(this_ptr);
35305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35307         this_ptr_conv.is_owned = false;
35308         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
35309         return ret_conv;
35310 }
35311
35312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35313         LDKOpenChannel this_ptr_conv;
35314         this_ptr_conv.inner = untag_ptr(this_ptr);
35315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35317         this_ptr_conv.is_owned = false;
35318         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
35319 }
35320
35321 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35322         LDKOpenChannel this_ptr_conv;
35323         this_ptr_conv.inner = untag_ptr(this_ptr);
35324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35326         this_ptr_conv.is_owned = false;
35327         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
35328         return ret_conv;
35329 }
35330
35331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35332         LDKOpenChannel this_ptr_conv;
35333         this_ptr_conv.inner = untag_ptr(this_ptr);
35334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35336         this_ptr_conv.is_owned = false;
35337         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
35338 }
35339
35340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
35341         LDKOpenChannel this_ptr_conv;
35342         this_ptr_conv.inner = untag_ptr(this_ptr);
35343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35345         this_ptr_conv.is_owned = false;
35346         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35347         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
35348         return ret_arr;
35349 }
35350
35351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35352         LDKOpenChannel this_ptr_conv;
35353         this_ptr_conv.inner = untag_ptr(this_ptr);
35354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35356         this_ptr_conv.is_owned = false;
35357         LDKPublicKey val_ref;
35358         CHECK((*env)->GetArrayLength(env, val) == 33);
35359         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35360         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
35361 }
35362
35363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
35364         LDKOpenChannel this_ptr_conv;
35365         this_ptr_conv.inner = untag_ptr(this_ptr);
35366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35368         this_ptr_conv.is_owned = false;
35369         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35370         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
35371         return ret_arr;
35372 }
35373
35374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35375         LDKOpenChannel this_ptr_conv;
35376         this_ptr_conv.inner = untag_ptr(this_ptr);
35377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35379         this_ptr_conv.is_owned = false;
35380         LDKPublicKey val_ref;
35381         CHECK((*env)->GetArrayLength(env, val) == 33);
35382         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35383         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
35384 }
35385
35386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
35387         LDKOpenChannel this_ptr_conv;
35388         this_ptr_conv.inner = untag_ptr(this_ptr);
35389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35391         this_ptr_conv.is_owned = false;
35392         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35393         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
35394         return ret_arr;
35395 }
35396
35397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35398         LDKOpenChannel this_ptr_conv;
35399         this_ptr_conv.inner = untag_ptr(this_ptr);
35400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35402         this_ptr_conv.is_owned = false;
35403         LDKPublicKey val_ref;
35404         CHECK((*env)->GetArrayLength(env, val) == 33);
35405         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35406         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
35407 }
35408
35409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
35410         LDKOpenChannel this_ptr_conv;
35411         this_ptr_conv.inner = untag_ptr(this_ptr);
35412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35414         this_ptr_conv.is_owned = false;
35415         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35416         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
35417         return ret_arr;
35418 }
35419
35420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35421         LDKOpenChannel this_ptr_conv;
35422         this_ptr_conv.inner = untag_ptr(this_ptr);
35423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35425         this_ptr_conv.is_owned = false;
35426         LDKPublicKey val_ref;
35427         CHECK((*env)->GetArrayLength(env, val) == 33);
35428         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35429         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35430 }
35431
35432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
35433         LDKOpenChannel this_ptr_conv;
35434         this_ptr_conv.inner = untag_ptr(this_ptr);
35435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35437         this_ptr_conv.is_owned = false;
35438         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35439         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
35440         return ret_arr;
35441 }
35442
35443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35444         LDKOpenChannel this_ptr_conv;
35445         this_ptr_conv.inner = untag_ptr(this_ptr);
35446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35448         this_ptr_conv.is_owned = false;
35449         LDKPublicKey val_ref;
35450         CHECK((*env)->GetArrayLength(env, val) == 33);
35451         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35452         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
35453 }
35454
35455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
35456         LDKOpenChannel this_ptr_conv;
35457         this_ptr_conv.inner = untag_ptr(this_ptr);
35458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35460         this_ptr_conv.is_owned = false;
35461         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35462         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
35463         return ret_arr;
35464 }
35465
35466 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) {
35467         LDKOpenChannel this_ptr_conv;
35468         this_ptr_conv.inner = untag_ptr(this_ptr);
35469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35471         this_ptr_conv.is_owned = false;
35472         LDKPublicKey val_ref;
35473         CHECK((*env)->GetArrayLength(env, val) == 33);
35474         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35475         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
35476 }
35477
35478 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
35479         LDKOpenChannel this_ptr_conv;
35480         this_ptr_conv.inner = untag_ptr(this_ptr);
35481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35483         this_ptr_conv.is_owned = false;
35484         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
35485         return ret_conv;
35486 }
35487
35488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
35489         LDKOpenChannel this_ptr_conv;
35490         this_ptr_conv.inner = untag_ptr(this_ptr);
35491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35493         this_ptr_conv.is_owned = false;
35494         OpenChannel_set_channel_flags(&this_ptr_conv, val);
35495 }
35496
35497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
35498         LDKOpenChannel this_ptr_conv;
35499         this_ptr_conv.inner = untag_ptr(this_ptr);
35500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35502         this_ptr_conv.is_owned = false;
35503         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
35504         int64_t ret_ref = 0;
35505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35507         return ret_ref;
35508 }
35509
35510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35511         LDKOpenChannel this_ptr_conv;
35512         this_ptr_conv.inner = untag_ptr(this_ptr);
35513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35515         this_ptr_conv.is_owned = false;
35516         LDKChannelTypeFeatures val_conv;
35517         val_conv.inner = untag_ptr(val);
35518         val_conv.is_owned = ptr_is_owned(val);
35519         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35520         val_conv = ChannelTypeFeatures_clone(&val_conv);
35521         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
35522 }
35523
35524 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
35525         LDKOpenChannel ret_var = OpenChannel_clone(arg);
35526         int64_t ret_ref = 0;
35527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35529         return ret_ref;
35530 }
35531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35532         LDKOpenChannel arg_conv;
35533         arg_conv.inner = untag_ptr(arg);
35534         arg_conv.is_owned = ptr_is_owned(arg);
35535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35536         arg_conv.is_owned = false;
35537         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
35538         return ret_conv;
35539 }
35540
35541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35542         LDKOpenChannel orig_conv;
35543         orig_conv.inner = untag_ptr(orig);
35544         orig_conv.is_owned = ptr_is_owned(orig);
35545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35546         orig_conv.is_owned = false;
35547         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
35548         int64_t ret_ref = 0;
35549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35551         return ret_ref;
35552 }
35553
35554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35555         LDKOpenChannel a_conv;
35556         a_conv.inner = untag_ptr(a);
35557         a_conv.is_owned = ptr_is_owned(a);
35558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35559         a_conv.is_owned = false;
35560         LDKOpenChannel b_conv;
35561         b_conv.inner = untag_ptr(b);
35562         b_conv.is_owned = ptr_is_owned(b);
35563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35564         b_conv.is_owned = false;
35565         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
35566         return ret_conv;
35567 }
35568
35569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35570         LDKAcceptChannel this_obj_conv;
35571         this_obj_conv.inner = untag_ptr(this_obj);
35572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35574         AcceptChannel_free(this_obj_conv);
35575 }
35576
35577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35578         LDKAcceptChannel this_ptr_conv;
35579         this_ptr_conv.inner = untag_ptr(this_ptr);
35580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35582         this_ptr_conv.is_owned = false;
35583         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35584         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
35585         return ret_arr;
35586 }
35587
35588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35589         LDKAcceptChannel this_ptr_conv;
35590         this_ptr_conv.inner = untag_ptr(this_ptr);
35591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35593         this_ptr_conv.is_owned = false;
35594         LDKThirtyTwoBytes val_ref;
35595         CHECK((*env)->GetArrayLength(env, val) == 32);
35596         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35597         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
35598 }
35599
35600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35601         LDKAcceptChannel this_ptr_conv;
35602         this_ptr_conv.inner = untag_ptr(this_ptr);
35603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35605         this_ptr_conv.is_owned = false;
35606         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
35607         return ret_conv;
35608 }
35609
35610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35611         LDKAcceptChannel this_ptr_conv;
35612         this_ptr_conv.inner = untag_ptr(this_ptr);
35613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35615         this_ptr_conv.is_owned = false;
35616         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
35617 }
35618
35619 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) {
35620         LDKAcceptChannel this_ptr_conv;
35621         this_ptr_conv.inner = untag_ptr(this_ptr);
35622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35624         this_ptr_conv.is_owned = false;
35625         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
35626         return ret_conv;
35627 }
35628
35629 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) {
35630         LDKAcceptChannel this_ptr_conv;
35631         this_ptr_conv.inner = untag_ptr(this_ptr);
35632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35634         this_ptr_conv.is_owned = false;
35635         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35636 }
35637
35638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
35639         LDKAcceptChannel this_ptr_conv;
35640         this_ptr_conv.inner = untag_ptr(this_ptr);
35641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35643         this_ptr_conv.is_owned = false;
35644         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
35645         return ret_conv;
35646 }
35647
35648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35649         LDKAcceptChannel this_ptr_conv;
35650         this_ptr_conv.inner = untag_ptr(this_ptr);
35651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35653         this_ptr_conv.is_owned = false;
35654         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
35655 }
35656
35657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
35658         LDKAcceptChannel this_ptr_conv;
35659         this_ptr_conv.inner = untag_ptr(this_ptr);
35660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35662         this_ptr_conv.is_owned = false;
35663         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
35664         return ret_conv;
35665 }
35666
35667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35668         LDKAcceptChannel this_ptr_conv;
35669         this_ptr_conv.inner = untag_ptr(this_ptr);
35670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35672         this_ptr_conv.is_owned = false;
35673         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
35674 }
35675
35676 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
35677         LDKAcceptChannel this_ptr_conv;
35678         this_ptr_conv.inner = untag_ptr(this_ptr);
35679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35681         this_ptr_conv.is_owned = false;
35682         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
35683         return ret_conv;
35684 }
35685
35686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35687         LDKAcceptChannel this_ptr_conv;
35688         this_ptr_conv.inner = untag_ptr(this_ptr);
35689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35691         this_ptr_conv.is_owned = false;
35692         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
35693 }
35694
35695 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
35696         LDKAcceptChannel this_ptr_conv;
35697         this_ptr_conv.inner = untag_ptr(this_ptr);
35698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35700         this_ptr_conv.is_owned = false;
35701         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
35702         return ret_conv;
35703 }
35704
35705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35706         LDKAcceptChannel this_ptr_conv;
35707         this_ptr_conv.inner = untag_ptr(this_ptr);
35708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35710         this_ptr_conv.is_owned = false;
35711         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
35712 }
35713
35714 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35715         LDKAcceptChannel this_ptr_conv;
35716         this_ptr_conv.inner = untag_ptr(this_ptr);
35717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35719         this_ptr_conv.is_owned = false;
35720         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
35721         return ret_conv;
35722 }
35723
35724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35725         LDKAcceptChannel this_ptr_conv;
35726         this_ptr_conv.inner = untag_ptr(this_ptr);
35727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35729         this_ptr_conv.is_owned = false;
35730         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
35731 }
35732
35733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
35734         LDKAcceptChannel this_ptr_conv;
35735         this_ptr_conv.inner = untag_ptr(this_ptr);
35736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35738         this_ptr_conv.is_owned = false;
35739         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35740         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
35741         return ret_arr;
35742 }
35743
35744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35745         LDKAcceptChannel this_ptr_conv;
35746         this_ptr_conv.inner = untag_ptr(this_ptr);
35747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35749         this_ptr_conv.is_owned = false;
35750         LDKPublicKey val_ref;
35751         CHECK((*env)->GetArrayLength(env, val) == 33);
35752         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35753         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
35754 }
35755
35756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
35757         LDKAcceptChannel this_ptr_conv;
35758         this_ptr_conv.inner = untag_ptr(this_ptr);
35759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35761         this_ptr_conv.is_owned = false;
35762         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35763         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
35764         return ret_arr;
35765 }
35766
35767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35768         LDKAcceptChannel this_ptr_conv;
35769         this_ptr_conv.inner = untag_ptr(this_ptr);
35770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35772         this_ptr_conv.is_owned = false;
35773         LDKPublicKey val_ref;
35774         CHECK((*env)->GetArrayLength(env, val) == 33);
35775         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35776         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
35777 }
35778
35779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
35780         LDKAcceptChannel this_ptr_conv;
35781         this_ptr_conv.inner = untag_ptr(this_ptr);
35782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35784         this_ptr_conv.is_owned = false;
35785         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35786         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
35787         return ret_arr;
35788 }
35789
35790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35791         LDKAcceptChannel this_ptr_conv;
35792         this_ptr_conv.inner = untag_ptr(this_ptr);
35793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35795         this_ptr_conv.is_owned = false;
35796         LDKPublicKey val_ref;
35797         CHECK((*env)->GetArrayLength(env, val) == 33);
35798         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35799         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
35800 }
35801
35802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
35803         LDKAcceptChannel this_ptr_conv;
35804         this_ptr_conv.inner = untag_ptr(this_ptr);
35805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35807         this_ptr_conv.is_owned = false;
35808         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35809         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
35810         return ret_arr;
35811 }
35812
35813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35814         LDKAcceptChannel this_ptr_conv;
35815         this_ptr_conv.inner = untag_ptr(this_ptr);
35816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35818         this_ptr_conv.is_owned = false;
35819         LDKPublicKey val_ref;
35820         CHECK((*env)->GetArrayLength(env, val) == 33);
35821         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35822         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35823 }
35824
35825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
35826         LDKAcceptChannel this_ptr_conv;
35827         this_ptr_conv.inner = untag_ptr(this_ptr);
35828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35830         this_ptr_conv.is_owned = false;
35831         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35832         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
35833         return ret_arr;
35834 }
35835
35836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35837         LDKAcceptChannel this_ptr_conv;
35838         this_ptr_conv.inner = untag_ptr(this_ptr);
35839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35841         this_ptr_conv.is_owned = false;
35842         LDKPublicKey val_ref;
35843         CHECK((*env)->GetArrayLength(env, val) == 33);
35844         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35845         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
35846 }
35847
35848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
35849         LDKAcceptChannel this_ptr_conv;
35850         this_ptr_conv.inner = untag_ptr(this_ptr);
35851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35853         this_ptr_conv.is_owned = false;
35854         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35855         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
35856         return ret_arr;
35857 }
35858
35859 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) {
35860         LDKAcceptChannel this_ptr_conv;
35861         this_ptr_conv.inner = untag_ptr(this_ptr);
35862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35864         this_ptr_conv.is_owned = false;
35865         LDKPublicKey val_ref;
35866         CHECK((*env)->GetArrayLength(env, val) == 33);
35867         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35868         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
35869 }
35870
35871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
35872         LDKAcceptChannel this_ptr_conv;
35873         this_ptr_conv.inner = untag_ptr(this_ptr);
35874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35876         this_ptr_conv.is_owned = false;
35877         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
35878         int64_t ret_ref = 0;
35879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35881         return ret_ref;
35882 }
35883
35884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35885         LDKAcceptChannel this_ptr_conv;
35886         this_ptr_conv.inner = untag_ptr(this_ptr);
35887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35889         this_ptr_conv.is_owned = false;
35890         LDKChannelTypeFeatures val_conv;
35891         val_conv.inner = untag_ptr(val);
35892         val_conv.is_owned = ptr_is_owned(val);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35894         val_conv = ChannelTypeFeatures_clone(&val_conv);
35895         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
35896 }
35897
35898 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
35899         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
35900         int64_t ret_ref = 0;
35901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35903         return ret_ref;
35904 }
35905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35906         LDKAcceptChannel arg_conv;
35907         arg_conv.inner = untag_ptr(arg);
35908         arg_conv.is_owned = ptr_is_owned(arg);
35909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35910         arg_conv.is_owned = false;
35911         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
35912         return ret_conv;
35913 }
35914
35915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35916         LDKAcceptChannel orig_conv;
35917         orig_conv.inner = untag_ptr(orig);
35918         orig_conv.is_owned = ptr_is_owned(orig);
35919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35920         orig_conv.is_owned = false;
35921         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
35922         int64_t ret_ref = 0;
35923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35925         return ret_ref;
35926 }
35927
35928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35929         LDKAcceptChannel a_conv;
35930         a_conv.inner = untag_ptr(a);
35931         a_conv.is_owned = ptr_is_owned(a);
35932         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35933         a_conv.is_owned = false;
35934         LDKAcceptChannel b_conv;
35935         b_conv.inner = untag_ptr(b);
35936         b_conv.is_owned = ptr_is_owned(b);
35937         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35938         b_conv.is_owned = false;
35939         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
35940         return ret_conv;
35941 }
35942
35943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35944         LDKFundingCreated this_obj_conv;
35945         this_obj_conv.inner = untag_ptr(this_obj);
35946         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35948         FundingCreated_free(this_obj_conv);
35949 }
35950
35951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35952         LDKFundingCreated this_ptr_conv;
35953         this_ptr_conv.inner = untag_ptr(this_ptr);
35954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35956         this_ptr_conv.is_owned = false;
35957         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35958         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
35959         return ret_arr;
35960 }
35961
35962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35963         LDKFundingCreated this_ptr_conv;
35964         this_ptr_conv.inner = untag_ptr(this_ptr);
35965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35967         this_ptr_conv.is_owned = false;
35968         LDKThirtyTwoBytes val_ref;
35969         CHECK((*env)->GetArrayLength(env, val) == 32);
35970         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35971         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
35972 }
35973
35974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
35975         LDKFundingCreated this_ptr_conv;
35976         this_ptr_conv.inner = untag_ptr(this_ptr);
35977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35979         this_ptr_conv.is_owned = false;
35980         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35981         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
35982         return ret_arr;
35983 }
35984
35985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35986         LDKFundingCreated this_ptr_conv;
35987         this_ptr_conv.inner = untag_ptr(this_ptr);
35988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35990         this_ptr_conv.is_owned = false;
35991         LDKThirtyTwoBytes val_ref;
35992         CHECK((*env)->GetArrayLength(env, val) == 32);
35993         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35994         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
35995 }
35996
35997 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
35998         LDKFundingCreated this_ptr_conv;
35999         this_ptr_conv.inner = untag_ptr(this_ptr);
36000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36002         this_ptr_conv.is_owned = false;
36003         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
36004         return ret_conv;
36005 }
36006
36007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36008         LDKFundingCreated this_ptr_conv;
36009         this_ptr_conv.inner = untag_ptr(this_ptr);
36010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36012         this_ptr_conv.is_owned = false;
36013         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
36014 }
36015
36016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
36017         LDKFundingCreated this_ptr_conv;
36018         this_ptr_conv.inner = untag_ptr(this_ptr);
36019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36021         this_ptr_conv.is_owned = false;
36022         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36023         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
36024         return ret_arr;
36025 }
36026
36027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36028         LDKFundingCreated this_ptr_conv;
36029         this_ptr_conv.inner = untag_ptr(this_ptr);
36030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36032         this_ptr_conv.is_owned = false;
36033         LDKSignature val_ref;
36034         CHECK((*env)->GetArrayLength(env, val) == 64);
36035         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36036         FundingCreated_set_signature(&this_ptr_conv, val_ref);
36037 }
36038
36039 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) {
36040         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
36041         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
36042         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
36043         LDKThirtyTwoBytes funding_txid_arg_ref;
36044         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
36045         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
36046         LDKSignature signature_arg_ref;
36047         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
36048         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
36049         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
36050         int64_t ret_ref = 0;
36051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36053         return ret_ref;
36054 }
36055
36056 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
36057         LDKFundingCreated ret_var = FundingCreated_clone(arg);
36058         int64_t ret_ref = 0;
36059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36061         return ret_ref;
36062 }
36063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36064         LDKFundingCreated arg_conv;
36065         arg_conv.inner = untag_ptr(arg);
36066         arg_conv.is_owned = ptr_is_owned(arg);
36067         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36068         arg_conv.is_owned = false;
36069         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
36070         return ret_conv;
36071 }
36072
36073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36074         LDKFundingCreated orig_conv;
36075         orig_conv.inner = untag_ptr(orig);
36076         orig_conv.is_owned = ptr_is_owned(orig);
36077         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36078         orig_conv.is_owned = false;
36079         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
36080         int64_t ret_ref = 0;
36081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36083         return ret_ref;
36084 }
36085
36086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36087         LDKFundingCreated a_conv;
36088         a_conv.inner = untag_ptr(a);
36089         a_conv.is_owned = ptr_is_owned(a);
36090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36091         a_conv.is_owned = false;
36092         LDKFundingCreated b_conv;
36093         b_conv.inner = untag_ptr(b);
36094         b_conv.is_owned = ptr_is_owned(b);
36095         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36096         b_conv.is_owned = false;
36097         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
36098         return ret_conv;
36099 }
36100
36101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36102         LDKFundingSigned this_obj_conv;
36103         this_obj_conv.inner = untag_ptr(this_obj);
36104         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36106         FundingSigned_free(this_obj_conv);
36107 }
36108
36109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36110         LDKFundingSigned this_ptr_conv;
36111         this_ptr_conv.inner = untag_ptr(this_ptr);
36112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36114         this_ptr_conv.is_owned = false;
36115         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36116         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
36117         return ret_arr;
36118 }
36119
36120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36121         LDKFundingSigned this_ptr_conv;
36122         this_ptr_conv.inner = untag_ptr(this_ptr);
36123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36125         this_ptr_conv.is_owned = false;
36126         LDKThirtyTwoBytes val_ref;
36127         CHECK((*env)->GetArrayLength(env, val) == 32);
36128         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36129         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
36130 }
36131
36132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
36133         LDKFundingSigned this_ptr_conv;
36134         this_ptr_conv.inner = untag_ptr(this_ptr);
36135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36137         this_ptr_conv.is_owned = false;
36138         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36139         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
36140         return ret_arr;
36141 }
36142
36143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36144         LDKFundingSigned this_ptr_conv;
36145         this_ptr_conv.inner = untag_ptr(this_ptr);
36146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36148         this_ptr_conv.is_owned = false;
36149         LDKSignature val_ref;
36150         CHECK((*env)->GetArrayLength(env, val) == 64);
36151         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36152         FundingSigned_set_signature(&this_ptr_conv, val_ref);
36153 }
36154
36155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
36156         LDKThirtyTwoBytes channel_id_arg_ref;
36157         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
36158         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
36159         LDKSignature signature_arg_ref;
36160         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
36161         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
36162         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
36163         int64_t ret_ref = 0;
36164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36166         return ret_ref;
36167 }
36168
36169 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
36170         LDKFundingSigned ret_var = FundingSigned_clone(arg);
36171         int64_t ret_ref = 0;
36172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36174         return ret_ref;
36175 }
36176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36177         LDKFundingSigned arg_conv;
36178         arg_conv.inner = untag_ptr(arg);
36179         arg_conv.is_owned = ptr_is_owned(arg);
36180         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36181         arg_conv.is_owned = false;
36182         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
36183         return ret_conv;
36184 }
36185
36186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36187         LDKFundingSigned orig_conv;
36188         orig_conv.inner = untag_ptr(orig);
36189         orig_conv.is_owned = ptr_is_owned(orig);
36190         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36191         orig_conv.is_owned = false;
36192         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
36193         int64_t ret_ref = 0;
36194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36196         return ret_ref;
36197 }
36198
36199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36200         LDKFundingSigned a_conv;
36201         a_conv.inner = untag_ptr(a);
36202         a_conv.is_owned = ptr_is_owned(a);
36203         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36204         a_conv.is_owned = false;
36205         LDKFundingSigned b_conv;
36206         b_conv.inner = untag_ptr(b);
36207         b_conv.is_owned = ptr_is_owned(b);
36208         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36209         b_conv.is_owned = false;
36210         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
36211         return ret_conv;
36212 }
36213
36214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36215         LDKChannelReady this_obj_conv;
36216         this_obj_conv.inner = untag_ptr(this_obj);
36217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36219         ChannelReady_free(this_obj_conv);
36220 }
36221
36222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36223         LDKChannelReady this_ptr_conv;
36224         this_ptr_conv.inner = untag_ptr(this_ptr);
36225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36227         this_ptr_conv.is_owned = false;
36228         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36229         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
36230         return ret_arr;
36231 }
36232
36233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36234         LDKChannelReady this_ptr_conv;
36235         this_ptr_conv.inner = untag_ptr(this_ptr);
36236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36238         this_ptr_conv.is_owned = false;
36239         LDKThirtyTwoBytes val_ref;
36240         CHECK((*env)->GetArrayLength(env, val) == 32);
36241         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36242         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
36243 }
36244
36245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36246         LDKChannelReady this_ptr_conv;
36247         this_ptr_conv.inner = untag_ptr(this_ptr);
36248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36250         this_ptr_conv.is_owned = false;
36251         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36252         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
36253         return ret_arr;
36254 }
36255
36256 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) {
36257         LDKChannelReady this_ptr_conv;
36258         this_ptr_conv.inner = untag_ptr(this_ptr);
36259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36261         this_ptr_conv.is_owned = false;
36262         LDKPublicKey val_ref;
36263         CHECK((*env)->GetArrayLength(env, val) == 33);
36264         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36265         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
36266 }
36267
36268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
36269         LDKChannelReady this_ptr_conv;
36270         this_ptr_conv.inner = untag_ptr(this_ptr);
36271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36273         this_ptr_conv.is_owned = false;
36274         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36275         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
36276         int64_t ret_ref = tag_ptr(ret_copy, true);
36277         return ret_ref;
36278 }
36279
36280 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) {
36281         LDKChannelReady this_ptr_conv;
36282         this_ptr_conv.inner = untag_ptr(this_ptr);
36283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36285         this_ptr_conv.is_owned = false;
36286         void* val_ptr = untag_ptr(val);
36287         CHECK_ACCESS(val_ptr);
36288         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36289         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36290         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
36291 }
36292
36293 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) {
36294         LDKThirtyTwoBytes channel_id_arg_ref;
36295         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
36296         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
36297         LDKPublicKey next_per_commitment_point_arg_ref;
36298         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
36299         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
36300         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
36301         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
36302         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
36303         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
36304         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
36305         int64_t ret_ref = 0;
36306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36308         return ret_ref;
36309 }
36310
36311 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
36312         LDKChannelReady ret_var = ChannelReady_clone(arg);
36313         int64_t ret_ref = 0;
36314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36316         return ret_ref;
36317 }
36318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36319         LDKChannelReady arg_conv;
36320         arg_conv.inner = untag_ptr(arg);
36321         arg_conv.is_owned = ptr_is_owned(arg);
36322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36323         arg_conv.is_owned = false;
36324         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
36325         return ret_conv;
36326 }
36327
36328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36329         LDKChannelReady orig_conv;
36330         orig_conv.inner = untag_ptr(orig);
36331         orig_conv.is_owned = ptr_is_owned(orig);
36332         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36333         orig_conv.is_owned = false;
36334         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
36335         int64_t ret_ref = 0;
36336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36338         return ret_ref;
36339 }
36340
36341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36342         LDKChannelReady a_conv;
36343         a_conv.inner = untag_ptr(a);
36344         a_conv.is_owned = ptr_is_owned(a);
36345         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36346         a_conv.is_owned = false;
36347         LDKChannelReady b_conv;
36348         b_conv.inner = untag_ptr(b);
36349         b_conv.is_owned = ptr_is_owned(b);
36350         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36351         b_conv.is_owned = false;
36352         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
36353         return ret_conv;
36354 }
36355
36356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36357         LDKShutdown this_obj_conv;
36358         this_obj_conv.inner = untag_ptr(this_obj);
36359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36361         Shutdown_free(this_obj_conv);
36362 }
36363
36364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36365         LDKShutdown this_ptr_conv;
36366         this_ptr_conv.inner = untag_ptr(this_ptr);
36367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36369         this_ptr_conv.is_owned = false;
36370         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36371         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
36372         return ret_arr;
36373 }
36374
36375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36376         LDKShutdown this_ptr_conv;
36377         this_ptr_conv.inner = untag_ptr(this_ptr);
36378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36380         this_ptr_conv.is_owned = false;
36381         LDKThirtyTwoBytes val_ref;
36382         CHECK((*env)->GetArrayLength(env, val) == 32);
36383         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36384         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
36385 }
36386
36387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36388         LDKShutdown 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         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
36394         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36395         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36396         return ret_arr;
36397 }
36398
36399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36400         LDKShutdown this_ptr_conv;
36401         this_ptr_conv.inner = untag_ptr(this_ptr);
36402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36404         this_ptr_conv.is_owned = false;
36405         LDKCVec_u8Z val_ref;
36406         val_ref.datalen = (*env)->GetArrayLength(env, val);
36407         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36408         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
36409         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
36410 }
36411
36412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
36413         LDKThirtyTwoBytes channel_id_arg_ref;
36414         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
36415         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
36416         LDKCVec_u8Z scriptpubkey_arg_ref;
36417         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
36418         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36419         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
36420         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
36421         int64_t ret_ref = 0;
36422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36424         return ret_ref;
36425 }
36426
36427 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
36428         LDKShutdown ret_var = Shutdown_clone(arg);
36429         int64_t ret_ref = 0;
36430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36432         return ret_ref;
36433 }
36434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36435         LDKShutdown arg_conv;
36436         arg_conv.inner = untag_ptr(arg);
36437         arg_conv.is_owned = ptr_is_owned(arg);
36438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36439         arg_conv.is_owned = false;
36440         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
36441         return ret_conv;
36442 }
36443
36444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36445         LDKShutdown orig_conv;
36446         orig_conv.inner = untag_ptr(orig);
36447         orig_conv.is_owned = ptr_is_owned(orig);
36448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36449         orig_conv.is_owned = false;
36450         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
36451         int64_t ret_ref = 0;
36452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36454         return ret_ref;
36455 }
36456
36457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36458         LDKShutdown a_conv;
36459         a_conv.inner = untag_ptr(a);
36460         a_conv.is_owned = ptr_is_owned(a);
36461         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36462         a_conv.is_owned = false;
36463         LDKShutdown b_conv;
36464         b_conv.inner = untag_ptr(b);
36465         b_conv.is_owned = ptr_is_owned(b);
36466         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36467         b_conv.is_owned = false;
36468         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
36469         return ret_conv;
36470 }
36471
36472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36473         LDKClosingSignedFeeRange this_obj_conv;
36474         this_obj_conv.inner = untag_ptr(this_obj);
36475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36477         ClosingSignedFeeRange_free(this_obj_conv);
36478 }
36479
36480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36481         LDKClosingSignedFeeRange this_ptr_conv;
36482         this_ptr_conv.inner = untag_ptr(this_ptr);
36483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36485         this_ptr_conv.is_owned = false;
36486         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
36487         return ret_conv;
36488 }
36489
36490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36491         LDKClosingSignedFeeRange this_ptr_conv;
36492         this_ptr_conv.inner = untag_ptr(this_ptr);
36493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36495         this_ptr_conv.is_owned = false;
36496         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
36497 }
36498
36499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36500         LDKClosingSignedFeeRange this_ptr_conv;
36501         this_ptr_conv.inner = untag_ptr(this_ptr);
36502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36504         this_ptr_conv.is_owned = false;
36505         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
36506         return ret_conv;
36507 }
36508
36509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36510         LDKClosingSignedFeeRange this_ptr_conv;
36511         this_ptr_conv.inner = untag_ptr(this_ptr);
36512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36514         this_ptr_conv.is_owned = false;
36515         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
36516 }
36517
36518 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) {
36519         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
36520         int64_t ret_ref = 0;
36521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36523         return ret_ref;
36524 }
36525
36526 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
36527         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
36528         int64_t ret_ref = 0;
36529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36531         return ret_ref;
36532 }
36533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36534         LDKClosingSignedFeeRange arg_conv;
36535         arg_conv.inner = untag_ptr(arg);
36536         arg_conv.is_owned = ptr_is_owned(arg);
36537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36538         arg_conv.is_owned = false;
36539         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
36540         return ret_conv;
36541 }
36542
36543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36544         LDKClosingSignedFeeRange orig_conv;
36545         orig_conv.inner = untag_ptr(orig);
36546         orig_conv.is_owned = ptr_is_owned(orig);
36547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36548         orig_conv.is_owned = false;
36549         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
36550         int64_t ret_ref = 0;
36551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36553         return ret_ref;
36554 }
36555
36556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36557         LDKClosingSignedFeeRange a_conv;
36558         a_conv.inner = untag_ptr(a);
36559         a_conv.is_owned = ptr_is_owned(a);
36560         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36561         a_conv.is_owned = false;
36562         LDKClosingSignedFeeRange b_conv;
36563         b_conv.inner = untag_ptr(b);
36564         b_conv.is_owned = ptr_is_owned(b);
36565         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36566         b_conv.is_owned = false;
36567         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
36568         return ret_conv;
36569 }
36570
36571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36572         LDKClosingSigned this_obj_conv;
36573         this_obj_conv.inner = untag_ptr(this_obj);
36574         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36576         ClosingSigned_free(this_obj_conv);
36577 }
36578
36579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36580         LDKClosingSigned this_ptr_conv;
36581         this_ptr_conv.inner = untag_ptr(this_ptr);
36582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36584         this_ptr_conv.is_owned = false;
36585         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36586         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
36587         return ret_arr;
36588 }
36589
36590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36591         LDKClosingSigned this_ptr_conv;
36592         this_ptr_conv.inner = untag_ptr(this_ptr);
36593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36595         this_ptr_conv.is_owned = false;
36596         LDKThirtyTwoBytes val_ref;
36597         CHECK((*env)->GetArrayLength(env, val) == 32);
36598         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36599         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
36600 }
36601
36602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36603         LDKClosingSigned this_ptr_conv;
36604         this_ptr_conv.inner = untag_ptr(this_ptr);
36605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36607         this_ptr_conv.is_owned = false;
36608         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
36609         return ret_conv;
36610 }
36611
36612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36613         LDKClosingSigned this_ptr_conv;
36614         this_ptr_conv.inner = untag_ptr(this_ptr);
36615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36617         this_ptr_conv.is_owned = false;
36618         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
36619 }
36620
36621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
36622         LDKClosingSigned this_ptr_conv;
36623         this_ptr_conv.inner = untag_ptr(this_ptr);
36624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36626         this_ptr_conv.is_owned = false;
36627         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36628         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
36629         return ret_arr;
36630 }
36631
36632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36633         LDKClosingSigned 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         LDKSignature val_ref;
36639         CHECK((*env)->GetArrayLength(env, val) == 64);
36640         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36641         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
36642 }
36643
36644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
36645         LDKClosingSigned this_ptr_conv;
36646         this_ptr_conv.inner = untag_ptr(this_ptr);
36647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36649         this_ptr_conv.is_owned = false;
36650         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
36651         int64_t ret_ref = 0;
36652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36654         return ret_ref;
36655 }
36656
36657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36658         LDKClosingSigned this_ptr_conv;
36659         this_ptr_conv.inner = untag_ptr(this_ptr);
36660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36662         this_ptr_conv.is_owned = false;
36663         LDKClosingSignedFeeRange val_conv;
36664         val_conv.inner = untag_ptr(val);
36665         val_conv.is_owned = ptr_is_owned(val);
36666         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36667         val_conv = ClosingSignedFeeRange_clone(&val_conv);
36668         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
36669 }
36670
36671 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) {
36672         LDKThirtyTwoBytes channel_id_arg_ref;
36673         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
36674         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
36675         LDKSignature signature_arg_ref;
36676         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
36677         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
36678         LDKClosingSignedFeeRange fee_range_arg_conv;
36679         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
36680         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
36681         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
36682         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
36683         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
36684         int64_t ret_ref = 0;
36685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36687         return ret_ref;
36688 }
36689
36690 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
36691         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
36692         int64_t ret_ref = 0;
36693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36695         return ret_ref;
36696 }
36697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36698         LDKClosingSigned arg_conv;
36699         arg_conv.inner = untag_ptr(arg);
36700         arg_conv.is_owned = ptr_is_owned(arg);
36701         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36702         arg_conv.is_owned = false;
36703         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
36704         return ret_conv;
36705 }
36706
36707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36708         LDKClosingSigned orig_conv;
36709         orig_conv.inner = untag_ptr(orig);
36710         orig_conv.is_owned = ptr_is_owned(orig);
36711         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36712         orig_conv.is_owned = false;
36713         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
36714         int64_t ret_ref = 0;
36715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36717         return ret_ref;
36718 }
36719
36720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36721         LDKClosingSigned a_conv;
36722         a_conv.inner = untag_ptr(a);
36723         a_conv.is_owned = ptr_is_owned(a);
36724         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36725         a_conv.is_owned = false;
36726         LDKClosingSigned b_conv;
36727         b_conv.inner = untag_ptr(b);
36728         b_conv.is_owned = ptr_is_owned(b);
36729         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36730         b_conv.is_owned = false;
36731         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
36732         return ret_conv;
36733 }
36734
36735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36736         LDKUpdateAddHTLC this_obj_conv;
36737         this_obj_conv.inner = untag_ptr(this_obj);
36738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36740         UpdateAddHTLC_free(this_obj_conv);
36741 }
36742
36743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36744         LDKUpdateAddHTLC this_ptr_conv;
36745         this_ptr_conv.inner = untag_ptr(this_ptr);
36746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36748         this_ptr_conv.is_owned = false;
36749         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36750         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
36751         return ret_arr;
36752 }
36753
36754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36755         LDKUpdateAddHTLC this_ptr_conv;
36756         this_ptr_conv.inner = untag_ptr(this_ptr);
36757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36759         this_ptr_conv.is_owned = false;
36760         LDKThirtyTwoBytes val_ref;
36761         CHECK((*env)->GetArrayLength(env, val) == 32);
36762         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36763         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
36764 }
36765
36766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36767         LDKUpdateAddHTLC this_ptr_conv;
36768         this_ptr_conv.inner = untag_ptr(this_ptr);
36769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36771         this_ptr_conv.is_owned = false;
36772         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
36773         return ret_conv;
36774 }
36775
36776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36777         LDKUpdateAddHTLC this_ptr_conv;
36778         this_ptr_conv.inner = untag_ptr(this_ptr);
36779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36781         this_ptr_conv.is_owned = false;
36782         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
36783 }
36784
36785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36786         LDKUpdateAddHTLC 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 = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
36792         return ret_conv;
36793 }
36794
36795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36796         LDKUpdateAddHTLC 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         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
36802 }
36803
36804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36805         LDKUpdateAddHTLC 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36811         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
36812         return ret_arr;
36813 }
36814
36815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36816         LDKUpdateAddHTLC this_ptr_conv;
36817         this_ptr_conv.inner = untag_ptr(this_ptr);
36818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36820         this_ptr_conv.is_owned = false;
36821         LDKThirtyTwoBytes val_ref;
36822         CHECK((*env)->GetArrayLength(env, val) == 32);
36823         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36824         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
36825 }
36826
36827 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
36828         LDKUpdateAddHTLC this_ptr_conv;
36829         this_ptr_conv.inner = untag_ptr(this_ptr);
36830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36832         this_ptr_conv.is_owned = false;
36833         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
36834         return ret_conv;
36835 }
36836
36837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36838         LDKUpdateAddHTLC this_ptr_conv;
36839         this_ptr_conv.inner = untag_ptr(this_ptr);
36840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36842         this_ptr_conv.is_owned = false;
36843         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
36844 }
36845
36846 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
36847         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
36848         int64_t ret_ref = 0;
36849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36851         return ret_ref;
36852 }
36853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36854         LDKUpdateAddHTLC arg_conv;
36855         arg_conv.inner = untag_ptr(arg);
36856         arg_conv.is_owned = ptr_is_owned(arg);
36857         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36858         arg_conv.is_owned = false;
36859         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
36860         return ret_conv;
36861 }
36862
36863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36864         LDKUpdateAddHTLC orig_conv;
36865         orig_conv.inner = untag_ptr(orig);
36866         orig_conv.is_owned = ptr_is_owned(orig);
36867         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36868         orig_conv.is_owned = false;
36869         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
36870         int64_t ret_ref = 0;
36871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36873         return ret_ref;
36874 }
36875
36876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36877         LDKUpdateAddHTLC a_conv;
36878         a_conv.inner = untag_ptr(a);
36879         a_conv.is_owned = ptr_is_owned(a);
36880         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36881         a_conv.is_owned = false;
36882         LDKUpdateAddHTLC b_conv;
36883         b_conv.inner = untag_ptr(b);
36884         b_conv.is_owned = ptr_is_owned(b);
36885         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36886         b_conv.is_owned = false;
36887         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
36888         return ret_conv;
36889 }
36890
36891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36892         LDKOnionMessage this_obj_conv;
36893         this_obj_conv.inner = untag_ptr(this_obj);
36894         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36896         OnionMessage_free(this_obj_conv);
36897 }
36898
36899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36900         LDKOnionMessage this_ptr_conv;
36901         this_ptr_conv.inner = untag_ptr(this_ptr);
36902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36904         this_ptr_conv.is_owned = false;
36905         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36906         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
36907         return ret_arr;
36908 }
36909
36910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36911         LDKOnionMessage this_ptr_conv;
36912         this_ptr_conv.inner = untag_ptr(this_ptr);
36913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36915         this_ptr_conv.is_owned = false;
36916         LDKPublicKey val_ref;
36917         CHECK((*env)->GetArrayLength(env, val) == 33);
36918         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36919         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
36920 }
36921
36922 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
36923         LDKOnionMessage ret_var = OnionMessage_clone(arg);
36924         int64_t ret_ref = 0;
36925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36927         return ret_ref;
36928 }
36929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36930         LDKOnionMessage arg_conv;
36931         arg_conv.inner = untag_ptr(arg);
36932         arg_conv.is_owned = ptr_is_owned(arg);
36933         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36934         arg_conv.is_owned = false;
36935         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
36936         return ret_conv;
36937 }
36938
36939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36940         LDKOnionMessage orig_conv;
36941         orig_conv.inner = untag_ptr(orig);
36942         orig_conv.is_owned = ptr_is_owned(orig);
36943         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36944         orig_conv.is_owned = false;
36945         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
36946         int64_t ret_ref = 0;
36947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36949         return ret_ref;
36950 }
36951
36952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36953         LDKOnionMessage a_conv;
36954         a_conv.inner = untag_ptr(a);
36955         a_conv.is_owned = ptr_is_owned(a);
36956         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36957         a_conv.is_owned = false;
36958         LDKOnionMessage b_conv;
36959         b_conv.inner = untag_ptr(b);
36960         b_conv.is_owned = ptr_is_owned(b);
36961         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36962         b_conv.is_owned = false;
36963         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
36964         return ret_conv;
36965 }
36966
36967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36968         LDKUpdateFulfillHTLC this_obj_conv;
36969         this_obj_conv.inner = untag_ptr(this_obj);
36970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36972         UpdateFulfillHTLC_free(this_obj_conv);
36973 }
36974
36975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36976         LDKUpdateFulfillHTLC this_ptr_conv;
36977         this_ptr_conv.inner = untag_ptr(this_ptr);
36978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36980         this_ptr_conv.is_owned = false;
36981         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36982         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
36983         return ret_arr;
36984 }
36985
36986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36987         LDKUpdateFulfillHTLC this_ptr_conv;
36988         this_ptr_conv.inner = untag_ptr(this_ptr);
36989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36991         this_ptr_conv.is_owned = false;
36992         LDKThirtyTwoBytes val_ref;
36993         CHECK((*env)->GetArrayLength(env, val) == 32);
36994         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36995         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
36996 }
36997
36998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36999         LDKUpdateFulfillHTLC 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         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
37005         return ret_conv;
37006 }
37007
37008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37009         LDKUpdateFulfillHTLC this_ptr_conv;
37010         this_ptr_conv.inner = untag_ptr(this_ptr);
37011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37013         this_ptr_conv.is_owned = false;
37014         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
37015 }
37016
37017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
37018         LDKUpdateFulfillHTLC this_ptr_conv;
37019         this_ptr_conv.inner = untag_ptr(this_ptr);
37020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37022         this_ptr_conv.is_owned = false;
37023         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37024         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
37025         return ret_arr;
37026 }
37027
37028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37029         LDKUpdateFulfillHTLC this_ptr_conv;
37030         this_ptr_conv.inner = untag_ptr(this_ptr);
37031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37033         this_ptr_conv.is_owned = false;
37034         LDKThirtyTwoBytes val_ref;
37035         CHECK((*env)->GetArrayLength(env, val) == 32);
37036         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37037         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
37038 }
37039
37040 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) {
37041         LDKThirtyTwoBytes channel_id_arg_ref;
37042         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
37043         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
37044         LDKThirtyTwoBytes payment_preimage_arg_ref;
37045         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
37046         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
37047         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
37048         int64_t ret_ref = 0;
37049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37051         return ret_ref;
37052 }
37053
37054 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
37055         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
37056         int64_t ret_ref = 0;
37057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37059         return ret_ref;
37060 }
37061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37062         LDKUpdateFulfillHTLC arg_conv;
37063         arg_conv.inner = untag_ptr(arg);
37064         arg_conv.is_owned = ptr_is_owned(arg);
37065         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37066         arg_conv.is_owned = false;
37067         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
37068         return ret_conv;
37069 }
37070
37071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37072         LDKUpdateFulfillHTLC orig_conv;
37073         orig_conv.inner = untag_ptr(orig);
37074         orig_conv.is_owned = ptr_is_owned(orig);
37075         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37076         orig_conv.is_owned = false;
37077         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
37078         int64_t ret_ref = 0;
37079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37081         return ret_ref;
37082 }
37083
37084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37085         LDKUpdateFulfillHTLC a_conv;
37086         a_conv.inner = untag_ptr(a);
37087         a_conv.is_owned = ptr_is_owned(a);
37088         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37089         a_conv.is_owned = false;
37090         LDKUpdateFulfillHTLC b_conv;
37091         b_conv.inner = untag_ptr(b);
37092         b_conv.is_owned = ptr_is_owned(b);
37093         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37094         b_conv.is_owned = false;
37095         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
37096         return ret_conv;
37097 }
37098
37099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37100         LDKUpdateFailHTLC this_obj_conv;
37101         this_obj_conv.inner = untag_ptr(this_obj);
37102         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37104         UpdateFailHTLC_free(this_obj_conv);
37105 }
37106
37107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37108         LDKUpdateFailHTLC this_ptr_conv;
37109         this_ptr_conv.inner = untag_ptr(this_ptr);
37110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37112         this_ptr_conv.is_owned = false;
37113         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37114         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
37115         return ret_arr;
37116 }
37117
37118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37119         LDKUpdateFailHTLC this_ptr_conv;
37120         this_ptr_conv.inner = untag_ptr(this_ptr);
37121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37123         this_ptr_conv.is_owned = false;
37124         LDKThirtyTwoBytes val_ref;
37125         CHECK((*env)->GetArrayLength(env, val) == 32);
37126         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37127         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
37128 }
37129
37130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37131         LDKUpdateFailHTLC this_ptr_conv;
37132         this_ptr_conv.inner = untag_ptr(this_ptr);
37133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37135         this_ptr_conv.is_owned = false;
37136         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
37137         return ret_conv;
37138 }
37139
37140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37141         LDKUpdateFailHTLC this_ptr_conv;
37142         this_ptr_conv.inner = untag_ptr(this_ptr);
37143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37145         this_ptr_conv.is_owned = false;
37146         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
37147 }
37148
37149 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
37150         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
37151         int64_t ret_ref = 0;
37152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37154         return ret_ref;
37155 }
37156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37157         LDKUpdateFailHTLC arg_conv;
37158         arg_conv.inner = untag_ptr(arg);
37159         arg_conv.is_owned = ptr_is_owned(arg);
37160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37161         arg_conv.is_owned = false;
37162         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
37163         return ret_conv;
37164 }
37165
37166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37167         LDKUpdateFailHTLC orig_conv;
37168         orig_conv.inner = untag_ptr(orig);
37169         orig_conv.is_owned = ptr_is_owned(orig);
37170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37171         orig_conv.is_owned = false;
37172         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
37173         int64_t ret_ref = 0;
37174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37176         return ret_ref;
37177 }
37178
37179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37180         LDKUpdateFailHTLC a_conv;
37181         a_conv.inner = untag_ptr(a);
37182         a_conv.is_owned = ptr_is_owned(a);
37183         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37184         a_conv.is_owned = false;
37185         LDKUpdateFailHTLC b_conv;
37186         b_conv.inner = untag_ptr(b);
37187         b_conv.is_owned = ptr_is_owned(b);
37188         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37189         b_conv.is_owned = false;
37190         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
37191         return ret_conv;
37192 }
37193
37194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37195         LDKUpdateFailMalformedHTLC this_obj_conv;
37196         this_obj_conv.inner = untag_ptr(this_obj);
37197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37199         UpdateFailMalformedHTLC_free(this_obj_conv);
37200 }
37201
37202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37203         LDKUpdateFailMalformedHTLC this_ptr_conv;
37204         this_ptr_conv.inner = untag_ptr(this_ptr);
37205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37207         this_ptr_conv.is_owned = false;
37208         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37209         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
37210         return ret_arr;
37211 }
37212
37213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37214         LDKUpdateFailMalformedHTLC this_ptr_conv;
37215         this_ptr_conv.inner = untag_ptr(this_ptr);
37216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37218         this_ptr_conv.is_owned = false;
37219         LDKThirtyTwoBytes val_ref;
37220         CHECK((*env)->GetArrayLength(env, val) == 32);
37221         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37222         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
37223 }
37224
37225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37226         LDKUpdateFailMalformedHTLC this_ptr_conv;
37227         this_ptr_conv.inner = untag_ptr(this_ptr);
37228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37230         this_ptr_conv.is_owned = false;
37231         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
37232         return ret_conv;
37233 }
37234
37235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37236         LDKUpdateFailMalformedHTLC this_ptr_conv;
37237         this_ptr_conv.inner = untag_ptr(this_ptr);
37238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37240         this_ptr_conv.is_owned = false;
37241         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
37242 }
37243
37244 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
37245         LDKUpdateFailMalformedHTLC this_ptr_conv;
37246         this_ptr_conv.inner = untag_ptr(this_ptr);
37247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37249         this_ptr_conv.is_owned = false;
37250         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
37251         return ret_conv;
37252 }
37253
37254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
37255         LDKUpdateFailMalformedHTLC this_ptr_conv;
37256         this_ptr_conv.inner = untag_ptr(this_ptr);
37257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37259         this_ptr_conv.is_owned = false;
37260         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
37261 }
37262
37263 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
37264         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
37265         int64_t ret_ref = 0;
37266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37268         return ret_ref;
37269 }
37270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37271         LDKUpdateFailMalformedHTLC arg_conv;
37272         arg_conv.inner = untag_ptr(arg);
37273         arg_conv.is_owned = ptr_is_owned(arg);
37274         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37275         arg_conv.is_owned = false;
37276         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
37277         return ret_conv;
37278 }
37279
37280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37281         LDKUpdateFailMalformedHTLC orig_conv;
37282         orig_conv.inner = untag_ptr(orig);
37283         orig_conv.is_owned = ptr_is_owned(orig);
37284         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37285         orig_conv.is_owned = false;
37286         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
37287         int64_t ret_ref = 0;
37288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37290         return ret_ref;
37291 }
37292
37293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37294         LDKUpdateFailMalformedHTLC a_conv;
37295         a_conv.inner = untag_ptr(a);
37296         a_conv.is_owned = ptr_is_owned(a);
37297         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37298         a_conv.is_owned = false;
37299         LDKUpdateFailMalformedHTLC b_conv;
37300         b_conv.inner = untag_ptr(b);
37301         b_conv.is_owned = ptr_is_owned(b);
37302         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37303         b_conv.is_owned = false;
37304         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
37305         return ret_conv;
37306 }
37307
37308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37309         LDKCommitmentSigned this_obj_conv;
37310         this_obj_conv.inner = untag_ptr(this_obj);
37311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37313         CommitmentSigned_free(this_obj_conv);
37314 }
37315
37316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37317         LDKCommitmentSigned this_ptr_conv;
37318         this_ptr_conv.inner = untag_ptr(this_ptr);
37319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37321         this_ptr_conv.is_owned = false;
37322         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37323         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
37324         return ret_arr;
37325 }
37326
37327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37328         LDKCommitmentSigned this_ptr_conv;
37329         this_ptr_conv.inner = untag_ptr(this_ptr);
37330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37332         this_ptr_conv.is_owned = false;
37333         LDKThirtyTwoBytes val_ref;
37334         CHECK((*env)->GetArrayLength(env, val) == 32);
37335         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37336         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
37337 }
37338
37339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
37340         LDKCommitmentSigned 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
37346         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
37347         return ret_arr;
37348 }
37349
37350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37351         LDKCommitmentSigned this_ptr_conv;
37352         this_ptr_conv.inner = untag_ptr(this_ptr);
37353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37355         this_ptr_conv.is_owned = false;
37356         LDKSignature val_ref;
37357         CHECK((*env)->GetArrayLength(env, val) == 64);
37358         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
37359         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
37360 }
37361
37362 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
37363         LDKCommitmentSigned this_ptr_conv;
37364         this_ptr_conv.inner = untag_ptr(this_ptr);
37365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37367         this_ptr_conv.is_owned = false;
37368         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
37369         jobjectArray ret_arr = NULL;
37370         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
37371         ;
37372         for (size_t i = 0; i < ret_var.datalen; i++) {
37373                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
37374                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
37375                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
37376         }
37377         
37378         FREE(ret_var.data);
37379         return ret_arr;
37380 }
37381
37382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
37383         LDKCommitmentSigned this_ptr_conv;
37384         this_ptr_conv.inner = untag_ptr(this_ptr);
37385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37387         this_ptr_conv.is_owned = false;
37388         LDKCVec_SignatureZ val_constr;
37389         val_constr.datalen = (*env)->GetArrayLength(env, val);
37390         if (val_constr.datalen > 0)
37391                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37392         else
37393                 val_constr.data = NULL;
37394         for (size_t i = 0; i < val_constr.datalen; i++) {
37395                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
37396                 LDKSignature val_conv_8_ref;
37397                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
37398                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
37399                 val_constr.data[i] = val_conv_8_ref;
37400         }
37401         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
37402 }
37403
37404 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) {
37405         LDKThirtyTwoBytes channel_id_arg_ref;
37406         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
37407         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
37408         LDKSignature signature_arg_ref;
37409         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
37410         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
37411         LDKCVec_SignatureZ htlc_signatures_arg_constr;
37412         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
37413         if (htlc_signatures_arg_constr.datalen > 0)
37414                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37415         else
37416                 htlc_signatures_arg_constr.data = NULL;
37417         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
37418                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
37419                 LDKSignature htlc_signatures_arg_conv_8_ref;
37420                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
37421                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
37422                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
37423         }
37424         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
37425         int64_t ret_ref = 0;
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37428         return ret_ref;
37429 }
37430
37431 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
37432         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
37433         int64_t ret_ref = 0;
37434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37436         return ret_ref;
37437 }
37438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37439         LDKCommitmentSigned arg_conv;
37440         arg_conv.inner = untag_ptr(arg);
37441         arg_conv.is_owned = ptr_is_owned(arg);
37442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37443         arg_conv.is_owned = false;
37444         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
37445         return ret_conv;
37446 }
37447
37448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37449         LDKCommitmentSigned orig_conv;
37450         orig_conv.inner = untag_ptr(orig);
37451         orig_conv.is_owned = ptr_is_owned(orig);
37452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37453         orig_conv.is_owned = false;
37454         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
37455         int64_t ret_ref = 0;
37456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37458         return ret_ref;
37459 }
37460
37461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37462         LDKCommitmentSigned a_conv;
37463         a_conv.inner = untag_ptr(a);
37464         a_conv.is_owned = ptr_is_owned(a);
37465         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37466         a_conv.is_owned = false;
37467         LDKCommitmentSigned b_conv;
37468         b_conv.inner = untag_ptr(b);
37469         b_conv.is_owned = ptr_is_owned(b);
37470         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37471         b_conv.is_owned = false;
37472         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
37473         return ret_conv;
37474 }
37475
37476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37477         LDKRevokeAndACK this_obj_conv;
37478         this_obj_conv.inner = untag_ptr(this_obj);
37479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37481         RevokeAndACK_free(this_obj_conv);
37482 }
37483
37484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37485         LDKRevokeAndACK this_ptr_conv;
37486         this_ptr_conv.inner = untag_ptr(this_ptr);
37487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37489         this_ptr_conv.is_owned = false;
37490         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37491         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
37492         return ret_arr;
37493 }
37494
37495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37496         LDKRevokeAndACK this_ptr_conv;
37497         this_ptr_conv.inner = untag_ptr(this_ptr);
37498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37500         this_ptr_conv.is_owned = false;
37501         LDKThirtyTwoBytes val_ref;
37502         CHECK((*env)->GetArrayLength(env, val) == 32);
37503         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37504         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
37505 }
37506
37507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
37508         LDKRevokeAndACK this_ptr_conv;
37509         this_ptr_conv.inner = untag_ptr(this_ptr);
37510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37512         this_ptr_conv.is_owned = false;
37513         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37514         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
37515         return ret_arr;
37516 }
37517
37518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37519         LDKRevokeAndACK this_ptr_conv;
37520         this_ptr_conv.inner = untag_ptr(this_ptr);
37521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37523         this_ptr_conv.is_owned = false;
37524         LDKThirtyTwoBytes val_ref;
37525         CHECK((*env)->GetArrayLength(env, val) == 32);
37526         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37527         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
37528 }
37529
37530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37531         LDKRevokeAndACK this_ptr_conv;
37532         this_ptr_conv.inner = untag_ptr(this_ptr);
37533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37535         this_ptr_conv.is_owned = false;
37536         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37537         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
37538         return ret_arr;
37539 }
37540
37541 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) {
37542         LDKRevokeAndACK this_ptr_conv;
37543         this_ptr_conv.inner = untag_ptr(this_ptr);
37544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37546         this_ptr_conv.is_owned = false;
37547         LDKPublicKey val_ref;
37548         CHECK((*env)->GetArrayLength(env, val) == 33);
37549         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37550         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
37551 }
37552
37553 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) {
37554         LDKThirtyTwoBytes channel_id_arg_ref;
37555         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
37556         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
37557         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
37558         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
37559         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
37560         LDKPublicKey next_per_commitment_point_arg_ref;
37561         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
37562         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
37563         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
37564         int64_t ret_ref = 0;
37565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37567         return ret_ref;
37568 }
37569
37570 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
37571         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
37572         int64_t ret_ref = 0;
37573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37575         return ret_ref;
37576 }
37577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37578         LDKRevokeAndACK arg_conv;
37579         arg_conv.inner = untag_ptr(arg);
37580         arg_conv.is_owned = ptr_is_owned(arg);
37581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37582         arg_conv.is_owned = false;
37583         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
37584         return ret_conv;
37585 }
37586
37587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37588         LDKRevokeAndACK orig_conv;
37589         orig_conv.inner = untag_ptr(orig);
37590         orig_conv.is_owned = ptr_is_owned(orig);
37591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37592         orig_conv.is_owned = false;
37593         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
37594         int64_t ret_ref = 0;
37595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37597         return ret_ref;
37598 }
37599
37600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37601         LDKRevokeAndACK a_conv;
37602         a_conv.inner = untag_ptr(a);
37603         a_conv.is_owned = ptr_is_owned(a);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37605         a_conv.is_owned = false;
37606         LDKRevokeAndACK b_conv;
37607         b_conv.inner = untag_ptr(b);
37608         b_conv.is_owned = ptr_is_owned(b);
37609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37610         b_conv.is_owned = false;
37611         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
37612         return ret_conv;
37613 }
37614
37615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37616         LDKUpdateFee this_obj_conv;
37617         this_obj_conv.inner = untag_ptr(this_obj);
37618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37620         UpdateFee_free(this_obj_conv);
37621 }
37622
37623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37624         LDKUpdateFee this_ptr_conv;
37625         this_ptr_conv.inner = untag_ptr(this_ptr);
37626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37628         this_ptr_conv.is_owned = false;
37629         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
37631         return ret_arr;
37632 }
37633
37634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37635         LDKUpdateFee this_ptr_conv;
37636         this_ptr_conv.inner = untag_ptr(this_ptr);
37637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37639         this_ptr_conv.is_owned = false;
37640         LDKThirtyTwoBytes val_ref;
37641         CHECK((*env)->GetArrayLength(env, val) == 32);
37642         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37643         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
37644 }
37645
37646 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
37647         LDKUpdateFee this_ptr_conv;
37648         this_ptr_conv.inner = untag_ptr(this_ptr);
37649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37651         this_ptr_conv.is_owned = false;
37652         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
37653         return ret_conv;
37654 }
37655
37656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37657         LDKUpdateFee this_ptr_conv;
37658         this_ptr_conv.inner = untag_ptr(this_ptr);
37659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37661         this_ptr_conv.is_owned = false;
37662         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
37663 }
37664
37665 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) {
37666         LDKThirtyTwoBytes channel_id_arg_ref;
37667         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
37668         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
37669         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
37670         int64_t ret_ref = 0;
37671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37673         return ret_ref;
37674 }
37675
37676 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
37677         LDKUpdateFee ret_var = UpdateFee_clone(arg);
37678         int64_t ret_ref = 0;
37679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37681         return ret_ref;
37682 }
37683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37684         LDKUpdateFee arg_conv;
37685         arg_conv.inner = untag_ptr(arg);
37686         arg_conv.is_owned = ptr_is_owned(arg);
37687         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37688         arg_conv.is_owned = false;
37689         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
37690         return ret_conv;
37691 }
37692
37693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37694         LDKUpdateFee orig_conv;
37695         orig_conv.inner = untag_ptr(orig);
37696         orig_conv.is_owned = ptr_is_owned(orig);
37697         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37698         orig_conv.is_owned = false;
37699         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
37700         int64_t ret_ref = 0;
37701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37703         return ret_ref;
37704 }
37705
37706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37707         LDKUpdateFee a_conv;
37708         a_conv.inner = untag_ptr(a);
37709         a_conv.is_owned = ptr_is_owned(a);
37710         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37711         a_conv.is_owned = false;
37712         LDKUpdateFee b_conv;
37713         b_conv.inner = untag_ptr(b);
37714         b_conv.is_owned = ptr_is_owned(b);
37715         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37716         b_conv.is_owned = false;
37717         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
37718         return ret_conv;
37719 }
37720
37721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37722         LDKDataLossProtect this_obj_conv;
37723         this_obj_conv.inner = untag_ptr(this_obj);
37724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37726         DataLossProtect_free(this_obj_conv);
37727 }
37728
37729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
37730         LDKDataLossProtect this_ptr_conv;
37731         this_ptr_conv.inner = untag_ptr(this_ptr);
37732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37734         this_ptr_conv.is_owned = false;
37735         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37736         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
37737         return ret_arr;
37738 }
37739
37740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37741         LDKDataLossProtect this_ptr_conv;
37742         this_ptr_conv.inner = untag_ptr(this_ptr);
37743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37745         this_ptr_conv.is_owned = false;
37746         LDKThirtyTwoBytes val_ref;
37747         CHECK((*env)->GetArrayLength(env, val) == 32);
37748         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37749         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
37750 }
37751
37752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37753         LDKDataLossProtect this_ptr_conv;
37754         this_ptr_conv.inner = untag_ptr(this_ptr);
37755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37757         this_ptr_conv.is_owned = false;
37758         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37759         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
37760         return ret_arr;
37761 }
37762
37763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37764         LDKDataLossProtect this_ptr_conv;
37765         this_ptr_conv.inner = untag_ptr(this_ptr);
37766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37768         this_ptr_conv.is_owned = false;
37769         LDKPublicKey val_ref;
37770         CHECK((*env)->GetArrayLength(env, val) == 33);
37771         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37772         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
37773 }
37774
37775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv *env, jclass clz, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
37776         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
37777         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
37778         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
37779         LDKPublicKey my_current_per_commitment_point_arg_ref;
37780         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
37781         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
37782         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
37783         int64_t ret_ref = 0;
37784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37786         return ret_ref;
37787 }
37788
37789 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
37790         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
37791         int64_t ret_ref = 0;
37792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37794         return ret_ref;
37795 }
37796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37797         LDKDataLossProtect arg_conv;
37798         arg_conv.inner = untag_ptr(arg);
37799         arg_conv.is_owned = ptr_is_owned(arg);
37800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37801         arg_conv.is_owned = false;
37802         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
37803         return ret_conv;
37804 }
37805
37806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37807         LDKDataLossProtect orig_conv;
37808         orig_conv.inner = untag_ptr(orig);
37809         orig_conv.is_owned = ptr_is_owned(orig);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37811         orig_conv.is_owned = false;
37812         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
37813         int64_t ret_ref = 0;
37814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37816         return ret_ref;
37817 }
37818
37819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37820         LDKDataLossProtect a_conv;
37821         a_conv.inner = untag_ptr(a);
37822         a_conv.is_owned = ptr_is_owned(a);
37823         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37824         a_conv.is_owned = false;
37825         LDKDataLossProtect b_conv;
37826         b_conv.inner = untag_ptr(b);
37827         b_conv.is_owned = ptr_is_owned(b);
37828         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37829         b_conv.is_owned = false;
37830         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
37831         return ret_conv;
37832 }
37833
37834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37835         LDKChannelReestablish this_obj_conv;
37836         this_obj_conv.inner = untag_ptr(this_obj);
37837         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37839         ChannelReestablish_free(this_obj_conv);
37840 }
37841
37842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37843         LDKChannelReestablish this_ptr_conv;
37844         this_ptr_conv.inner = untag_ptr(this_ptr);
37845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37847         this_ptr_conv.is_owned = false;
37848         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37849         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
37850         return ret_arr;
37851 }
37852
37853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37854         LDKChannelReestablish this_ptr_conv;
37855         this_ptr_conv.inner = untag_ptr(this_ptr);
37856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37858         this_ptr_conv.is_owned = false;
37859         LDKThirtyTwoBytes val_ref;
37860         CHECK((*env)->GetArrayLength(env, val) == 32);
37861         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37862         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
37863 }
37864
37865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
37866         LDKChannelReestablish this_ptr_conv;
37867         this_ptr_conv.inner = untag_ptr(this_ptr);
37868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37870         this_ptr_conv.is_owned = false;
37871         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
37872         return ret_conv;
37873 }
37874
37875 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) {
37876         LDKChannelReestablish this_ptr_conv;
37877         this_ptr_conv.inner = untag_ptr(this_ptr);
37878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37880         this_ptr_conv.is_owned = false;
37881         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
37882 }
37883
37884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
37885         LDKChannelReestablish this_ptr_conv;
37886         this_ptr_conv.inner = untag_ptr(this_ptr);
37887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37889         this_ptr_conv.is_owned = false;
37890         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
37891         return ret_conv;
37892 }
37893
37894 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) {
37895         LDKChannelReestablish this_ptr_conv;
37896         this_ptr_conv.inner = untag_ptr(this_ptr);
37897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37899         this_ptr_conv.is_owned = false;
37900         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
37901 }
37902
37903 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
37904         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
37905         int64_t ret_ref = 0;
37906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37908         return ret_ref;
37909 }
37910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37911         LDKChannelReestablish arg_conv;
37912         arg_conv.inner = untag_ptr(arg);
37913         arg_conv.is_owned = ptr_is_owned(arg);
37914         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37915         arg_conv.is_owned = false;
37916         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
37917         return ret_conv;
37918 }
37919
37920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37921         LDKChannelReestablish orig_conv;
37922         orig_conv.inner = untag_ptr(orig);
37923         orig_conv.is_owned = ptr_is_owned(orig);
37924         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37925         orig_conv.is_owned = false;
37926         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
37927         int64_t ret_ref = 0;
37928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37930         return ret_ref;
37931 }
37932
37933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37934         LDKChannelReestablish a_conv;
37935         a_conv.inner = untag_ptr(a);
37936         a_conv.is_owned = ptr_is_owned(a);
37937         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37938         a_conv.is_owned = false;
37939         LDKChannelReestablish b_conv;
37940         b_conv.inner = untag_ptr(b);
37941         b_conv.is_owned = ptr_is_owned(b);
37942         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37943         b_conv.is_owned = false;
37944         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
37945         return ret_conv;
37946 }
37947
37948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37949         LDKAnnouncementSignatures this_obj_conv;
37950         this_obj_conv.inner = untag_ptr(this_obj);
37951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37953         AnnouncementSignatures_free(this_obj_conv);
37954 }
37955
37956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37957         LDKAnnouncementSignatures this_ptr_conv;
37958         this_ptr_conv.inner = untag_ptr(this_ptr);
37959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37961         this_ptr_conv.is_owned = false;
37962         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37963         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
37964         return ret_arr;
37965 }
37966
37967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37968         LDKAnnouncementSignatures this_ptr_conv;
37969         this_ptr_conv.inner = untag_ptr(this_ptr);
37970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37972         this_ptr_conv.is_owned = false;
37973         LDKThirtyTwoBytes val_ref;
37974         CHECK((*env)->GetArrayLength(env, val) == 32);
37975         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37976         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
37977 }
37978
37979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37980         LDKAnnouncementSignatures this_ptr_conv;
37981         this_ptr_conv.inner = untag_ptr(this_ptr);
37982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37984         this_ptr_conv.is_owned = false;
37985         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
37986         return ret_conv;
37987 }
37988
37989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37990         LDKAnnouncementSignatures this_ptr_conv;
37991         this_ptr_conv.inner = untag_ptr(this_ptr);
37992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37994         this_ptr_conv.is_owned = false;
37995         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
37996 }
37997
37998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
37999         LDKAnnouncementSignatures this_ptr_conv;
38000         this_ptr_conv.inner = untag_ptr(this_ptr);
38001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38003         this_ptr_conv.is_owned = false;
38004         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38005         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
38006         return ret_arr;
38007 }
38008
38009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38010         LDKAnnouncementSignatures this_ptr_conv;
38011         this_ptr_conv.inner = untag_ptr(this_ptr);
38012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38014         this_ptr_conv.is_owned = false;
38015         LDKSignature val_ref;
38016         CHECK((*env)->GetArrayLength(env, val) == 64);
38017         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38018         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
38019 }
38020
38021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
38022         LDKAnnouncementSignatures this_ptr_conv;
38023         this_ptr_conv.inner = untag_ptr(this_ptr);
38024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38026         this_ptr_conv.is_owned = false;
38027         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38028         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
38029         return ret_arr;
38030 }
38031
38032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38033         LDKAnnouncementSignatures this_ptr_conv;
38034         this_ptr_conv.inner = untag_ptr(this_ptr);
38035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38037         this_ptr_conv.is_owned = false;
38038         LDKSignature val_ref;
38039         CHECK((*env)->GetArrayLength(env, val) == 64);
38040         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38041         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
38042 }
38043
38044 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) {
38045         LDKThirtyTwoBytes channel_id_arg_ref;
38046         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
38047         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
38048         LDKSignature node_signature_arg_ref;
38049         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
38050         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
38051         LDKSignature bitcoin_signature_arg_ref;
38052         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
38053         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
38054         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
38055         int64_t ret_ref = 0;
38056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38058         return ret_ref;
38059 }
38060
38061 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
38062         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
38063         int64_t ret_ref = 0;
38064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38066         return ret_ref;
38067 }
38068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38069         LDKAnnouncementSignatures arg_conv;
38070         arg_conv.inner = untag_ptr(arg);
38071         arg_conv.is_owned = ptr_is_owned(arg);
38072         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38073         arg_conv.is_owned = false;
38074         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
38075         return ret_conv;
38076 }
38077
38078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38079         LDKAnnouncementSignatures orig_conv;
38080         orig_conv.inner = untag_ptr(orig);
38081         orig_conv.is_owned = ptr_is_owned(orig);
38082         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38083         orig_conv.is_owned = false;
38084         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
38085         int64_t ret_ref = 0;
38086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38088         return ret_ref;
38089 }
38090
38091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38092         LDKAnnouncementSignatures a_conv;
38093         a_conv.inner = untag_ptr(a);
38094         a_conv.is_owned = ptr_is_owned(a);
38095         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38096         a_conv.is_owned = false;
38097         LDKAnnouncementSignatures b_conv;
38098         b_conv.inner = untag_ptr(b);
38099         b_conv.is_owned = ptr_is_owned(b);
38100         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38101         b_conv.is_owned = false;
38102         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
38103         return ret_conv;
38104 }
38105
38106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38107         if (!ptr_is_owned(this_ptr)) return;
38108         void* this_ptr_ptr = untag_ptr(this_ptr);
38109         CHECK_ACCESS(this_ptr_ptr);
38110         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
38111         FREE(untag_ptr(this_ptr));
38112         NetAddress_free(this_ptr_conv);
38113 }
38114
38115 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
38116         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38117         *ret_copy = NetAddress_clone(arg);
38118         int64_t ret_ref = tag_ptr(ret_copy, true);
38119         return ret_ref;
38120 }
38121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38122         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
38123         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
38124         return ret_conv;
38125 }
38126
38127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38128         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
38129         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38130         *ret_copy = NetAddress_clone(orig_conv);
38131         int64_t ret_ref = tag_ptr(ret_copy, true);
38132         return ret_ref;
38133 }
38134
38135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
38136         LDKFourBytes addr_ref;
38137         CHECK((*env)->GetArrayLength(env, addr) == 4);
38138         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
38139         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38140         *ret_copy = NetAddress_ipv4(addr_ref, port);
38141         int64_t ret_ref = tag_ptr(ret_copy, true);
38142         return ret_ref;
38143 }
38144
38145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
38146         LDKSixteenBytes addr_ref;
38147         CHECK((*env)->GetArrayLength(env, addr) == 16);
38148         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
38149         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38150         *ret_copy = NetAddress_ipv6(addr_ref, port);
38151         int64_t ret_ref = tag_ptr(ret_copy, true);
38152         return ret_ref;
38153 }
38154
38155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
38156         LDKTwelveBytes a_ref;
38157         CHECK((*env)->GetArrayLength(env, a) == 12);
38158         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
38159         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38160         *ret_copy = NetAddress_onion_v2(a_ref);
38161         int64_t ret_ref = tag_ptr(ret_copy, true);
38162         return ret_ref;
38163 }
38164
38165 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) {
38166         LDKThirtyTwoBytes ed25519_pubkey_ref;
38167         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
38168         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
38169         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38170         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
38171         int64_t ret_ref = tag_ptr(ret_copy, true);
38172         return ret_ref;
38173 }
38174
38175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
38176         LDKHostname hostname_conv;
38177         hostname_conv.inner = untag_ptr(hostname);
38178         hostname_conv.is_owned = ptr_is_owned(hostname);
38179         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
38180         hostname_conv = Hostname_clone(&hostname_conv);
38181         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38182         *ret_copy = NetAddress_hostname(hostname_conv, port);
38183         int64_t ret_ref = tag_ptr(ret_copy, true);
38184         return ret_ref;
38185 }
38186
38187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38188         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
38189         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
38190         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
38191         return ret_conv;
38192 }
38193
38194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
38195         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
38196         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
38197         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38198         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38199         CVec_u8Z_free(ret_var);
38200         return ret_arr;
38201 }
38202
38203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38204         LDKu8slice ser_ref;
38205         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38206         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38207         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
38208         *ret_conv = NetAddress_read(ser_ref);
38209         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38210         return tag_ptr(ret_conv, true);
38211 }
38212
38213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38214         if (!ptr_is_owned(this_ptr)) return;
38215         void* this_ptr_ptr = untag_ptr(this_ptr);
38216         CHECK_ACCESS(this_ptr_ptr);
38217         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
38218         FREE(untag_ptr(this_ptr));
38219         UnsignedGossipMessage_free(this_ptr_conv);
38220 }
38221
38222 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
38223         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
38224         *ret_copy = UnsignedGossipMessage_clone(arg);
38225         int64_t ret_ref = tag_ptr(ret_copy, true);
38226         return ret_ref;
38227 }
38228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38229         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
38230         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
38231         return ret_conv;
38232 }
38233
38234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38235         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
38236         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
38237         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
38238         int64_t ret_ref = tag_ptr(ret_copy, true);
38239         return ret_ref;
38240 }
38241
38242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
38243         LDKUnsignedChannelAnnouncement a_conv;
38244         a_conv.inner = untag_ptr(a);
38245         a_conv.is_owned = ptr_is_owned(a);
38246         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38247         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
38248         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
38249         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
38250         int64_t ret_ref = tag_ptr(ret_copy, true);
38251         return ret_ref;
38252 }
38253
38254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
38255         LDKUnsignedChannelUpdate a_conv;
38256         a_conv.inner = untag_ptr(a);
38257         a_conv.is_owned = ptr_is_owned(a);
38258         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38259         a_conv = UnsignedChannelUpdate_clone(&a_conv);
38260         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
38261         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
38262         int64_t ret_ref = tag_ptr(ret_copy, true);
38263         return ret_ref;
38264 }
38265
38266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
38267         LDKUnsignedNodeAnnouncement a_conv;
38268         a_conv.inner = untag_ptr(a);
38269         a_conv.is_owned = ptr_is_owned(a);
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38271         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
38272         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
38273         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
38274         int64_t ret_ref = tag_ptr(ret_copy, true);
38275         return ret_ref;
38276 }
38277
38278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38279         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
38280         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
38281         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38282         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38283         CVec_u8Z_free(ret_var);
38284         return ret_arr;
38285 }
38286
38287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38288         LDKUnsignedNodeAnnouncement this_obj_conv;
38289         this_obj_conv.inner = untag_ptr(this_obj);
38290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38292         UnsignedNodeAnnouncement_free(this_obj_conv);
38293 }
38294
38295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
38296         LDKUnsignedNodeAnnouncement this_ptr_conv;
38297         this_ptr_conv.inner = untag_ptr(this_ptr);
38298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38300         this_ptr_conv.is_owned = false;
38301         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
38302         int64_t ret_ref = 0;
38303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38305         return ret_ref;
38306 }
38307
38308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38309         LDKUnsignedNodeAnnouncement this_ptr_conv;
38310         this_ptr_conv.inner = untag_ptr(this_ptr);
38311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38313         this_ptr_conv.is_owned = false;
38314         LDKNodeFeatures val_conv;
38315         val_conv.inner = untag_ptr(val);
38316         val_conv.is_owned = ptr_is_owned(val);
38317         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38318         val_conv = NodeFeatures_clone(&val_conv);
38319         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
38320 }
38321
38322 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
38323         LDKUnsignedNodeAnnouncement this_ptr_conv;
38324         this_ptr_conv.inner = untag_ptr(this_ptr);
38325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38327         this_ptr_conv.is_owned = false;
38328         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
38329         return ret_conv;
38330 }
38331
38332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38333         LDKUnsignedNodeAnnouncement this_ptr_conv;
38334         this_ptr_conv.inner = untag_ptr(this_ptr);
38335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38337         this_ptr_conv.is_owned = false;
38338         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
38339 }
38340
38341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38342         LDKUnsignedNodeAnnouncement this_ptr_conv;
38343         this_ptr_conv.inner = untag_ptr(this_ptr);
38344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38346         this_ptr_conv.is_owned = false;
38347         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
38348         int64_t ret_ref = 0;
38349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38351         return ret_ref;
38352 }
38353
38354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38355         LDKUnsignedNodeAnnouncement this_ptr_conv;
38356         this_ptr_conv.inner = untag_ptr(this_ptr);
38357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38359         this_ptr_conv.is_owned = false;
38360         LDKNodeId val_conv;
38361         val_conv.inner = untag_ptr(val);
38362         val_conv.is_owned = ptr_is_owned(val);
38363         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38364         val_conv = NodeId_clone(&val_conv);
38365         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
38366 }
38367
38368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
38369         LDKUnsignedNodeAnnouncement this_ptr_conv;
38370         this_ptr_conv.inner = untag_ptr(this_ptr);
38371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38373         this_ptr_conv.is_owned = false;
38374         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
38375         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
38376         return ret_arr;
38377 }
38378
38379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38380         LDKUnsignedNodeAnnouncement this_ptr_conv;
38381         this_ptr_conv.inner = untag_ptr(this_ptr);
38382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38384         this_ptr_conv.is_owned = false;
38385         LDKThreeBytes val_ref;
38386         CHECK((*env)->GetArrayLength(env, val) == 3);
38387         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
38388         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
38389 }
38390
38391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
38392         LDKUnsignedNodeAnnouncement this_ptr_conv;
38393         this_ptr_conv.inner = untag_ptr(this_ptr);
38394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38396         this_ptr_conv.is_owned = false;
38397         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38398         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
38399         return ret_arr;
38400 }
38401
38402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38403         LDKUnsignedNodeAnnouncement this_ptr_conv;
38404         this_ptr_conv.inner = untag_ptr(this_ptr);
38405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38407         this_ptr_conv.is_owned = false;
38408         LDKThirtyTwoBytes val_ref;
38409         CHECK((*env)->GetArrayLength(env, val) == 32);
38410         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38411         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
38412 }
38413
38414 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
38415         LDKUnsignedNodeAnnouncement this_ptr_conv;
38416         this_ptr_conv.inner = untag_ptr(this_ptr);
38417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38419         this_ptr_conv.is_owned = false;
38420         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
38421         int64_tArray ret_arr = NULL;
38422         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38423         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38424         for (size_t m = 0; m < ret_var.datalen; m++) {
38425                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
38426                 *ret_conv_12_copy = ret_var.data[m];
38427                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
38428                 ret_arr_ptr[m] = ret_conv_12_ref;
38429         }
38430         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38431         FREE(ret_var.data);
38432         return ret_arr;
38433 }
38434
38435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
38436         LDKUnsignedNodeAnnouncement this_ptr_conv;
38437         this_ptr_conv.inner = untag_ptr(this_ptr);
38438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38440         this_ptr_conv.is_owned = false;
38441         LDKCVec_NetAddressZ val_constr;
38442         val_constr.datalen = (*env)->GetArrayLength(env, val);
38443         if (val_constr.datalen > 0)
38444                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
38445         else
38446                 val_constr.data = NULL;
38447         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
38448         for (size_t m = 0; m < val_constr.datalen; m++) {
38449                 int64_t val_conv_12 = val_vals[m];
38450                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
38451                 CHECK_ACCESS(val_conv_12_ptr);
38452                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
38453                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
38454                 val_constr.data[m] = val_conv_12_conv;
38455         }
38456         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
38457         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
38458 }
38459
38460 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
38461         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
38462         int64_t ret_ref = 0;
38463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38465         return ret_ref;
38466 }
38467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38468         LDKUnsignedNodeAnnouncement arg_conv;
38469         arg_conv.inner = untag_ptr(arg);
38470         arg_conv.is_owned = ptr_is_owned(arg);
38471         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38472         arg_conv.is_owned = false;
38473         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
38474         return ret_conv;
38475 }
38476
38477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38478         LDKUnsignedNodeAnnouncement orig_conv;
38479         orig_conv.inner = untag_ptr(orig);
38480         orig_conv.is_owned = ptr_is_owned(orig);
38481         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38482         orig_conv.is_owned = false;
38483         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
38484         int64_t ret_ref = 0;
38485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38487         return ret_ref;
38488 }
38489
38490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38491         LDKUnsignedNodeAnnouncement a_conv;
38492         a_conv.inner = untag_ptr(a);
38493         a_conv.is_owned = ptr_is_owned(a);
38494         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38495         a_conv.is_owned = false;
38496         LDKUnsignedNodeAnnouncement b_conv;
38497         b_conv.inner = untag_ptr(b);
38498         b_conv.is_owned = ptr_is_owned(b);
38499         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38500         b_conv.is_owned = false;
38501         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
38502         return ret_conv;
38503 }
38504
38505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38506         LDKNodeAnnouncement this_obj_conv;
38507         this_obj_conv.inner = untag_ptr(this_obj);
38508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38510         NodeAnnouncement_free(this_obj_conv);
38511 }
38512
38513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
38514         LDKNodeAnnouncement this_ptr_conv;
38515         this_ptr_conv.inner = untag_ptr(this_ptr);
38516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38518         this_ptr_conv.is_owned = false;
38519         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38520         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
38521         return ret_arr;
38522 }
38523
38524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38525         LDKNodeAnnouncement this_ptr_conv;
38526         this_ptr_conv.inner = untag_ptr(this_ptr);
38527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38529         this_ptr_conv.is_owned = false;
38530         LDKSignature val_ref;
38531         CHECK((*env)->GetArrayLength(env, val) == 64);
38532         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38533         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
38534 }
38535
38536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
38537         LDKNodeAnnouncement this_ptr_conv;
38538         this_ptr_conv.inner = untag_ptr(this_ptr);
38539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38541         this_ptr_conv.is_owned = false;
38542         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
38543         int64_t ret_ref = 0;
38544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38546         return ret_ref;
38547 }
38548
38549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38550         LDKNodeAnnouncement this_ptr_conv;
38551         this_ptr_conv.inner = untag_ptr(this_ptr);
38552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38554         this_ptr_conv.is_owned = false;
38555         LDKUnsignedNodeAnnouncement val_conv;
38556         val_conv.inner = untag_ptr(val);
38557         val_conv.is_owned = ptr_is_owned(val);
38558         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38559         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
38560         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
38561 }
38562
38563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
38564         LDKSignature signature_arg_ref;
38565         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
38566         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
38567         LDKUnsignedNodeAnnouncement contents_arg_conv;
38568         contents_arg_conv.inner = untag_ptr(contents_arg);
38569         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
38570         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
38571         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
38572         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
38573         int64_t ret_ref = 0;
38574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38576         return ret_ref;
38577 }
38578
38579 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
38580         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
38581         int64_t ret_ref = 0;
38582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38584         return ret_ref;
38585 }
38586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38587         LDKNodeAnnouncement arg_conv;
38588         arg_conv.inner = untag_ptr(arg);
38589         arg_conv.is_owned = ptr_is_owned(arg);
38590         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38591         arg_conv.is_owned = false;
38592         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
38593         return ret_conv;
38594 }
38595
38596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38597         LDKNodeAnnouncement orig_conv;
38598         orig_conv.inner = untag_ptr(orig);
38599         orig_conv.is_owned = ptr_is_owned(orig);
38600         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38601         orig_conv.is_owned = false;
38602         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
38603         int64_t ret_ref = 0;
38604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38606         return ret_ref;
38607 }
38608
38609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38610         LDKNodeAnnouncement a_conv;
38611         a_conv.inner = untag_ptr(a);
38612         a_conv.is_owned = ptr_is_owned(a);
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38614         a_conv.is_owned = false;
38615         LDKNodeAnnouncement b_conv;
38616         b_conv.inner = untag_ptr(b);
38617         b_conv.is_owned = ptr_is_owned(b);
38618         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38619         b_conv.is_owned = false;
38620         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
38621         return ret_conv;
38622 }
38623
38624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38625         LDKUnsignedChannelAnnouncement this_obj_conv;
38626         this_obj_conv.inner = untag_ptr(this_obj);
38627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38629         UnsignedChannelAnnouncement_free(this_obj_conv);
38630 }
38631
38632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
38633         LDKUnsignedChannelAnnouncement this_ptr_conv;
38634         this_ptr_conv.inner = untag_ptr(this_ptr);
38635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38637         this_ptr_conv.is_owned = false;
38638         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
38639         int64_t ret_ref = 0;
38640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38642         return ret_ref;
38643 }
38644
38645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38646         LDKUnsignedChannelAnnouncement this_ptr_conv;
38647         this_ptr_conv.inner = untag_ptr(this_ptr);
38648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38650         this_ptr_conv.is_owned = false;
38651         LDKChannelFeatures val_conv;
38652         val_conv.inner = untag_ptr(val);
38653         val_conv.is_owned = ptr_is_owned(val);
38654         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38655         val_conv = ChannelFeatures_clone(&val_conv);
38656         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
38657 }
38658
38659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
38660         LDKUnsignedChannelAnnouncement this_ptr_conv;
38661         this_ptr_conv.inner = untag_ptr(this_ptr);
38662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38664         this_ptr_conv.is_owned = false;
38665         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38666         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
38667         return ret_arr;
38668 }
38669
38670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38671         LDKUnsignedChannelAnnouncement this_ptr_conv;
38672         this_ptr_conv.inner = untag_ptr(this_ptr);
38673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38675         this_ptr_conv.is_owned = false;
38676         LDKThirtyTwoBytes val_ref;
38677         CHECK((*env)->GetArrayLength(env, val) == 32);
38678         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38679         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
38680 }
38681
38682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38683         LDKUnsignedChannelAnnouncement this_ptr_conv;
38684         this_ptr_conv.inner = untag_ptr(this_ptr);
38685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38687         this_ptr_conv.is_owned = false;
38688         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
38689         return ret_conv;
38690 }
38691
38692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38693         LDKUnsignedChannelAnnouncement this_ptr_conv;
38694         this_ptr_conv.inner = untag_ptr(this_ptr);
38695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38697         this_ptr_conv.is_owned = false;
38698         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
38699 }
38700
38701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
38702         LDKUnsignedChannelAnnouncement this_ptr_conv;
38703         this_ptr_conv.inner = untag_ptr(this_ptr);
38704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38706         this_ptr_conv.is_owned = false;
38707         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
38708         int64_t ret_ref = 0;
38709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38711         return ret_ref;
38712 }
38713
38714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38715         LDKUnsignedChannelAnnouncement this_ptr_conv;
38716         this_ptr_conv.inner = untag_ptr(this_ptr);
38717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38719         this_ptr_conv.is_owned = false;
38720         LDKNodeId val_conv;
38721         val_conv.inner = untag_ptr(val);
38722         val_conv.is_owned = ptr_is_owned(val);
38723         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38724         val_conv = NodeId_clone(&val_conv);
38725         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
38726 }
38727
38728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
38729         LDKUnsignedChannelAnnouncement this_ptr_conv;
38730         this_ptr_conv.inner = untag_ptr(this_ptr);
38731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38733         this_ptr_conv.is_owned = false;
38734         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
38735         int64_t ret_ref = 0;
38736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38738         return ret_ref;
38739 }
38740
38741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38742         LDKUnsignedChannelAnnouncement this_ptr_conv;
38743         this_ptr_conv.inner = untag_ptr(this_ptr);
38744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38746         this_ptr_conv.is_owned = false;
38747         LDKNodeId val_conv;
38748         val_conv.inner = untag_ptr(val);
38749         val_conv.is_owned = ptr_is_owned(val);
38750         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38751         val_conv = NodeId_clone(&val_conv);
38752         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
38753 }
38754
38755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
38756         LDKUnsignedChannelAnnouncement this_ptr_conv;
38757         this_ptr_conv.inner = untag_ptr(this_ptr);
38758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38760         this_ptr_conv.is_owned = false;
38761         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
38762         int64_t ret_ref = 0;
38763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38765         return ret_ref;
38766 }
38767
38768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38769         LDKUnsignedChannelAnnouncement this_ptr_conv;
38770         this_ptr_conv.inner = untag_ptr(this_ptr);
38771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38773         this_ptr_conv.is_owned = false;
38774         LDKNodeId val_conv;
38775         val_conv.inner = untag_ptr(val);
38776         val_conv.is_owned = ptr_is_owned(val);
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38778         val_conv = NodeId_clone(&val_conv);
38779         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
38780 }
38781
38782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
38783         LDKUnsignedChannelAnnouncement this_ptr_conv;
38784         this_ptr_conv.inner = untag_ptr(this_ptr);
38785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38787         this_ptr_conv.is_owned = false;
38788         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
38789         int64_t ret_ref = 0;
38790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38792         return ret_ref;
38793 }
38794
38795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38796         LDKUnsignedChannelAnnouncement this_ptr_conv;
38797         this_ptr_conv.inner = untag_ptr(this_ptr);
38798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38800         this_ptr_conv.is_owned = false;
38801         LDKNodeId val_conv;
38802         val_conv.inner = untag_ptr(val);
38803         val_conv.is_owned = ptr_is_owned(val);
38804         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38805         val_conv = NodeId_clone(&val_conv);
38806         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
38807 }
38808
38809 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
38810         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
38811         int64_t ret_ref = 0;
38812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38814         return ret_ref;
38815 }
38816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38817         LDKUnsignedChannelAnnouncement arg_conv;
38818         arg_conv.inner = untag_ptr(arg);
38819         arg_conv.is_owned = ptr_is_owned(arg);
38820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38821         arg_conv.is_owned = false;
38822         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
38823         return ret_conv;
38824 }
38825
38826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38827         LDKUnsignedChannelAnnouncement orig_conv;
38828         orig_conv.inner = untag_ptr(orig);
38829         orig_conv.is_owned = ptr_is_owned(orig);
38830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38831         orig_conv.is_owned = false;
38832         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
38833         int64_t ret_ref = 0;
38834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38836         return ret_ref;
38837 }
38838
38839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38840         LDKUnsignedChannelAnnouncement a_conv;
38841         a_conv.inner = untag_ptr(a);
38842         a_conv.is_owned = ptr_is_owned(a);
38843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38844         a_conv.is_owned = false;
38845         LDKUnsignedChannelAnnouncement b_conv;
38846         b_conv.inner = untag_ptr(b);
38847         b_conv.is_owned = ptr_is_owned(b);
38848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38849         b_conv.is_owned = false;
38850         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
38851         return ret_conv;
38852 }
38853
38854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38855         LDKChannelAnnouncement this_obj_conv;
38856         this_obj_conv.inner = untag_ptr(this_obj);
38857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38859         ChannelAnnouncement_free(this_obj_conv);
38860 }
38861
38862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
38863         LDKChannelAnnouncement this_ptr_conv;
38864         this_ptr_conv.inner = untag_ptr(this_ptr);
38865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38867         this_ptr_conv.is_owned = false;
38868         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38869         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
38870         return ret_arr;
38871 }
38872
38873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38874         LDKChannelAnnouncement this_ptr_conv;
38875         this_ptr_conv.inner = untag_ptr(this_ptr);
38876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38878         this_ptr_conv.is_owned = false;
38879         LDKSignature val_ref;
38880         CHECK((*env)->GetArrayLength(env, val) == 64);
38881         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38882         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
38883 }
38884
38885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
38886         LDKChannelAnnouncement this_ptr_conv;
38887         this_ptr_conv.inner = untag_ptr(this_ptr);
38888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38890         this_ptr_conv.is_owned = false;
38891         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38892         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
38893         return ret_arr;
38894 }
38895
38896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38897         LDKChannelAnnouncement this_ptr_conv;
38898         this_ptr_conv.inner = untag_ptr(this_ptr);
38899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38901         this_ptr_conv.is_owned = false;
38902         LDKSignature val_ref;
38903         CHECK((*env)->GetArrayLength(env, val) == 64);
38904         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38905         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
38906 }
38907
38908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
38909         LDKChannelAnnouncement this_ptr_conv;
38910         this_ptr_conv.inner = untag_ptr(this_ptr);
38911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38913         this_ptr_conv.is_owned = false;
38914         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38915         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
38916         return ret_arr;
38917 }
38918
38919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38920         LDKChannelAnnouncement this_ptr_conv;
38921         this_ptr_conv.inner = untag_ptr(this_ptr);
38922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38924         this_ptr_conv.is_owned = false;
38925         LDKSignature val_ref;
38926         CHECK((*env)->GetArrayLength(env, val) == 64);
38927         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38928         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
38929 }
38930
38931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
38932         LDKChannelAnnouncement this_ptr_conv;
38933         this_ptr_conv.inner = untag_ptr(this_ptr);
38934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38936         this_ptr_conv.is_owned = false;
38937         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38938         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
38939         return ret_arr;
38940 }
38941
38942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38943         LDKChannelAnnouncement this_ptr_conv;
38944         this_ptr_conv.inner = untag_ptr(this_ptr);
38945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38947         this_ptr_conv.is_owned = false;
38948         LDKSignature val_ref;
38949         CHECK((*env)->GetArrayLength(env, val) == 64);
38950         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38951         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
38952 }
38953
38954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
38955         LDKChannelAnnouncement this_ptr_conv;
38956         this_ptr_conv.inner = untag_ptr(this_ptr);
38957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38959         this_ptr_conv.is_owned = false;
38960         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
38961         int64_t ret_ref = 0;
38962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38964         return ret_ref;
38965 }
38966
38967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38968         LDKChannelAnnouncement this_ptr_conv;
38969         this_ptr_conv.inner = untag_ptr(this_ptr);
38970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38972         this_ptr_conv.is_owned = false;
38973         LDKUnsignedChannelAnnouncement val_conv;
38974         val_conv.inner = untag_ptr(val);
38975         val_conv.is_owned = ptr_is_owned(val);
38976         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38977         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
38978         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
38979 }
38980
38981 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) {
38982         LDKSignature node_signature_1_arg_ref;
38983         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
38984         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
38985         LDKSignature node_signature_2_arg_ref;
38986         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
38987         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
38988         LDKSignature bitcoin_signature_1_arg_ref;
38989         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
38990         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
38991         LDKSignature bitcoin_signature_2_arg_ref;
38992         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
38993         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
38994         LDKUnsignedChannelAnnouncement contents_arg_conv;
38995         contents_arg_conv.inner = untag_ptr(contents_arg);
38996         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
38998         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
38999         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);
39000         int64_t ret_ref = 0;
39001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39003         return ret_ref;
39004 }
39005
39006 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
39007         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
39008         int64_t ret_ref = 0;
39009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39011         return ret_ref;
39012 }
39013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39014         LDKChannelAnnouncement arg_conv;
39015         arg_conv.inner = untag_ptr(arg);
39016         arg_conv.is_owned = ptr_is_owned(arg);
39017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39018         arg_conv.is_owned = false;
39019         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
39020         return ret_conv;
39021 }
39022
39023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39024         LDKChannelAnnouncement orig_conv;
39025         orig_conv.inner = untag_ptr(orig);
39026         orig_conv.is_owned = ptr_is_owned(orig);
39027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39028         orig_conv.is_owned = false;
39029         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
39030         int64_t ret_ref = 0;
39031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39033         return ret_ref;
39034 }
39035
39036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39037         LDKChannelAnnouncement a_conv;
39038         a_conv.inner = untag_ptr(a);
39039         a_conv.is_owned = ptr_is_owned(a);
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39041         a_conv.is_owned = false;
39042         LDKChannelAnnouncement b_conv;
39043         b_conv.inner = untag_ptr(b);
39044         b_conv.is_owned = ptr_is_owned(b);
39045         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39046         b_conv.is_owned = false;
39047         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
39048         return ret_conv;
39049 }
39050
39051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39052         LDKUnsignedChannelUpdate this_obj_conv;
39053         this_obj_conv.inner = untag_ptr(this_obj);
39054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39056         UnsignedChannelUpdate_free(this_obj_conv);
39057 }
39058
39059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39060         LDKUnsignedChannelUpdate this_ptr_conv;
39061         this_ptr_conv.inner = untag_ptr(this_ptr);
39062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39064         this_ptr_conv.is_owned = false;
39065         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39066         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
39067         return ret_arr;
39068 }
39069
39070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39071         LDKUnsignedChannelUpdate this_ptr_conv;
39072         this_ptr_conv.inner = untag_ptr(this_ptr);
39073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39075         this_ptr_conv.is_owned = false;
39076         LDKThirtyTwoBytes val_ref;
39077         CHECK((*env)->GetArrayLength(env, val) == 32);
39078         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39079         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
39080 }
39081
39082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39083         LDKUnsignedChannelUpdate this_ptr_conv;
39084         this_ptr_conv.inner = untag_ptr(this_ptr);
39085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39087         this_ptr_conv.is_owned = false;
39088         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
39089         return ret_conv;
39090 }
39091
39092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39093         LDKUnsignedChannelUpdate this_ptr_conv;
39094         this_ptr_conv.inner = untag_ptr(this_ptr);
39095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39097         this_ptr_conv.is_owned = false;
39098         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
39099 }
39100
39101 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
39102         LDKUnsignedChannelUpdate this_ptr_conv;
39103         this_ptr_conv.inner = untag_ptr(this_ptr);
39104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39106         this_ptr_conv.is_owned = false;
39107         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
39108         return ret_conv;
39109 }
39110
39111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39112         LDKUnsignedChannelUpdate this_ptr_conv;
39113         this_ptr_conv.inner = untag_ptr(this_ptr);
39114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39116         this_ptr_conv.is_owned = false;
39117         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
39118 }
39119
39120 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
39121         LDKUnsignedChannelUpdate this_ptr_conv;
39122         this_ptr_conv.inner = untag_ptr(this_ptr);
39123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39125         this_ptr_conv.is_owned = false;
39126         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
39127         return ret_conv;
39128 }
39129
39130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
39131         LDKUnsignedChannelUpdate this_ptr_conv;
39132         this_ptr_conv.inner = untag_ptr(this_ptr);
39133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39135         this_ptr_conv.is_owned = false;
39136         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
39137 }
39138
39139 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39140         LDKUnsignedChannelUpdate this_ptr_conv;
39141         this_ptr_conv.inner = untag_ptr(this_ptr);
39142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39144         this_ptr_conv.is_owned = false;
39145         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
39146         return ret_conv;
39147 }
39148
39149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39150         LDKUnsignedChannelUpdate this_ptr_conv;
39151         this_ptr_conv.inner = untag_ptr(this_ptr);
39152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39154         this_ptr_conv.is_owned = false;
39155         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
39156 }
39157
39158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39159         LDKUnsignedChannelUpdate this_ptr_conv;
39160         this_ptr_conv.inner = untag_ptr(this_ptr);
39161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39163         this_ptr_conv.is_owned = false;
39164         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
39165         return ret_conv;
39166 }
39167
39168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39169         LDKUnsignedChannelUpdate this_ptr_conv;
39170         this_ptr_conv.inner = untag_ptr(this_ptr);
39171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39173         this_ptr_conv.is_owned = false;
39174         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
39175 }
39176
39177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39178         LDKUnsignedChannelUpdate this_ptr_conv;
39179         this_ptr_conv.inner = untag_ptr(this_ptr);
39180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39182         this_ptr_conv.is_owned = false;
39183         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
39184         return ret_conv;
39185 }
39186
39187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39188         LDKUnsignedChannelUpdate this_ptr_conv;
39189         this_ptr_conv.inner = untag_ptr(this_ptr);
39190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39192         this_ptr_conv.is_owned = false;
39193         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
39194 }
39195
39196 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39197         LDKUnsignedChannelUpdate this_ptr_conv;
39198         this_ptr_conv.inner = untag_ptr(this_ptr);
39199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39201         this_ptr_conv.is_owned = false;
39202         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
39203         return ret_conv;
39204 }
39205
39206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39207         LDKUnsignedChannelUpdate this_ptr_conv;
39208         this_ptr_conv.inner = untag_ptr(this_ptr);
39209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39211         this_ptr_conv.is_owned = false;
39212         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
39213 }
39214
39215 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39216         LDKUnsignedChannelUpdate this_ptr_conv;
39217         this_ptr_conv.inner = untag_ptr(this_ptr);
39218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39220         this_ptr_conv.is_owned = false;
39221         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
39222         return ret_conv;
39223 }
39224
39225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39226         LDKUnsignedChannelUpdate this_ptr_conv;
39227         this_ptr_conv.inner = untag_ptr(this_ptr);
39228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39230         this_ptr_conv.is_owned = false;
39231         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
39232 }
39233
39234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
39235         LDKUnsignedChannelUpdate this_ptr_conv;
39236         this_ptr_conv.inner = untag_ptr(this_ptr);
39237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39239         this_ptr_conv.is_owned = false;
39240         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
39241         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39242         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39243         CVec_u8Z_free(ret_var);
39244         return ret_arr;
39245 }
39246
39247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39248         LDKUnsignedChannelUpdate this_ptr_conv;
39249         this_ptr_conv.inner = untag_ptr(this_ptr);
39250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39252         this_ptr_conv.is_owned = false;
39253         LDKCVec_u8Z val_ref;
39254         val_ref.datalen = (*env)->GetArrayLength(env, val);
39255         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39256         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
39257         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
39258 }
39259
39260 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) {
39261         LDKThirtyTwoBytes chain_hash_arg_ref;
39262         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
39263         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
39264         LDKCVec_u8Z excess_data_arg_ref;
39265         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
39266         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39267         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
39268         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);
39269         int64_t ret_ref = 0;
39270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39272         return ret_ref;
39273 }
39274
39275 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
39276         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
39277         int64_t ret_ref = 0;
39278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39280         return ret_ref;
39281 }
39282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39283         LDKUnsignedChannelUpdate arg_conv;
39284         arg_conv.inner = untag_ptr(arg);
39285         arg_conv.is_owned = ptr_is_owned(arg);
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39287         arg_conv.is_owned = false;
39288         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
39289         return ret_conv;
39290 }
39291
39292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39293         LDKUnsignedChannelUpdate orig_conv;
39294         orig_conv.inner = untag_ptr(orig);
39295         orig_conv.is_owned = ptr_is_owned(orig);
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39297         orig_conv.is_owned = false;
39298         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
39299         int64_t ret_ref = 0;
39300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39302         return ret_ref;
39303 }
39304
39305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39306         LDKUnsignedChannelUpdate a_conv;
39307         a_conv.inner = untag_ptr(a);
39308         a_conv.is_owned = ptr_is_owned(a);
39309         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39310         a_conv.is_owned = false;
39311         LDKUnsignedChannelUpdate b_conv;
39312         b_conv.inner = untag_ptr(b);
39313         b_conv.is_owned = ptr_is_owned(b);
39314         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39315         b_conv.is_owned = false;
39316         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
39317         return ret_conv;
39318 }
39319
39320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39321         LDKChannelUpdate this_obj_conv;
39322         this_obj_conv.inner = untag_ptr(this_obj);
39323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39325         ChannelUpdate_free(this_obj_conv);
39326 }
39327
39328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
39329         LDKChannelUpdate this_ptr_conv;
39330         this_ptr_conv.inner = untag_ptr(this_ptr);
39331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39333         this_ptr_conv.is_owned = false;
39334         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39335         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
39336         return ret_arr;
39337 }
39338
39339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39340         LDKChannelUpdate this_ptr_conv;
39341         this_ptr_conv.inner = untag_ptr(this_ptr);
39342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39344         this_ptr_conv.is_owned = false;
39345         LDKSignature val_ref;
39346         CHECK((*env)->GetArrayLength(env, val) == 64);
39347         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
39348         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
39349 }
39350
39351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
39352         LDKChannelUpdate this_ptr_conv;
39353         this_ptr_conv.inner = untag_ptr(this_ptr);
39354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39356         this_ptr_conv.is_owned = false;
39357         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
39358         int64_t ret_ref = 0;
39359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39361         return ret_ref;
39362 }
39363
39364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39365         LDKChannelUpdate this_ptr_conv;
39366         this_ptr_conv.inner = untag_ptr(this_ptr);
39367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39369         this_ptr_conv.is_owned = false;
39370         LDKUnsignedChannelUpdate val_conv;
39371         val_conv.inner = untag_ptr(val);
39372         val_conv.is_owned = ptr_is_owned(val);
39373         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39374         val_conv = UnsignedChannelUpdate_clone(&val_conv);
39375         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
39376 }
39377
39378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
39379         LDKSignature signature_arg_ref;
39380         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
39381         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
39382         LDKUnsignedChannelUpdate contents_arg_conv;
39383         contents_arg_conv.inner = untag_ptr(contents_arg);
39384         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
39385         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
39386         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
39387         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
39388         int64_t ret_ref = 0;
39389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39391         return ret_ref;
39392 }
39393
39394 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
39395         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
39396         int64_t ret_ref = 0;
39397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39399         return ret_ref;
39400 }
39401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39402         LDKChannelUpdate arg_conv;
39403         arg_conv.inner = untag_ptr(arg);
39404         arg_conv.is_owned = ptr_is_owned(arg);
39405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39406         arg_conv.is_owned = false;
39407         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
39408         return ret_conv;
39409 }
39410
39411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39412         LDKChannelUpdate orig_conv;
39413         orig_conv.inner = untag_ptr(orig);
39414         orig_conv.is_owned = ptr_is_owned(orig);
39415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39416         orig_conv.is_owned = false;
39417         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
39418         int64_t ret_ref = 0;
39419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39421         return ret_ref;
39422 }
39423
39424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39425         LDKChannelUpdate a_conv;
39426         a_conv.inner = untag_ptr(a);
39427         a_conv.is_owned = ptr_is_owned(a);
39428         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39429         a_conv.is_owned = false;
39430         LDKChannelUpdate b_conv;
39431         b_conv.inner = untag_ptr(b);
39432         b_conv.is_owned = ptr_is_owned(b);
39433         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39434         b_conv.is_owned = false;
39435         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
39436         return ret_conv;
39437 }
39438
39439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39440         LDKQueryChannelRange this_obj_conv;
39441         this_obj_conv.inner = untag_ptr(this_obj);
39442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39444         QueryChannelRange_free(this_obj_conv);
39445 }
39446
39447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39448         LDKQueryChannelRange this_ptr_conv;
39449         this_ptr_conv.inner = untag_ptr(this_ptr);
39450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39452         this_ptr_conv.is_owned = false;
39453         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39454         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
39455         return ret_arr;
39456 }
39457
39458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39459         LDKQueryChannelRange this_ptr_conv;
39460         this_ptr_conv.inner = untag_ptr(this_ptr);
39461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39463         this_ptr_conv.is_owned = false;
39464         LDKThirtyTwoBytes val_ref;
39465         CHECK((*env)->GetArrayLength(env, val) == 32);
39466         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39467         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
39468 }
39469
39470 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
39471         LDKQueryChannelRange this_ptr_conv;
39472         this_ptr_conv.inner = untag_ptr(this_ptr);
39473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39475         this_ptr_conv.is_owned = false;
39476         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
39477         return ret_conv;
39478 }
39479
39480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39481         LDKQueryChannelRange this_ptr_conv;
39482         this_ptr_conv.inner = untag_ptr(this_ptr);
39483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39485         this_ptr_conv.is_owned = false;
39486         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
39487 }
39488
39489 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
39490         LDKQueryChannelRange this_ptr_conv;
39491         this_ptr_conv.inner = untag_ptr(this_ptr);
39492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39494         this_ptr_conv.is_owned = false;
39495         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
39496         return ret_conv;
39497 }
39498
39499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39500         LDKQueryChannelRange this_ptr_conv;
39501         this_ptr_conv.inner = untag_ptr(this_ptr);
39502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39504         this_ptr_conv.is_owned = false;
39505         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
39506 }
39507
39508 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) {
39509         LDKThirtyTwoBytes chain_hash_arg_ref;
39510         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
39511         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
39512         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
39513         int64_t ret_ref = 0;
39514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39516         return ret_ref;
39517 }
39518
39519 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
39520         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
39521         int64_t ret_ref = 0;
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39524         return ret_ref;
39525 }
39526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39527         LDKQueryChannelRange arg_conv;
39528         arg_conv.inner = untag_ptr(arg);
39529         arg_conv.is_owned = ptr_is_owned(arg);
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39531         arg_conv.is_owned = false;
39532         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
39533         return ret_conv;
39534 }
39535
39536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39537         LDKQueryChannelRange orig_conv;
39538         orig_conv.inner = untag_ptr(orig);
39539         orig_conv.is_owned = ptr_is_owned(orig);
39540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39541         orig_conv.is_owned = false;
39542         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
39543         int64_t ret_ref = 0;
39544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39546         return ret_ref;
39547 }
39548
39549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39550         LDKQueryChannelRange a_conv;
39551         a_conv.inner = untag_ptr(a);
39552         a_conv.is_owned = ptr_is_owned(a);
39553         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39554         a_conv.is_owned = false;
39555         LDKQueryChannelRange b_conv;
39556         b_conv.inner = untag_ptr(b);
39557         b_conv.is_owned = ptr_is_owned(b);
39558         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39559         b_conv.is_owned = false;
39560         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
39561         return ret_conv;
39562 }
39563
39564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39565         LDKReplyChannelRange this_obj_conv;
39566         this_obj_conv.inner = untag_ptr(this_obj);
39567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39569         ReplyChannelRange_free(this_obj_conv);
39570 }
39571
39572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39573         LDKReplyChannelRange this_ptr_conv;
39574         this_ptr_conv.inner = untag_ptr(this_ptr);
39575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39577         this_ptr_conv.is_owned = false;
39578         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39579         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
39580         return ret_arr;
39581 }
39582
39583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39584         LDKReplyChannelRange this_ptr_conv;
39585         this_ptr_conv.inner = untag_ptr(this_ptr);
39586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39588         this_ptr_conv.is_owned = false;
39589         LDKThirtyTwoBytes val_ref;
39590         CHECK((*env)->GetArrayLength(env, val) == 32);
39591         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39592         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
39593 }
39594
39595 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
39596         LDKReplyChannelRange this_ptr_conv;
39597         this_ptr_conv.inner = untag_ptr(this_ptr);
39598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39600         this_ptr_conv.is_owned = false;
39601         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
39602         return ret_conv;
39603 }
39604
39605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39606         LDKReplyChannelRange this_ptr_conv;
39607         this_ptr_conv.inner = untag_ptr(this_ptr);
39608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39610         this_ptr_conv.is_owned = false;
39611         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
39612 }
39613
39614 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
39615         LDKReplyChannelRange this_ptr_conv;
39616         this_ptr_conv.inner = untag_ptr(this_ptr);
39617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39619         this_ptr_conv.is_owned = false;
39620         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
39621         return ret_conv;
39622 }
39623
39624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39625         LDKReplyChannelRange this_ptr_conv;
39626         this_ptr_conv.inner = untag_ptr(this_ptr);
39627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39629         this_ptr_conv.is_owned = false;
39630         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
39631 }
39632
39633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
39634         LDKReplyChannelRange this_ptr_conv;
39635         this_ptr_conv.inner = untag_ptr(this_ptr);
39636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39638         this_ptr_conv.is_owned = false;
39639         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
39640         return ret_conv;
39641 }
39642
39643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39644         LDKReplyChannelRange this_ptr_conv;
39645         this_ptr_conv.inner = untag_ptr(this_ptr);
39646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39648         this_ptr_conv.is_owned = false;
39649         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
39650 }
39651
39652 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
39653         LDKReplyChannelRange this_ptr_conv;
39654         this_ptr_conv.inner = untag_ptr(this_ptr);
39655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39657         this_ptr_conv.is_owned = false;
39658         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
39659         int64_tArray ret_arr = NULL;
39660         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
39661         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
39662         for (size_t g = 0; g < ret_var.datalen; g++) {
39663                 int64_t ret_conv_6_conv = ret_var.data[g];
39664                 ret_arr_ptr[g] = ret_conv_6_conv;
39665         }
39666         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
39667         FREE(ret_var.data);
39668         return ret_arr;
39669 }
39670
39671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
39672         LDKReplyChannelRange this_ptr_conv;
39673         this_ptr_conv.inner = untag_ptr(this_ptr);
39674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39676         this_ptr_conv.is_owned = false;
39677         LDKCVec_u64Z val_constr;
39678         val_constr.datalen = (*env)->GetArrayLength(env, val);
39679         if (val_constr.datalen > 0)
39680                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39681         else
39682                 val_constr.data = NULL;
39683         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
39684         for (size_t g = 0; g < val_constr.datalen; g++) {
39685                 int64_t val_conv_6 = val_vals[g];
39686                 val_constr.data[g] = val_conv_6;
39687         }
39688         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
39689         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
39690 }
39691
39692 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) {
39693         LDKThirtyTwoBytes chain_hash_arg_ref;
39694         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
39695         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
39696         LDKCVec_u64Z short_channel_ids_arg_constr;
39697         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
39698         if (short_channel_ids_arg_constr.datalen > 0)
39699                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39700         else
39701                 short_channel_ids_arg_constr.data = NULL;
39702         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
39703         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
39704                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
39705                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
39706         }
39707         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
39708         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
39709         int64_t ret_ref = 0;
39710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39712         return ret_ref;
39713 }
39714
39715 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
39716         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
39717         int64_t ret_ref = 0;
39718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39720         return ret_ref;
39721 }
39722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39723         LDKReplyChannelRange arg_conv;
39724         arg_conv.inner = untag_ptr(arg);
39725         arg_conv.is_owned = ptr_is_owned(arg);
39726         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39727         arg_conv.is_owned = false;
39728         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
39729         return ret_conv;
39730 }
39731
39732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39733         LDKReplyChannelRange orig_conv;
39734         orig_conv.inner = untag_ptr(orig);
39735         orig_conv.is_owned = ptr_is_owned(orig);
39736         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39737         orig_conv.is_owned = false;
39738         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
39739         int64_t ret_ref = 0;
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39742         return ret_ref;
39743 }
39744
39745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39746         LDKReplyChannelRange a_conv;
39747         a_conv.inner = untag_ptr(a);
39748         a_conv.is_owned = ptr_is_owned(a);
39749         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39750         a_conv.is_owned = false;
39751         LDKReplyChannelRange b_conv;
39752         b_conv.inner = untag_ptr(b);
39753         b_conv.is_owned = ptr_is_owned(b);
39754         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39755         b_conv.is_owned = false;
39756         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
39757         return ret_conv;
39758 }
39759
39760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39761         LDKQueryShortChannelIds this_obj_conv;
39762         this_obj_conv.inner = untag_ptr(this_obj);
39763         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39765         QueryShortChannelIds_free(this_obj_conv);
39766 }
39767
39768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39769         LDKQueryShortChannelIds this_ptr_conv;
39770         this_ptr_conv.inner = untag_ptr(this_ptr);
39771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39773         this_ptr_conv.is_owned = false;
39774         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39775         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
39776         return ret_arr;
39777 }
39778
39779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39780         LDKQueryShortChannelIds this_ptr_conv;
39781         this_ptr_conv.inner = untag_ptr(this_ptr);
39782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39784         this_ptr_conv.is_owned = false;
39785         LDKThirtyTwoBytes val_ref;
39786         CHECK((*env)->GetArrayLength(env, val) == 32);
39787         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39788         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
39789 }
39790
39791 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
39792         LDKQueryShortChannelIds this_ptr_conv;
39793         this_ptr_conv.inner = untag_ptr(this_ptr);
39794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39796         this_ptr_conv.is_owned = false;
39797         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
39798         int64_tArray ret_arr = NULL;
39799         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
39800         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
39801         for (size_t g = 0; g < ret_var.datalen; g++) {
39802                 int64_t ret_conv_6_conv = ret_var.data[g];
39803                 ret_arr_ptr[g] = ret_conv_6_conv;
39804         }
39805         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
39806         FREE(ret_var.data);
39807         return ret_arr;
39808 }
39809
39810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
39811         LDKQueryShortChannelIds this_ptr_conv;
39812         this_ptr_conv.inner = untag_ptr(this_ptr);
39813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39815         this_ptr_conv.is_owned = false;
39816         LDKCVec_u64Z val_constr;
39817         val_constr.datalen = (*env)->GetArrayLength(env, val);
39818         if (val_constr.datalen > 0)
39819                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39820         else
39821                 val_constr.data = NULL;
39822         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
39823         for (size_t g = 0; g < val_constr.datalen; g++) {
39824                 int64_t val_conv_6 = val_vals[g];
39825                 val_constr.data[g] = val_conv_6;
39826         }
39827         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
39828         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
39829 }
39830
39831 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) {
39832         LDKThirtyTwoBytes chain_hash_arg_ref;
39833         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
39834         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
39835         LDKCVec_u64Z short_channel_ids_arg_constr;
39836         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
39837         if (short_channel_ids_arg_constr.datalen > 0)
39838                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
39839         else
39840                 short_channel_ids_arg_constr.data = NULL;
39841         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
39842         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
39843                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
39844                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
39845         }
39846         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
39847         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
39848         int64_t ret_ref = 0;
39849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39851         return ret_ref;
39852 }
39853
39854 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
39855         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
39856         int64_t ret_ref = 0;
39857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39859         return ret_ref;
39860 }
39861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39862         LDKQueryShortChannelIds arg_conv;
39863         arg_conv.inner = untag_ptr(arg);
39864         arg_conv.is_owned = ptr_is_owned(arg);
39865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39866         arg_conv.is_owned = false;
39867         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
39868         return ret_conv;
39869 }
39870
39871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39872         LDKQueryShortChannelIds orig_conv;
39873         orig_conv.inner = untag_ptr(orig);
39874         orig_conv.is_owned = ptr_is_owned(orig);
39875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39876         orig_conv.is_owned = false;
39877         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
39878         int64_t ret_ref = 0;
39879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39881         return ret_ref;
39882 }
39883
39884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39885         LDKQueryShortChannelIds a_conv;
39886         a_conv.inner = untag_ptr(a);
39887         a_conv.is_owned = ptr_is_owned(a);
39888         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39889         a_conv.is_owned = false;
39890         LDKQueryShortChannelIds b_conv;
39891         b_conv.inner = untag_ptr(b);
39892         b_conv.is_owned = ptr_is_owned(b);
39893         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39894         b_conv.is_owned = false;
39895         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
39896         return ret_conv;
39897 }
39898
39899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39900         LDKReplyShortChannelIdsEnd this_obj_conv;
39901         this_obj_conv.inner = untag_ptr(this_obj);
39902         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39904         ReplyShortChannelIdsEnd_free(this_obj_conv);
39905 }
39906
39907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39908         LDKReplyShortChannelIdsEnd this_ptr_conv;
39909         this_ptr_conv.inner = untag_ptr(this_ptr);
39910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39912         this_ptr_conv.is_owned = false;
39913         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39914         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
39915         return ret_arr;
39916 }
39917
39918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39919         LDKReplyShortChannelIdsEnd this_ptr_conv;
39920         this_ptr_conv.inner = untag_ptr(this_ptr);
39921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39923         this_ptr_conv.is_owned = false;
39924         LDKThirtyTwoBytes val_ref;
39925         CHECK((*env)->GetArrayLength(env, val) == 32);
39926         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39927         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
39928 }
39929
39930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
39931         LDKReplyShortChannelIdsEnd this_ptr_conv;
39932         this_ptr_conv.inner = untag_ptr(this_ptr);
39933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39935         this_ptr_conv.is_owned = false;
39936         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
39937         return ret_conv;
39938 }
39939
39940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39941         LDKReplyShortChannelIdsEnd this_ptr_conv;
39942         this_ptr_conv.inner = untag_ptr(this_ptr);
39943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39945         this_ptr_conv.is_owned = false;
39946         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
39947 }
39948
39949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
39950         LDKThirtyTwoBytes chain_hash_arg_ref;
39951         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
39952         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
39953         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
39954         int64_t ret_ref = 0;
39955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39957         return ret_ref;
39958 }
39959
39960 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
39961         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
39962         int64_t ret_ref = 0;
39963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39965         return ret_ref;
39966 }
39967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39968         LDKReplyShortChannelIdsEnd arg_conv;
39969         arg_conv.inner = untag_ptr(arg);
39970         arg_conv.is_owned = ptr_is_owned(arg);
39971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39972         arg_conv.is_owned = false;
39973         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
39974         return ret_conv;
39975 }
39976
39977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39978         LDKReplyShortChannelIdsEnd orig_conv;
39979         orig_conv.inner = untag_ptr(orig);
39980         orig_conv.is_owned = ptr_is_owned(orig);
39981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39982         orig_conv.is_owned = false;
39983         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
39984         int64_t ret_ref = 0;
39985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39987         return ret_ref;
39988 }
39989
39990 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39991         LDKReplyShortChannelIdsEnd a_conv;
39992         a_conv.inner = untag_ptr(a);
39993         a_conv.is_owned = ptr_is_owned(a);
39994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39995         a_conv.is_owned = false;
39996         LDKReplyShortChannelIdsEnd b_conv;
39997         b_conv.inner = untag_ptr(b);
39998         b_conv.is_owned = ptr_is_owned(b);
39999         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40000         b_conv.is_owned = false;
40001         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
40002         return ret_conv;
40003 }
40004
40005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40006         LDKGossipTimestampFilter this_obj_conv;
40007         this_obj_conv.inner = untag_ptr(this_obj);
40008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40010         GossipTimestampFilter_free(this_obj_conv);
40011 }
40012
40013 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
40014         LDKGossipTimestampFilter this_ptr_conv;
40015         this_ptr_conv.inner = untag_ptr(this_ptr);
40016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40018         this_ptr_conv.is_owned = false;
40019         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40020         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
40021         return ret_arr;
40022 }
40023
40024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40025         LDKGossipTimestampFilter this_ptr_conv;
40026         this_ptr_conv.inner = untag_ptr(this_ptr);
40027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40029         this_ptr_conv.is_owned = false;
40030         LDKThirtyTwoBytes val_ref;
40031         CHECK((*env)->GetArrayLength(env, val) == 32);
40032         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40033         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
40034 }
40035
40036 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
40037         LDKGossipTimestampFilter this_ptr_conv;
40038         this_ptr_conv.inner = untag_ptr(this_ptr);
40039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40041         this_ptr_conv.is_owned = false;
40042         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
40043         return ret_conv;
40044 }
40045
40046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40047         LDKGossipTimestampFilter this_ptr_conv;
40048         this_ptr_conv.inner = untag_ptr(this_ptr);
40049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40051         this_ptr_conv.is_owned = false;
40052         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
40053 }
40054
40055 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
40056         LDKGossipTimestampFilter this_ptr_conv;
40057         this_ptr_conv.inner = untag_ptr(this_ptr);
40058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40060         this_ptr_conv.is_owned = false;
40061         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
40062         return ret_conv;
40063 }
40064
40065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40066         LDKGossipTimestampFilter this_ptr_conv;
40067         this_ptr_conv.inner = untag_ptr(this_ptr);
40068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40070         this_ptr_conv.is_owned = false;
40071         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
40072 }
40073
40074 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) {
40075         LDKThirtyTwoBytes chain_hash_arg_ref;
40076         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
40077         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
40078         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
40079         int64_t ret_ref = 0;
40080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40082         return ret_ref;
40083 }
40084
40085 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
40086         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
40087         int64_t ret_ref = 0;
40088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40090         return ret_ref;
40091 }
40092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40093         LDKGossipTimestampFilter arg_conv;
40094         arg_conv.inner = untag_ptr(arg);
40095         arg_conv.is_owned = ptr_is_owned(arg);
40096         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40097         arg_conv.is_owned = false;
40098         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
40099         return ret_conv;
40100 }
40101
40102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40103         LDKGossipTimestampFilter orig_conv;
40104         orig_conv.inner = untag_ptr(orig);
40105         orig_conv.is_owned = ptr_is_owned(orig);
40106         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40107         orig_conv.is_owned = false;
40108         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
40109         int64_t ret_ref = 0;
40110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40112         return ret_ref;
40113 }
40114
40115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40116         LDKGossipTimestampFilter a_conv;
40117         a_conv.inner = untag_ptr(a);
40118         a_conv.is_owned = ptr_is_owned(a);
40119         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40120         a_conv.is_owned = false;
40121         LDKGossipTimestampFilter b_conv;
40122         b_conv.inner = untag_ptr(b);
40123         b_conv.is_owned = ptr_is_owned(b);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40125         b_conv.is_owned = false;
40126         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
40127         return ret_conv;
40128 }
40129
40130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40131         if (!ptr_is_owned(this_ptr)) return;
40132         void* this_ptr_ptr = untag_ptr(this_ptr);
40133         CHECK_ACCESS(this_ptr_ptr);
40134         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
40135         FREE(untag_ptr(this_ptr));
40136         ErrorAction_free(this_ptr_conv);
40137 }
40138
40139 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
40140         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40141         *ret_copy = ErrorAction_clone(arg);
40142         int64_t ret_ref = tag_ptr(ret_copy, true);
40143         return ret_ref;
40144 }
40145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40146         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
40147         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
40148         return ret_conv;
40149 }
40150
40151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40152         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
40153         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40154         *ret_copy = ErrorAction_clone(orig_conv);
40155         int64_t ret_ref = tag_ptr(ret_copy, true);
40156         return ret_ref;
40157 }
40158
40159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
40160         LDKErrorMessage msg_conv;
40161         msg_conv.inner = untag_ptr(msg);
40162         msg_conv.is_owned = ptr_is_owned(msg);
40163         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40164         msg_conv = ErrorMessage_clone(&msg_conv);
40165         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40166         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
40167         int64_t ret_ref = tag_ptr(ret_copy, true);
40168         return ret_ref;
40169 }
40170
40171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
40172         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40173         *ret_copy = ErrorAction_ignore_error();
40174         int64_t ret_ref = tag_ptr(ret_copy, true);
40175         return ret_ref;
40176 }
40177
40178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
40179         LDKLevel a_conv = LDKLevel_from_java(env, a);
40180         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40181         *ret_copy = ErrorAction_ignore_and_log(a_conv);
40182         int64_t ret_ref = tag_ptr(ret_copy, true);
40183         return ret_ref;
40184 }
40185
40186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
40187         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40188         *ret_copy = ErrorAction_ignore_duplicate_gossip();
40189         int64_t ret_ref = tag_ptr(ret_copy, true);
40190         return ret_ref;
40191 }
40192
40193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
40194         LDKErrorMessage msg_conv;
40195         msg_conv.inner = untag_ptr(msg);
40196         msg_conv.is_owned = ptr_is_owned(msg);
40197         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40198         msg_conv = ErrorMessage_clone(&msg_conv);
40199         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40200         *ret_copy = ErrorAction_send_error_message(msg_conv);
40201         int64_t ret_ref = tag_ptr(ret_copy, true);
40202         return ret_ref;
40203 }
40204
40205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
40206         LDKWarningMessage msg_conv;
40207         msg_conv.inner = untag_ptr(msg);
40208         msg_conv.is_owned = ptr_is_owned(msg);
40209         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40210         msg_conv = WarningMessage_clone(&msg_conv);
40211         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
40212         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40213         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
40214         int64_t ret_ref = tag_ptr(ret_copy, true);
40215         return ret_ref;
40216 }
40217
40218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40219         LDKLightningError this_obj_conv;
40220         this_obj_conv.inner = untag_ptr(this_obj);
40221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40223         LightningError_free(this_obj_conv);
40224 }
40225
40226 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
40227         LDKLightningError this_ptr_conv;
40228         this_ptr_conv.inner = untag_ptr(this_ptr);
40229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40231         this_ptr_conv.is_owned = false;
40232         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
40233         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
40234         Str_free(ret_str);
40235         return ret_conv;
40236 }
40237
40238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
40239         LDKLightningError this_ptr_conv;
40240         this_ptr_conv.inner = untag_ptr(this_ptr);
40241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40243         this_ptr_conv.is_owned = false;
40244         LDKStr val_conv = java_to_owned_str(env, val);
40245         LightningError_set_err(&this_ptr_conv, val_conv);
40246 }
40247
40248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
40249         LDKLightningError this_ptr_conv;
40250         this_ptr_conv.inner = untag_ptr(this_ptr);
40251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40253         this_ptr_conv.is_owned = false;
40254         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
40255         *ret_copy = LightningError_get_action(&this_ptr_conv);
40256         int64_t ret_ref = tag_ptr(ret_copy, true);
40257         return ret_ref;
40258 }
40259
40260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40261         LDKLightningError 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         void* val_ptr = untag_ptr(val);
40267         CHECK_ACCESS(val_ptr);
40268         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
40269         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
40270         LightningError_set_action(&this_ptr_conv, val_conv);
40271 }
40272
40273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
40274         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
40275         void* action_arg_ptr = untag_ptr(action_arg);
40276         CHECK_ACCESS(action_arg_ptr);
40277         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
40278         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
40279         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
40280         int64_t ret_ref = 0;
40281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40283         return ret_ref;
40284 }
40285
40286 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
40287         LDKLightningError ret_var = LightningError_clone(arg);
40288         int64_t ret_ref = 0;
40289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40291         return ret_ref;
40292 }
40293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40294         LDKLightningError arg_conv;
40295         arg_conv.inner = untag_ptr(arg);
40296         arg_conv.is_owned = ptr_is_owned(arg);
40297         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40298         arg_conv.is_owned = false;
40299         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
40300         return ret_conv;
40301 }
40302
40303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40304         LDKLightningError orig_conv;
40305         orig_conv.inner = untag_ptr(orig);
40306         orig_conv.is_owned = ptr_is_owned(orig);
40307         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40308         orig_conv.is_owned = false;
40309         LDKLightningError ret_var = LightningError_clone(&orig_conv);
40310         int64_t ret_ref = 0;
40311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40313         return ret_ref;
40314 }
40315
40316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40317         LDKCommitmentUpdate this_obj_conv;
40318         this_obj_conv.inner = untag_ptr(this_obj);
40319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40321         CommitmentUpdate_free(this_obj_conv);
40322 }
40323
40324 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40325         LDKCommitmentUpdate this_ptr_conv;
40326         this_ptr_conv.inner = untag_ptr(this_ptr);
40327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40329         this_ptr_conv.is_owned = false;
40330         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
40331         int64_tArray ret_arr = NULL;
40332         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40333         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40334         for (size_t p = 0; p < ret_var.datalen; p++) {
40335                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
40336                 int64_t ret_conv_15_ref = 0;
40337                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
40338                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
40339                 ret_arr_ptr[p] = ret_conv_15_ref;
40340         }
40341         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40342         FREE(ret_var.data);
40343         return ret_arr;
40344 }
40345
40346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40347         LDKCommitmentUpdate this_ptr_conv;
40348         this_ptr_conv.inner = untag_ptr(this_ptr);
40349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40351         this_ptr_conv.is_owned = false;
40352         LDKCVec_UpdateAddHTLCZ val_constr;
40353         val_constr.datalen = (*env)->GetArrayLength(env, val);
40354         if (val_constr.datalen > 0)
40355                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
40356         else
40357                 val_constr.data = NULL;
40358         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40359         for (size_t p = 0; p < val_constr.datalen; p++) {
40360                 int64_t val_conv_15 = val_vals[p];
40361                 LDKUpdateAddHTLC val_conv_15_conv;
40362                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
40363                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
40364                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
40365                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
40366                 val_constr.data[p] = val_conv_15_conv;
40367         }
40368         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40369         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
40370 }
40371
40372 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40373         LDKCommitmentUpdate this_ptr_conv;
40374         this_ptr_conv.inner = untag_ptr(this_ptr);
40375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40377         this_ptr_conv.is_owned = false;
40378         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
40379         int64_tArray ret_arr = NULL;
40380         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40381         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40382         for (size_t t = 0; t < ret_var.datalen; t++) {
40383                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
40384                 int64_t ret_conv_19_ref = 0;
40385                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
40386                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
40387                 ret_arr_ptr[t] = ret_conv_19_ref;
40388         }
40389         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40390         FREE(ret_var.data);
40391         return ret_arr;
40392 }
40393
40394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40395         LDKCommitmentUpdate 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         LDKCVec_UpdateFulfillHTLCZ val_constr;
40401         val_constr.datalen = (*env)->GetArrayLength(env, val);
40402         if (val_constr.datalen > 0)
40403                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
40404         else
40405                 val_constr.data = NULL;
40406         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40407         for (size_t t = 0; t < val_constr.datalen; t++) {
40408                 int64_t val_conv_19 = val_vals[t];
40409                 LDKUpdateFulfillHTLC val_conv_19_conv;
40410                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
40411                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
40412                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
40413                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
40414                 val_constr.data[t] = val_conv_19_conv;
40415         }
40416         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40417         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
40418 }
40419
40420 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40421         LDKCommitmentUpdate this_ptr_conv;
40422         this_ptr_conv.inner = untag_ptr(this_ptr);
40423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40425         this_ptr_conv.is_owned = false;
40426         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
40427         int64_tArray ret_arr = NULL;
40428         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40429         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40430         for (size_t q = 0; q < ret_var.datalen; q++) {
40431                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
40432                 int64_t ret_conv_16_ref = 0;
40433                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40434                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40435                 ret_arr_ptr[q] = ret_conv_16_ref;
40436         }
40437         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40438         FREE(ret_var.data);
40439         return ret_arr;
40440 }
40441
40442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40443         LDKCommitmentUpdate this_ptr_conv;
40444         this_ptr_conv.inner = untag_ptr(this_ptr);
40445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40447         this_ptr_conv.is_owned = false;
40448         LDKCVec_UpdateFailHTLCZ val_constr;
40449         val_constr.datalen = (*env)->GetArrayLength(env, val);
40450         if (val_constr.datalen > 0)
40451                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
40452         else
40453                 val_constr.data = NULL;
40454         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40455         for (size_t q = 0; q < val_constr.datalen; q++) {
40456                 int64_t val_conv_16 = val_vals[q];
40457                 LDKUpdateFailHTLC val_conv_16_conv;
40458                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
40459                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
40460                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
40461                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
40462                 val_constr.data[q] = val_conv_16_conv;
40463         }
40464         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40465         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
40466 }
40467
40468 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40469         LDKCommitmentUpdate this_ptr_conv;
40470         this_ptr_conv.inner = untag_ptr(this_ptr);
40471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40473         this_ptr_conv.is_owned = false;
40474         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
40475         int64_tArray ret_arr = NULL;
40476         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40477         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40478         for (size_t z = 0; z < ret_var.datalen; z++) {
40479                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
40480                 int64_t ret_conv_25_ref = 0;
40481                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
40482                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
40483                 ret_arr_ptr[z] = ret_conv_25_ref;
40484         }
40485         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40486         FREE(ret_var.data);
40487         return ret_arr;
40488 }
40489
40490 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) {
40491         LDKCommitmentUpdate this_ptr_conv;
40492         this_ptr_conv.inner = untag_ptr(this_ptr);
40493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40495         this_ptr_conv.is_owned = false;
40496         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
40497         val_constr.datalen = (*env)->GetArrayLength(env, val);
40498         if (val_constr.datalen > 0)
40499                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
40500         else
40501                 val_constr.data = NULL;
40502         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40503         for (size_t z = 0; z < val_constr.datalen; z++) {
40504                 int64_t val_conv_25 = val_vals[z];
40505                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
40506                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
40507                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
40508                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
40509                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
40510                 val_constr.data[z] = val_conv_25_conv;
40511         }
40512         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40513         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
40514 }
40515
40516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
40517         LDKCommitmentUpdate this_ptr_conv;
40518         this_ptr_conv.inner = untag_ptr(this_ptr);
40519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40521         this_ptr_conv.is_owned = false;
40522         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_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 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40530         LDKCommitmentUpdate this_ptr_conv;
40531         this_ptr_conv.inner = untag_ptr(this_ptr);
40532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40534         this_ptr_conv.is_owned = false;
40535         LDKUpdateFee val_conv;
40536         val_conv.inner = untag_ptr(val);
40537         val_conv.is_owned = ptr_is_owned(val);
40538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40539         val_conv = UpdateFee_clone(&val_conv);
40540         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
40541 }
40542
40543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
40544         LDKCommitmentUpdate this_ptr_conv;
40545         this_ptr_conv.inner = untag_ptr(this_ptr);
40546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40548         this_ptr_conv.is_owned = false;
40549         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
40550         int64_t ret_ref = 0;
40551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40553         return ret_ref;
40554 }
40555
40556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40557         LDKCommitmentUpdate this_ptr_conv;
40558         this_ptr_conv.inner = untag_ptr(this_ptr);
40559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40561         this_ptr_conv.is_owned = false;
40562         LDKCommitmentSigned val_conv;
40563         val_conv.inner = untag_ptr(val);
40564         val_conv.is_owned = ptr_is_owned(val);
40565         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40566         val_conv = CommitmentSigned_clone(&val_conv);
40567         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
40568 }
40569
40570 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) {
40571         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
40572         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
40573         if (update_add_htlcs_arg_constr.datalen > 0)
40574                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
40575         else
40576                 update_add_htlcs_arg_constr.data = NULL;
40577         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
40578         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
40579                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
40580                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
40581                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
40582                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
40583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
40584                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
40585                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
40586         }
40587         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
40588         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
40589         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
40590         if (update_fulfill_htlcs_arg_constr.datalen > 0)
40591                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
40592         else
40593                 update_fulfill_htlcs_arg_constr.data = NULL;
40594         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
40595         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
40596                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
40597                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
40598                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
40599                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
40600                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
40601                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
40602                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
40603         }
40604         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
40605         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
40606         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
40607         if (update_fail_htlcs_arg_constr.datalen > 0)
40608                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
40609         else
40610                 update_fail_htlcs_arg_constr.data = NULL;
40611         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
40612         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
40613                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
40614                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
40615                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
40616                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
40617                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
40618                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
40619                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
40620         }
40621         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
40622         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
40623         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
40624         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
40625                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
40626         else
40627                 update_fail_malformed_htlcs_arg_constr.data = NULL;
40628         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
40629         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
40630                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
40631                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
40632                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
40633                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
40634                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
40635                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
40636                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
40637         }
40638         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
40639         LDKUpdateFee update_fee_arg_conv;
40640         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
40641         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
40642         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
40643         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
40644         LDKCommitmentSigned commitment_signed_arg_conv;
40645         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
40646         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
40647         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
40648         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
40649         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);
40650         int64_t ret_ref = 0;
40651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40653         return ret_ref;
40654 }
40655
40656 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
40657         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
40658         int64_t ret_ref = 0;
40659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40661         return ret_ref;
40662 }
40663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40664         LDKCommitmentUpdate arg_conv;
40665         arg_conv.inner = untag_ptr(arg);
40666         arg_conv.is_owned = ptr_is_owned(arg);
40667         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40668         arg_conv.is_owned = false;
40669         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
40670         return ret_conv;
40671 }
40672
40673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40674         LDKCommitmentUpdate orig_conv;
40675         orig_conv.inner = untag_ptr(orig);
40676         orig_conv.is_owned = ptr_is_owned(orig);
40677         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40678         orig_conv.is_owned = false;
40679         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
40680         int64_t ret_ref = 0;
40681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40683         return ret_ref;
40684 }
40685
40686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40687         LDKCommitmentUpdate a_conv;
40688         a_conv.inner = untag_ptr(a);
40689         a_conv.is_owned = ptr_is_owned(a);
40690         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40691         a_conv.is_owned = false;
40692         LDKCommitmentUpdate b_conv;
40693         b_conv.inner = untag_ptr(b);
40694         b_conv.is_owned = ptr_is_owned(b);
40695         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40696         b_conv.is_owned = false;
40697         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
40698         return ret_conv;
40699 }
40700
40701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40702         if (!ptr_is_owned(this_ptr)) return;
40703         void* this_ptr_ptr = untag_ptr(this_ptr);
40704         CHECK_ACCESS(this_ptr_ptr);
40705         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
40706         FREE(untag_ptr(this_ptr));
40707         ChannelMessageHandler_free(this_ptr_conv);
40708 }
40709
40710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40711         if (!ptr_is_owned(this_ptr)) return;
40712         void* this_ptr_ptr = untag_ptr(this_ptr);
40713         CHECK_ACCESS(this_ptr_ptr);
40714         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
40715         FREE(untag_ptr(this_ptr));
40716         RoutingMessageHandler_free(this_ptr_conv);
40717 }
40718
40719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40720         if (!ptr_is_owned(this_ptr)) return;
40721         void* this_ptr_ptr = untag_ptr(this_ptr);
40722         CHECK_ACCESS(this_ptr_ptr);
40723         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
40724         FREE(untag_ptr(this_ptr));
40725         OnionMessageHandler_free(this_ptr_conv);
40726 }
40727
40728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
40729         LDKAcceptChannel obj_conv;
40730         obj_conv.inner = untag_ptr(obj);
40731         obj_conv.is_owned = ptr_is_owned(obj);
40732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40733         obj_conv.is_owned = false;
40734         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
40735         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40736         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40737         CVec_u8Z_free(ret_var);
40738         return ret_arr;
40739 }
40740
40741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40742         LDKu8slice ser_ref;
40743         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40744         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40745         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
40746         *ret_conv = AcceptChannel_read(ser_ref);
40747         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40748         return tag_ptr(ret_conv, true);
40749 }
40750
40751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
40752         LDKAnnouncementSignatures obj_conv;
40753         obj_conv.inner = untag_ptr(obj);
40754         obj_conv.is_owned = ptr_is_owned(obj);
40755         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40756         obj_conv.is_owned = false;
40757         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
40758         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40759         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40760         CVec_u8Z_free(ret_var);
40761         return ret_arr;
40762 }
40763
40764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40765         LDKu8slice ser_ref;
40766         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40767         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40768         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
40769         *ret_conv = AnnouncementSignatures_read(ser_ref);
40770         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40771         return tag_ptr(ret_conv, true);
40772 }
40773
40774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
40775         LDKChannelReestablish obj_conv;
40776         obj_conv.inner = untag_ptr(obj);
40777         obj_conv.is_owned = ptr_is_owned(obj);
40778         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40779         obj_conv.is_owned = false;
40780         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
40781         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40782         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40783         CVec_u8Z_free(ret_var);
40784         return ret_arr;
40785 }
40786
40787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40788         LDKu8slice ser_ref;
40789         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40790         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40791         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
40792         *ret_conv = ChannelReestablish_read(ser_ref);
40793         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40794         return tag_ptr(ret_conv, true);
40795 }
40796
40797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
40798         LDKClosingSigned obj_conv;
40799         obj_conv.inner = untag_ptr(obj);
40800         obj_conv.is_owned = ptr_is_owned(obj);
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40802         obj_conv.is_owned = false;
40803         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
40804         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40805         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40806         CVec_u8Z_free(ret_var);
40807         return ret_arr;
40808 }
40809
40810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40811         LDKu8slice ser_ref;
40812         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40813         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40814         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
40815         *ret_conv = ClosingSigned_read(ser_ref);
40816         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40817         return tag_ptr(ret_conv, true);
40818 }
40819
40820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
40821         LDKClosingSignedFeeRange obj_conv;
40822         obj_conv.inner = untag_ptr(obj);
40823         obj_conv.is_owned = ptr_is_owned(obj);
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40825         obj_conv.is_owned = false;
40826         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
40827         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40828         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40829         CVec_u8Z_free(ret_var);
40830         return ret_arr;
40831 }
40832
40833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40834         LDKu8slice ser_ref;
40835         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40836         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40837         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
40838         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
40839         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40840         return tag_ptr(ret_conv, true);
40841 }
40842
40843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
40844         LDKCommitmentSigned obj_conv;
40845         obj_conv.inner = untag_ptr(obj);
40846         obj_conv.is_owned = ptr_is_owned(obj);
40847         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40848         obj_conv.is_owned = false;
40849         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
40850         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40851         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40852         CVec_u8Z_free(ret_var);
40853         return ret_arr;
40854 }
40855
40856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40857         LDKu8slice ser_ref;
40858         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40859         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40860         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
40861         *ret_conv = CommitmentSigned_read(ser_ref);
40862         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40863         return tag_ptr(ret_conv, true);
40864 }
40865
40866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
40867         LDKFundingCreated obj_conv;
40868         obj_conv.inner = untag_ptr(obj);
40869         obj_conv.is_owned = ptr_is_owned(obj);
40870         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40871         obj_conv.is_owned = false;
40872         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
40873         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40874         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40875         CVec_u8Z_free(ret_var);
40876         return ret_arr;
40877 }
40878
40879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40880         LDKu8slice ser_ref;
40881         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40882         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40883         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
40884         *ret_conv = FundingCreated_read(ser_ref);
40885         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40886         return tag_ptr(ret_conv, true);
40887 }
40888
40889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
40890         LDKFundingSigned obj_conv;
40891         obj_conv.inner = untag_ptr(obj);
40892         obj_conv.is_owned = ptr_is_owned(obj);
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40894         obj_conv.is_owned = false;
40895         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
40896         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40897         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40898         CVec_u8Z_free(ret_var);
40899         return ret_arr;
40900 }
40901
40902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40903         LDKu8slice ser_ref;
40904         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40905         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40906         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
40907         *ret_conv = FundingSigned_read(ser_ref);
40908         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40909         return tag_ptr(ret_conv, true);
40910 }
40911
40912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
40913         LDKChannelReady obj_conv;
40914         obj_conv.inner = untag_ptr(obj);
40915         obj_conv.is_owned = ptr_is_owned(obj);
40916         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40917         obj_conv.is_owned = false;
40918         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
40919         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40920         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40921         CVec_u8Z_free(ret_var);
40922         return ret_arr;
40923 }
40924
40925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40926         LDKu8slice ser_ref;
40927         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40928         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40929         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
40930         *ret_conv = ChannelReady_read(ser_ref);
40931         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40932         return tag_ptr(ret_conv, true);
40933 }
40934
40935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
40936         LDKInit obj_conv;
40937         obj_conv.inner = untag_ptr(obj);
40938         obj_conv.is_owned = ptr_is_owned(obj);
40939         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40940         obj_conv.is_owned = false;
40941         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
40942         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40943         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40944         CVec_u8Z_free(ret_var);
40945         return ret_arr;
40946 }
40947
40948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40949         LDKu8slice ser_ref;
40950         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40951         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40952         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
40953         *ret_conv = Init_read(ser_ref);
40954         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40955         return tag_ptr(ret_conv, true);
40956 }
40957
40958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
40959         LDKOpenChannel obj_conv;
40960         obj_conv.inner = untag_ptr(obj);
40961         obj_conv.is_owned = ptr_is_owned(obj);
40962         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40963         obj_conv.is_owned = false;
40964         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
40965         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40966         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40967         CVec_u8Z_free(ret_var);
40968         return ret_arr;
40969 }
40970
40971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40972         LDKu8slice ser_ref;
40973         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40974         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40975         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
40976         *ret_conv = OpenChannel_read(ser_ref);
40977         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40978         return tag_ptr(ret_conv, true);
40979 }
40980
40981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
40982         LDKRevokeAndACK obj_conv;
40983         obj_conv.inner = untag_ptr(obj);
40984         obj_conv.is_owned = ptr_is_owned(obj);
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40986         obj_conv.is_owned = false;
40987         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
40988         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40989         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40990         CVec_u8Z_free(ret_var);
40991         return ret_arr;
40992 }
40993
40994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40995         LDKu8slice ser_ref;
40996         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40997         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40998         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
40999         *ret_conv = RevokeAndACK_read(ser_ref);
41000         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41001         return tag_ptr(ret_conv, true);
41002 }
41003
41004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
41005         LDKShutdown obj_conv;
41006         obj_conv.inner = untag_ptr(obj);
41007         obj_conv.is_owned = ptr_is_owned(obj);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41009         obj_conv.is_owned = false;
41010         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
41011         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41012         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41013         CVec_u8Z_free(ret_var);
41014         return ret_arr;
41015 }
41016
41017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41018         LDKu8slice ser_ref;
41019         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41020         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41021         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
41022         *ret_conv = Shutdown_read(ser_ref);
41023         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41024         return tag_ptr(ret_conv, true);
41025 }
41026
41027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
41028         LDKUpdateFailHTLC obj_conv;
41029         obj_conv.inner = untag_ptr(obj);
41030         obj_conv.is_owned = ptr_is_owned(obj);
41031         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41032         obj_conv.is_owned = false;
41033         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
41034         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41035         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41036         CVec_u8Z_free(ret_var);
41037         return ret_arr;
41038 }
41039
41040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41041         LDKu8slice ser_ref;
41042         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41043         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41044         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
41045         *ret_conv = UpdateFailHTLC_read(ser_ref);
41046         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41047         return tag_ptr(ret_conv, true);
41048 }
41049
41050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
41051         LDKUpdateFailMalformedHTLC obj_conv;
41052         obj_conv.inner = untag_ptr(obj);
41053         obj_conv.is_owned = ptr_is_owned(obj);
41054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41055         obj_conv.is_owned = false;
41056         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
41057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41059         CVec_u8Z_free(ret_var);
41060         return ret_arr;
41061 }
41062
41063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41064         LDKu8slice ser_ref;
41065         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41066         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41067         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
41068         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
41069         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41070         return tag_ptr(ret_conv, true);
41071 }
41072
41073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
41074         LDKUpdateFee obj_conv;
41075         obj_conv.inner = untag_ptr(obj);
41076         obj_conv.is_owned = ptr_is_owned(obj);
41077         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41078         obj_conv.is_owned = false;
41079         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
41080         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41081         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41082         CVec_u8Z_free(ret_var);
41083         return ret_arr;
41084 }
41085
41086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41087         LDKu8slice ser_ref;
41088         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41089         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41090         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
41091         *ret_conv = UpdateFee_read(ser_ref);
41092         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41093         return tag_ptr(ret_conv, true);
41094 }
41095
41096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
41097         LDKUpdateFulfillHTLC obj_conv;
41098         obj_conv.inner = untag_ptr(obj);
41099         obj_conv.is_owned = ptr_is_owned(obj);
41100         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41101         obj_conv.is_owned = false;
41102         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
41103         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41104         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41105         CVec_u8Z_free(ret_var);
41106         return ret_arr;
41107 }
41108
41109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41110         LDKu8slice ser_ref;
41111         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41112         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41113         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
41114         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
41115         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41116         return tag_ptr(ret_conv, true);
41117 }
41118
41119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
41120         LDKUpdateAddHTLC obj_conv;
41121         obj_conv.inner = untag_ptr(obj);
41122         obj_conv.is_owned = ptr_is_owned(obj);
41123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41124         obj_conv.is_owned = false;
41125         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
41126         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41127         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41128         CVec_u8Z_free(ret_var);
41129         return ret_arr;
41130 }
41131
41132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41133         LDKu8slice ser_ref;
41134         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41135         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41136         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
41137         *ret_conv = UpdateAddHTLC_read(ser_ref);
41138         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41139         return tag_ptr(ret_conv, true);
41140 }
41141
41142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41143         LDKu8slice ser_ref;
41144         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41145         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41146         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
41147         *ret_conv = OnionMessage_read(ser_ref);
41148         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41149         return tag_ptr(ret_conv, true);
41150 }
41151
41152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
41153         LDKOnionMessage obj_conv;
41154         obj_conv.inner = untag_ptr(obj);
41155         obj_conv.is_owned = ptr_is_owned(obj);
41156         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41157         obj_conv.is_owned = false;
41158         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
41159         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41160         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41161         CVec_u8Z_free(ret_var);
41162         return ret_arr;
41163 }
41164
41165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
41166         LDKPing obj_conv;
41167         obj_conv.inner = untag_ptr(obj);
41168         obj_conv.is_owned = ptr_is_owned(obj);
41169         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41170         obj_conv.is_owned = false;
41171         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
41172         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41173         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41174         CVec_u8Z_free(ret_var);
41175         return ret_arr;
41176 }
41177
41178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41179         LDKu8slice ser_ref;
41180         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41181         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41182         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
41183         *ret_conv = Ping_read(ser_ref);
41184         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41185         return tag_ptr(ret_conv, true);
41186 }
41187
41188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
41189         LDKPong obj_conv;
41190         obj_conv.inner = untag_ptr(obj);
41191         obj_conv.is_owned = ptr_is_owned(obj);
41192         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41193         obj_conv.is_owned = false;
41194         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
41195         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41196         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41197         CVec_u8Z_free(ret_var);
41198         return ret_arr;
41199 }
41200
41201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41202         LDKu8slice ser_ref;
41203         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41204         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41205         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
41206         *ret_conv = Pong_read(ser_ref);
41207         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41208         return tag_ptr(ret_conv, true);
41209 }
41210
41211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
41212         LDKUnsignedChannelAnnouncement obj_conv;
41213         obj_conv.inner = untag_ptr(obj);
41214         obj_conv.is_owned = ptr_is_owned(obj);
41215         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41216         obj_conv.is_owned = false;
41217         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
41218         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41219         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41220         CVec_u8Z_free(ret_var);
41221         return ret_arr;
41222 }
41223
41224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41225         LDKu8slice ser_ref;
41226         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41227         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41228         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
41229         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
41230         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41231         return tag_ptr(ret_conv, true);
41232 }
41233
41234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
41235         LDKChannelAnnouncement obj_conv;
41236         obj_conv.inner = untag_ptr(obj);
41237         obj_conv.is_owned = ptr_is_owned(obj);
41238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41239         obj_conv.is_owned = false;
41240         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
41241         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41242         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41243         CVec_u8Z_free(ret_var);
41244         return ret_arr;
41245 }
41246
41247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41248         LDKu8slice ser_ref;
41249         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41250         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41251         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
41252         *ret_conv = ChannelAnnouncement_read(ser_ref);
41253         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41254         return tag_ptr(ret_conv, true);
41255 }
41256
41257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
41258         LDKUnsignedChannelUpdate obj_conv;
41259         obj_conv.inner = untag_ptr(obj);
41260         obj_conv.is_owned = ptr_is_owned(obj);
41261         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41262         obj_conv.is_owned = false;
41263         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
41264         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41265         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41266         CVec_u8Z_free(ret_var);
41267         return ret_arr;
41268 }
41269
41270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41271         LDKu8slice ser_ref;
41272         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41273         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41274         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
41275         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
41276         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41277         return tag_ptr(ret_conv, true);
41278 }
41279
41280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
41281         LDKChannelUpdate obj_conv;
41282         obj_conv.inner = untag_ptr(obj);
41283         obj_conv.is_owned = ptr_is_owned(obj);
41284         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41285         obj_conv.is_owned = false;
41286         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
41287         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41288         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41289         CVec_u8Z_free(ret_var);
41290         return ret_arr;
41291 }
41292
41293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41294         LDKu8slice ser_ref;
41295         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41296         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41297         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
41298         *ret_conv = ChannelUpdate_read(ser_ref);
41299         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41300         return tag_ptr(ret_conv, true);
41301 }
41302
41303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
41304         LDKErrorMessage obj_conv;
41305         obj_conv.inner = untag_ptr(obj);
41306         obj_conv.is_owned = ptr_is_owned(obj);
41307         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41308         obj_conv.is_owned = false;
41309         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
41310         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41311         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41312         CVec_u8Z_free(ret_var);
41313         return ret_arr;
41314 }
41315
41316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41317         LDKu8slice ser_ref;
41318         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41319         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41320         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
41321         *ret_conv = ErrorMessage_read(ser_ref);
41322         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41323         return tag_ptr(ret_conv, true);
41324 }
41325
41326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
41327         LDKWarningMessage obj_conv;
41328         obj_conv.inner = untag_ptr(obj);
41329         obj_conv.is_owned = ptr_is_owned(obj);
41330         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41331         obj_conv.is_owned = false;
41332         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
41333         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41334         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41335         CVec_u8Z_free(ret_var);
41336         return ret_arr;
41337 }
41338
41339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41340         LDKu8slice ser_ref;
41341         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41342         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41343         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
41344         *ret_conv = WarningMessage_read(ser_ref);
41345         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41346         return tag_ptr(ret_conv, true);
41347 }
41348
41349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
41350         LDKUnsignedNodeAnnouncement obj_conv;
41351         obj_conv.inner = untag_ptr(obj);
41352         obj_conv.is_owned = ptr_is_owned(obj);
41353         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41354         obj_conv.is_owned = false;
41355         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
41356         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41357         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41358         CVec_u8Z_free(ret_var);
41359         return ret_arr;
41360 }
41361
41362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41363         LDKu8slice ser_ref;
41364         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41365         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41366         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
41367         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
41368         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41369         return tag_ptr(ret_conv, true);
41370 }
41371
41372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
41373         LDKNodeAnnouncement obj_conv;
41374         obj_conv.inner = untag_ptr(obj);
41375         obj_conv.is_owned = ptr_is_owned(obj);
41376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41377         obj_conv.is_owned = false;
41378         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
41379         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41380         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41381         CVec_u8Z_free(ret_var);
41382         return ret_arr;
41383 }
41384
41385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41386         LDKu8slice ser_ref;
41387         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41388         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41389         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
41390         *ret_conv = NodeAnnouncement_read(ser_ref);
41391         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41392         return tag_ptr(ret_conv, true);
41393 }
41394
41395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41396         LDKu8slice ser_ref;
41397         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41398         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41399         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
41400         *ret_conv = QueryShortChannelIds_read(ser_ref);
41401         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41402         return tag_ptr(ret_conv, true);
41403 }
41404
41405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
41406         LDKQueryShortChannelIds obj_conv;
41407         obj_conv.inner = untag_ptr(obj);
41408         obj_conv.is_owned = ptr_is_owned(obj);
41409         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41410         obj_conv.is_owned = false;
41411         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
41412         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41413         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41414         CVec_u8Z_free(ret_var);
41415         return ret_arr;
41416 }
41417
41418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
41419         LDKReplyShortChannelIdsEnd obj_conv;
41420         obj_conv.inner = untag_ptr(obj);
41421         obj_conv.is_owned = ptr_is_owned(obj);
41422         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41423         obj_conv.is_owned = false;
41424         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
41425         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41426         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41427         CVec_u8Z_free(ret_var);
41428         return ret_arr;
41429 }
41430
41431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41432         LDKu8slice ser_ref;
41433         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41434         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41435         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
41436         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
41437         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41438         return tag_ptr(ret_conv, true);
41439 }
41440
41441 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
41442         LDKQueryChannelRange this_arg_conv;
41443         this_arg_conv.inner = untag_ptr(this_arg);
41444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41446         this_arg_conv.is_owned = false;
41447         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
41448         return ret_conv;
41449 }
41450
41451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
41452         LDKQueryChannelRange obj_conv;
41453         obj_conv.inner = untag_ptr(obj);
41454         obj_conv.is_owned = ptr_is_owned(obj);
41455         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41456         obj_conv.is_owned = false;
41457         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
41458         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41459         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41460         CVec_u8Z_free(ret_var);
41461         return ret_arr;
41462 }
41463
41464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41465         LDKu8slice ser_ref;
41466         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41467         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41468         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
41469         *ret_conv = QueryChannelRange_read(ser_ref);
41470         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41471         return tag_ptr(ret_conv, true);
41472 }
41473
41474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41475         LDKu8slice ser_ref;
41476         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41477         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41478         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
41479         *ret_conv = ReplyChannelRange_read(ser_ref);
41480         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41481         return tag_ptr(ret_conv, true);
41482 }
41483
41484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
41485         LDKReplyChannelRange obj_conv;
41486         obj_conv.inner = untag_ptr(obj);
41487         obj_conv.is_owned = ptr_is_owned(obj);
41488         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41489         obj_conv.is_owned = false;
41490         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
41491         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41492         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41493         CVec_u8Z_free(ret_var);
41494         return ret_arr;
41495 }
41496
41497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
41498         LDKGossipTimestampFilter obj_conv;
41499         obj_conv.inner = untag_ptr(obj);
41500         obj_conv.is_owned = ptr_is_owned(obj);
41501         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41502         obj_conv.is_owned = false;
41503         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
41504         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41505         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41506         CVec_u8Z_free(ret_var);
41507         return ret_arr;
41508 }
41509
41510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41511         LDKu8slice ser_ref;
41512         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41513         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41514         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
41515         *ret_conv = GossipTimestampFilter_read(ser_ref);
41516         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41517         return tag_ptr(ret_conv, true);
41518 }
41519
41520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41521         if (!ptr_is_owned(this_ptr)) return;
41522         void* this_ptr_ptr = untag_ptr(this_ptr);
41523         CHECK_ACCESS(this_ptr_ptr);
41524         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
41525         FREE(untag_ptr(this_ptr));
41526         CustomMessageHandler_free(this_ptr_conv);
41527 }
41528
41529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41530         LDKIgnoringMessageHandler this_obj_conv;
41531         this_obj_conv.inner = untag_ptr(this_obj);
41532         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41534         IgnoringMessageHandler_free(this_obj_conv);
41535 }
41536
41537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
41538         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
41539         int64_t ret_ref = 0;
41540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41542         return ret_ref;
41543 }
41544
41545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41546         LDKIgnoringMessageHandler this_arg_conv;
41547         this_arg_conv.inner = untag_ptr(this_arg);
41548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41550         this_arg_conv.is_owned = false;
41551         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41552         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
41553         return tag_ptr(ret_ret, true);
41554 }
41555
41556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41557         LDKIgnoringMessageHandler this_arg_conv;
41558         this_arg_conv.inner = untag_ptr(this_arg);
41559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41561         this_arg_conv.is_owned = false;
41562         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
41563         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
41564         return tag_ptr(ret_ret, true);
41565 }
41566
41567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41568         LDKIgnoringMessageHandler this_arg_conv;
41569         this_arg_conv.inner = untag_ptr(this_arg);
41570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41572         this_arg_conv.is_owned = false;
41573         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
41574         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
41575         return tag_ptr(ret_ret, true);
41576 }
41577
41578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41579         LDKIgnoringMessageHandler this_arg_conv;
41580         this_arg_conv.inner = untag_ptr(this_arg);
41581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41583         this_arg_conv.is_owned = false;
41584         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
41585         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
41586         return tag_ptr(ret_ret, true);
41587 }
41588
41589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41590         LDKIgnoringMessageHandler this_arg_conv;
41591         this_arg_conv.inner = untag_ptr(this_arg);
41592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41594         this_arg_conv.is_owned = false;
41595         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
41596         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
41597         return tag_ptr(ret_ret, true);
41598 }
41599
41600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
41601         LDKIgnoringMessageHandler this_arg_conv;
41602         this_arg_conv.inner = untag_ptr(this_arg);
41603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41605         this_arg_conv.is_owned = false;
41606         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
41607         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
41608         return tag_ptr(ret_ret, true);
41609 }
41610
41611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41612         LDKIgnoringMessageHandler this_arg_conv;
41613         this_arg_conv.inner = untag_ptr(this_arg);
41614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41616         this_arg_conv.is_owned = false;
41617         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
41618         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
41619         return tag_ptr(ret_ret, true);
41620 }
41621
41622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41623         LDKErroringMessageHandler this_obj_conv;
41624         this_obj_conv.inner = untag_ptr(this_obj);
41625         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41627         ErroringMessageHandler_free(this_obj_conv);
41628 }
41629
41630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
41631         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
41632         int64_t ret_ref = 0;
41633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41635         return ret_ref;
41636 }
41637
41638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41639         LDKErroringMessageHandler this_arg_conv;
41640         this_arg_conv.inner = untag_ptr(this_arg);
41641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41643         this_arg_conv.is_owned = false;
41644         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41645         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
41646         return tag_ptr(ret_ret, true);
41647 }
41648
41649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41650         LDKErroringMessageHandler this_arg_conv;
41651         this_arg_conv.inner = untag_ptr(this_arg);
41652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41654         this_arg_conv.is_owned = false;
41655         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
41656         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
41657         return tag_ptr(ret_ret, true);
41658 }
41659
41660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41661         LDKMessageHandler this_obj_conv;
41662         this_obj_conv.inner = untag_ptr(this_obj);
41663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41665         MessageHandler_free(this_obj_conv);
41666 }
41667
41668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
41669         LDKMessageHandler this_ptr_conv;
41670         this_ptr_conv.inner = untag_ptr(this_ptr);
41671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41673         this_ptr_conv.is_owned = false;
41674         // WARNING: This object doesn't live past this scope, needs clone!
41675         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
41676         return ret_ret;
41677 }
41678
41679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41680         LDKMessageHandler this_ptr_conv;
41681         this_ptr_conv.inner = untag_ptr(this_ptr);
41682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41684         this_ptr_conv.is_owned = false;
41685         void* val_ptr = untag_ptr(val);
41686         CHECK_ACCESS(val_ptr);
41687         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
41688         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
41689                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41690                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
41691         }
41692         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
41693 }
41694
41695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
41696         LDKMessageHandler 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         // WARNING: This object doesn't live past this scope, needs clone!
41702         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
41703         return ret_ret;
41704 }
41705
41706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41707         LDKMessageHandler this_ptr_conv;
41708         this_ptr_conv.inner = untag_ptr(this_ptr);
41709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41711         this_ptr_conv.is_owned = false;
41712         void* val_ptr = untag_ptr(val);
41713         CHECK_ACCESS(val_ptr);
41714         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
41715         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
41716                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41717                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
41718         }
41719         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
41720 }
41721
41722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
41723         LDKMessageHandler this_ptr_conv;
41724         this_ptr_conv.inner = untag_ptr(this_ptr);
41725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41727         this_ptr_conv.is_owned = false;
41728         // WARNING: This object doesn't live past this scope, needs clone!
41729         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
41730         return ret_ret;
41731 }
41732
41733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41734         LDKMessageHandler 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         void* val_ptr = untag_ptr(val);
41740         CHECK_ACCESS(val_ptr);
41741         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
41742         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
41743                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41744                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
41745         }
41746         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
41747 }
41748
41749 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) {
41750         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
41751         CHECK_ACCESS(chan_handler_arg_ptr);
41752         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
41753         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
41754                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41755                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
41756         }
41757         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
41758         CHECK_ACCESS(route_handler_arg_ptr);
41759         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
41760         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
41761                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41762                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
41763         }
41764         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
41765         CHECK_ACCESS(onion_message_handler_arg_ptr);
41766         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
41767         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
41768                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41769                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
41770         }
41771         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
41772         int64_t ret_ref = 0;
41773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41775         return ret_ref;
41776 }
41777
41778 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
41779         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
41780         *ret_ret = SocketDescriptor_clone(arg);
41781         return tag_ptr(ret_ret, true);
41782 }
41783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41784         void* arg_ptr = untag_ptr(arg);
41785         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
41786         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
41787         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
41788         return ret_conv;
41789 }
41790
41791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41792         void* orig_ptr = untag_ptr(orig);
41793         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
41794         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
41795         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
41796         *ret_ret = SocketDescriptor_clone(orig_conv);
41797         return tag_ptr(ret_ret, true);
41798 }
41799
41800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41801         if (!ptr_is_owned(this_ptr)) return;
41802         void* this_ptr_ptr = untag_ptr(this_ptr);
41803         CHECK_ACCESS(this_ptr_ptr);
41804         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
41805         FREE(untag_ptr(this_ptr));
41806         SocketDescriptor_free(this_ptr_conv);
41807 }
41808
41809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41810         LDKPeerHandleError this_obj_conv;
41811         this_obj_conv.inner = untag_ptr(this_obj);
41812         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41814         PeerHandleError_free(this_obj_conv);
41815 }
41816
41817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
41818         LDKPeerHandleError ret_var = PeerHandleError_new();
41819         int64_t ret_ref = 0;
41820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41822         return ret_ref;
41823 }
41824
41825 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
41826         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
41827         int64_t ret_ref = 0;
41828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41830         return ret_ref;
41831 }
41832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41833         LDKPeerHandleError arg_conv;
41834         arg_conv.inner = untag_ptr(arg);
41835         arg_conv.is_owned = ptr_is_owned(arg);
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41837         arg_conv.is_owned = false;
41838         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
41839         return ret_conv;
41840 }
41841
41842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41843         LDKPeerHandleError orig_conv;
41844         orig_conv.inner = untag_ptr(orig);
41845         orig_conv.is_owned = ptr_is_owned(orig);
41846         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41847         orig_conv.is_owned = false;
41848         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
41849         int64_t ret_ref = 0;
41850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41852         return ret_ref;
41853 }
41854
41855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41856         LDKPeerManager this_obj_conv;
41857         this_obj_conv.inner = untag_ptr(this_obj);
41858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41860         PeerManager_free(this_obj_conv);
41861 }
41862
41863 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 custom_message_handler, int64_t node_signer) {
41864         LDKMessageHandler message_handler_conv;
41865         message_handler_conv.inner = untag_ptr(message_handler);
41866         message_handler_conv.is_owned = ptr_is_owned(message_handler);
41867         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
41868         // WARNING: we need a move here but no clone is available for LDKMessageHandler
41869         
41870         uint8_t ephemeral_random_data_arr[32];
41871         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
41872         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
41873         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
41874         void* logger_ptr = untag_ptr(logger);
41875         CHECK_ACCESS(logger_ptr);
41876         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41877         if (logger_conv.free == LDKLogger_JCalls_free) {
41878                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41879                 LDKLogger_JCalls_cloned(&logger_conv);
41880         }
41881         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
41882         CHECK_ACCESS(custom_message_handler_ptr);
41883         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
41884         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
41885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41886                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
41887         }
41888         void* node_signer_ptr = untag_ptr(node_signer);
41889         CHECK_ACCESS(node_signer_ptr);
41890         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
41891         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
41892                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41893                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
41894         }
41895         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv);
41896         int64_t ret_ref = 0;
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41899         return ret_ref;
41900 }
41901
41902 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
41903         LDKPeerManager this_arg_conv;
41904         this_arg_conv.inner = untag_ptr(this_arg);
41905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41907         this_arg_conv.is_owned = false;
41908         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
41909         int64_tArray ret_arr = NULL;
41910         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41911         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41912         for (size_t o = 0; o < ret_var.datalen; o++) {
41913                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
41914                 *ret_conv_40_conv = ret_var.data[o];
41915                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
41916         }
41917         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41918         FREE(ret_var.data);
41919         return ret_arr;
41920 }
41921
41922 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) {
41923         LDKPeerManager this_arg_conv;
41924         this_arg_conv.inner = untag_ptr(this_arg);
41925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41927         this_arg_conv.is_owned = false;
41928         LDKPublicKey their_node_id_ref;
41929         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
41930         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
41931         void* descriptor_ptr = untag_ptr(descriptor);
41932         CHECK_ACCESS(descriptor_ptr);
41933         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
41934         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
41935                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41936                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
41937         }
41938         void* remote_network_address_ptr = untag_ptr(remote_network_address);
41939         CHECK_ACCESS(remote_network_address_ptr);
41940         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
41941         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
41942         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
41943         return tag_ptr(ret_conv, true);
41944 }
41945
41946 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) {
41947         LDKPeerManager this_arg_conv;
41948         this_arg_conv.inner = untag_ptr(this_arg);
41949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41951         this_arg_conv.is_owned = false;
41952         void* descriptor_ptr = untag_ptr(descriptor);
41953         CHECK_ACCESS(descriptor_ptr);
41954         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
41955         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
41956                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41957                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
41958         }
41959         void* remote_network_address_ptr = untag_ptr(remote_network_address);
41960         CHECK_ACCESS(remote_network_address_ptr);
41961         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
41962         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
41963         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
41964         return tag_ptr(ret_conv, true);
41965 }
41966
41967 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) {
41968         LDKPeerManager this_arg_conv;
41969         this_arg_conv.inner = untag_ptr(this_arg);
41970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41972         this_arg_conv.is_owned = false;
41973         void* descriptor_ptr = untag_ptr(descriptor);
41974         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
41975         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
41976         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
41977         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
41978         return tag_ptr(ret_conv, true);
41979 }
41980
41981 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) {
41982         LDKPeerManager this_arg_conv;
41983         this_arg_conv.inner = untag_ptr(this_arg);
41984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41986         this_arg_conv.is_owned = false;
41987         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
41988         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
41989         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
41990         LDKu8slice data_ref;
41991         data_ref.datalen = (*env)->GetArrayLength(env, data);
41992         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
41993         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
41994         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
41995         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
41996         return tag_ptr(ret_conv, true);
41997 }
41998
41999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
42000         LDKPeerManager this_arg_conv;
42001         this_arg_conv.inner = untag_ptr(this_arg);
42002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42004         this_arg_conv.is_owned = false;
42005         PeerManager_process_events(&this_arg_conv);
42006 }
42007
42008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
42009         LDKPeerManager this_arg_conv;
42010         this_arg_conv.inner = untag_ptr(this_arg);
42011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42013         this_arg_conv.is_owned = false;
42014         void* descriptor_ptr = untag_ptr(descriptor);
42015         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
42016         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
42017         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
42018 }
42019
42020 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) {
42021         LDKPeerManager this_arg_conv;
42022         this_arg_conv.inner = untag_ptr(this_arg);
42023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42025         this_arg_conv.is_owned = false;
42026         LDKPublicKey node_id_ref;
42027         CHECK((*env)->GetArrayLength(env, node_id) == 33);
42028         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
42029         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
42030 }
42031
42032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
42033         LDKPeerManager this_arg_conv;
42034         this_arg_conv.inner = untag_ptr(this_arg);
42035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42037         this_arg_conv.is_owned = false;
42038         PeerManager_disconnect_all_peers(&this_arg_conv);
42039 }
42040
42041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
42042         LDKPeerManager this_arg_conv;
42043         this_arg_conv.inner = untag_ptr(this_arg);
42044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42046         this_arg_conv.is_owned = false;
42047         PeerManager_timer_tick_occurred(&this_arg_conv);
42048 }
42049
42050 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) {
42051         LDKPeerManager this_arg_conv;
42052         this_arg_conv.inner = untag_ptr(this_arg);
42053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42055         this_arg_conv.is_owned = false;
42056         LDKThreeBytes rgb_ref;
42057         CHECK((*env)->GetArrayLength(env, rgb) == 3);
42058         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
42059         LDKThirtyTwoBytes alias_ref;
42060         CHECK((*env)->GetArrayLength(env, alias) == 32);
42061         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
42062         LDKCVec_NetAddressZ addresses_constr;
42063         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
42064         if (addresses_constr.datalen > 0)
42065                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42066         else
42067                 addresses_constr.data = NULL;
42068         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
42069         for (size_t m = 0; m < addresses_constr.datalen; m++) {
42070                 int64_t addresses_conv_12 = addresses_vals[m];
42071                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
42072                 CHECK_ACCESS(addresses_conv_12_ptr);
42073                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
42074                 addresses_constr.data[m] = addresses_conv_12_conv;
42075         }
42076         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
42077         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
42078 }
42079
42080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
42081         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
42082         return ret_conv;
42083 }
42084
42085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
42086         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
42087         return ret_conv;
42088 }
42089
42090 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42091         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
42092         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
42093         return ret_conv;
42094 }
42095
42096 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
42097         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
42098         return ret_conv;
42099 }
42100
42101 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
42102         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
42103         return ret_conv;
42104 }
42105
42106 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
42107         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
42108         return ret_conv;
42109 }
42110
42111 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
42112         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
42113         return ret_conv;
42114 }
42115
42116 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
42117         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
42118         return ret_conv;
42119 }
42120
42121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42122         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
42123         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
42124         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
42125         return ret_conv;
42126 }
42127
42128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
42129         LDKWitness witness_ref;
42130         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
42131         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
42132         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
42133         witness_ref.data_is_owned = true;
42134         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
42135         *ret_copy = HTLCClaim_from_witness(witness_ref);
42136         int64_t ret_ref = tag_ptr(ret_copy, true);
42137         return ret_ref;
42138 }
42139
42140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
42141         uint8_t commitment_seed_arr[32];
42142         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
42143         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
42144         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
42145         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42146         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
42147         return ret_arr;
42148 }
42149
42150 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) {
42151         LDKCVec_u8Z to_holder_script_ref;
42152         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
42153         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
42154         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
42155         LDKCVec_u8Z to_counterparty_script_ref;
42156         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
42157         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
42158         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
42159         LDKOutPoint funding_outpoint_conv;
42160         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
42161         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
42162         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
42163         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
42164         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);
42165         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42166         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42167         Transaction_free(ret_var);
42168         return ret_arr;
42169 }
42170
42171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42172         LDKCounterpartyCommitmentSecrets this_obj_conv;
42173         this_obj_conv.inner = untag_ptr(this_obj);
42174         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42176         CounterpartyCommitmentSecrets_free(this_obj_conv);
42177 }
42178
42179 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
42180         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
42181         int64_t ret_ref = 0;
42182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42184         return ret_ref;
42185 }
42186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42187         LDKCounterpartyCommitmentSecrets arg_conv;
42188         arg_conv.inner = untag_ptr(arg);
42189         arg_conv.is_owned = ptr_is_owned(arg);
42190         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42191         arg_conv.is_owned = false;
42192         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
42193         return ret_conv;
42194 }
42195
42196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42197         LDKCounterpartyCommitmentSecrets orig_conv;
42198         orig_conv.inner = untag_ptr(orig);
42199         orig_conv.is_owned = ptr_is_owned(orig);
42200         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42201         orig_conv.is_owned = false;
42202         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
42203         int64_t ret_ref = 0;
42204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42206         return ret_ref;
42207 }
42208
42209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
42210         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
42211         int64_t ret_ref = 0;
42212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42214         return ret_ref;
42215 }
42216
42217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42218         LDKCounterpartyCommitmentSecrets this_arg_conv;
42219         this_arg_conv.inner = untag_ptr(this_arg);
42220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42222         this_arg_conv.is_owned = false;
42223         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
42224         return ret_conv;
42225 }
42226
42227 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) {
42228         LDKCounterpartyCommitmentSecrets this_arg_conv;
42229         this_arg_conv.inner = untag_ptr(this_arg);
42230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42232         this_arg_conv.is_owned = false;
42233         LDKThirtyTwoBytes secret_ref;
42234         CHECK((*env)->GetArrayLength(env, secret) == 32);
42235         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
42236         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
42237         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
42238         return tag_ptr(ret_conv, true);
42239 }
42240
42241 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
42242         LDKCounterpartyCommitmentSecrets this_arg_conv;
42243         this_arg_conv.inner = untag_ptr(this_arg);
42244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42246         this_arg_conv.is_owned = false;
42247         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42248         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
42249         return ret_arr;
42250 }
42251
42252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
42253         LDKCounterpartyCommitmentSecrets obj_conv;
42254         obj_conv.inner = untag_ptr(obj);
42255         obj_conv.is_owned = ptr_is_owned(obj);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42257         obj_conv.is_owned = false;
42258         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
42259         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42260         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42261         CVec_u8Z_free(ret_var);
42262         return ret_arr;
42263 }
42264
42265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42266         LDKu8slice ser_ref;
42267         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42268         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42269         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
42270         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
42271         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42272         return tag_ptr(ret_conv, true);
42273 }
42274
42275 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) {
42276         LDKPublicKey per_commitment_point_ref;
42277         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
42278         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
42279         uint8_t base_secret_arr[32];
42280         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
42281         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
42282         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
42283         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42284         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
42285         return ret_arr;
42286 }
42287
42288 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) {
42289         LDKPublicKey per_commitment_point_ref;
42290         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
42291         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
42292         LDKPublicKey base_point_ref;
42293         CHECK((*env)->GetArrayLength(env, base_point) == 33);
42294         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
42295         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42296         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form);
42297         return ret_arr;
42298 }
42299
42300 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) {
42301         uint8_t per_commitment_secret_arr[32];
42302         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
42303         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
42304         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
42305         uint8_t countersignatory_revocation_base_secret_arr[32];
42306         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
42307         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
42308         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
42309         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42310         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
42311         return ret_arr;
42312 }
42313
42314 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) {
42315         LDKPublicKey per_commitment_point_ref;
42316         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
42317         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
42318         LDKPublicKey countersignatory_revocation_base_point_ref;
42319         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
42320         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
42321         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42322         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form);
42323         return ret_arr;
42324 }
42325
42326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42327         LDKTxCreationKeys this_obj_conv;
42328         this_obj_conv.inner = untag_ptr(this_obj);
42329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42331         TxCreationKeys_free(this_obj_conv);
42332 }
42333
42334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42335         LDKTxCreationKeys this_ptr_conv;
42336         this_ptr_conv.inner = untag_ptr(this_ptr);
42337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42339         this_ptr_conv.is_owned = false;
42340         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42341         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
42342         return ret_arr;
42343 }
42344
42345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42346         LDKTxCreationKeys this_ptr_conv;
42347         this_ptr_conv.inner = untag_ptr(this_ptr);
42348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42350         this_ptr_conv.is_owned = false;
42351         LDKPublicKey val_ref;
42352         CHECK((*env)->GetArrayLength(env, val) == 33);
42353         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42354         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
42355 }
42356
42357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
42358         LDKTxCreationKeys this_ptr_conv;
42359         this_ptr_conv.inner = untag_ptr(this_ptr);
42360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42362         this_ptr_conv.is_owned = false;
42363         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42364         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
42365         return ret_arr;
42366 }
42367
42368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42369         LDKTxCreationKeys this_ptr_conv;
42370         this_ptr_conv.inner = untag_ptr(this_ptr);
42371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42373         this_ptr_conv.is_owned = false;
42374         LDKPublicKey val_ref;
42375         CHECK((*env)->GetArrayLength(env, val) == 33);
42376         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42377         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
42378 }
42379
42380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
42381         LDKTxCreationKeys this_ptr_conv;
42382         this_ptr_conv.inner = untag_ptr(this_ptr);
42383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42385         this_ptr_conv.is_owned = false;
42386         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42387         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
42388         return ret_arr;
42389 }
42390
42391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42392         LDKTxCreationKeys this_ptr_conv;
42393         this_ptr_conv.inner = untag_ptr(this_ptr);
42394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42396         this_ptr_conv.is_owned = false;
42397         LDKPublicKey val_ref;
42398         CHECK((*env)->GetArrayLength(env, val) == 33);
42399         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42400         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
42401 }
42402
42403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
42404         LDKTxCreationKeys this_ptr_conv;
42405         this_ptr_conv.inner = untag_ptr(this_ptr);
42406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42408         this_ptr_conv.is_owned = false;
42409         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42410         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
42411         return ret_arr;
42412 }
42413
42414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42415         LDKTxCreationKeys this_ptr_conv;
42416         this_ptr_conv.inner = untag_ptr(this_ptr);
42417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42419         this_ptr_conv.is_owned = false;
42420         LDKPublicKey val_ref;
42421         CHECK((*env)->GetArrayLength(env, val) == 33);
42422         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42423         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
42424 }
42425
42426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
42427         LDKTxCreationKeys this_ptr_conv;
42428         this_ptr_conv.inner = untag_ptr(this_ptr);
42429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42431         this_ptr_conv.is_owned = false;
42432         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42433         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
42434         return ret_arr;
42435 }
42436
42437 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) {
42438         LDKTxCreationKeys this_ptr_conv;
42439         this_ptr_conv.inner = untag_ptr(this_ptr);
42440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42442         this_ptr_conv.is_owned = false;
42443         LDKPublicKey val_ref;
42444         CHECK((*env)->GetArrayLength(env, val) == 33);
42445         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42446         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
42447 }
42448
42449 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) {
42450         LDKPublicKey per_commitment_point_arg_ref;
42451         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
42452         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
42453         LDKPublicKey revocation_key_arg_ref;
42454         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
42455         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
42456         LDKPublicKey broadcaster_htlc_key_arg_ref;
42457         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
42458         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
42459         LDKPublicKey countersignatory_htlc_key_arg_ref;
42460         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
42461         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
42462         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
42463         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
42464         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
42465         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);
42466         int64_t ret_ref = 0;
42467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42469         return ret_ref;
42470 }
42471
42472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42473         LDKTxCreationKeys a_conv;
42474         a_conv.inner = untag_ptr(a);
42475         a_conv.is_owned = ptr_is_owned(a);
42476         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42477         a_conv.is_owned = false;
42478         LDKTxCreationKeys b_conv;
42479         b_conv.inner = untag_ptr(b);
42480         b_conv.is_owned = ptr_is_owned(b);
42481         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42482         b_conv.is_owned = false;
42483         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
42484         return ret_conv;
42485 }
42486
42487 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
42488         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
42489         int64_t ret_ref = 0;
42490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42492         return ret_ref;
42493 }
42494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42495         LDKTxCreationKeys arg_conv;
42496         arg_conv.inner = untag_ptr(arg);
42497         arg_conv.is_owned = ptr_is_owned(arg);
42498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42499         arg_conv.is_owned = false;
42500         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
42501         return ret_conv;
42502 }
42503
42504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42505         LDKTxCreationKeys orig_conv;
42506         orig_conv.inner = untag_ptr(orig);
42507         orig_conv.is_owned = ptr_is_owned(orig);
42508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42509         orig_conv.is_owned = false;
42510         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
42511         int64_t ret_ref = 0;
42512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42514         return ret_ref;
42515 }
42516
42517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
42518         LDKTxCreationKeys obj_conv;
42519         obj_conv.inner = untag_ptr(obj);
42520         obj_conv.is_owned = ptr_is_owned(obj);
42521         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42522         obj_conv.is_owned = false;
42523         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
42524         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42525         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42526         CVec_u8Z_free(ret_var);
42527         return ret_arr;
42528 }
42529
42530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42531         LDKu8slice ser_ref;
42532         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42533         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42534         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
42535         *ret_conv = TxCreationKeys_read(ser_ref);
42536         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42537         return tag_ptr(ret_conv, true);
42538 }
42539
42540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42541         LDKChannelPublicKeys this_obj_conv;
42542         this_obj_conv.inner = untag_ptr(this_obj);
42543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42545         ChannelPublicKeys_free(this_obj_conv);
42546 }
42547
42548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42549         LDKChannelPublicKeys this_ptr_conv;
42550         this_ptr_conv.inner = untag_ptr(this_ptr);
42551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42553         this_ptr_conv.is_owned = false;
42554         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42555         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
42556         return ret_arr;
42557 }
42558
42559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42560         LDKChannelPublicKeys this_ptr_conv;
42561         this_ptr_conv.inner = untag_ptr(this_ptr);
42562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42564         this_ptr_conv.is_owned = false;
42565         LDKPublicKey val_ref;
42566         CHECK((*env)->GetArrayLength(env, val) == 33);
42567         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42568         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
42569 }
42570
42571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42572         LDKChannelPublicKeys 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42578         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
42579         return ret_arr;
42580 }
42581
42582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42583         LDKChannelPublicKeys this_ptr_conv;
42584         this_ptr_conv.inner = untag_ptr(this_ptr);
42585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42587         this_ptr_conv.is_owned = false;
42588         LDKPublicKey val_ref;
42589         CHECK((*env)->GetArrayLength(env, val) == 33);
42590         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42591         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
42592 }
42593
42594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42595         LDKChannelPublicKeys this_ptr_conv;
42596         this_ptr_conv.inner = untag_ptr(this_ptr);
42597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42599         this_ptr_conv.is_owned = false;
42600         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42601         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
42602         return ret_arr;
42603 }
42604
42605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42606         LDKChannelPublicKeys this_ptr_conv;
42607         this_ptr_conv.inner = untag_ptr(this_ptr);
42608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42610         this_ptr_conv.is_owned = false;
42611         LDKPublicKey val_ref;
42612         CHECK((*env)->GetArrayLength(env, val) == 33);
42613         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42614         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
42615 }
42616
42617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42618         LDKChannelPublicKeys this_ptr_conv;
42619         this_ptr_conv.inner = untag_ptr(this_ptr);
42620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42622         this_ptr_conv.is_owned = false;
42623         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42624         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
42625         return ret_arr;
42626 }
42627
42628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42629         LDKChannelPublicKeys this_ptr_conv;
42630         this_ptr_conv.inner = untag_ptr(this_ptr);
42631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42633         this_ptr_conv.is_owned = false;
42634         LDKPublicKey val_ref;
42635         CHECK((*env)->GetArrayLength(env, val) == 33);
42636         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42637         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42638 }
42639
42640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
42641         LDKChannelPublicKeys this_ptr_conv;
42642         this_ptr_conv.inner = untag_ptr(this_ptr);
42643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42645         this_ptr_conv.is_owned = false;
42646         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42647         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
42648         return ret_arr;
42649 }
42650
42651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42652         LDKChannelPublicKeys this_ptr_conv;
42653         this_ptr_conv.inner = untag_ptr(this_ptr);
42654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42656         this_ptr_conv.is_owned = false;
42657         LDKPublicKey val_ref;
42658         CHECK((*env)->GetArrayLength(env, val) == 33);
42659         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42660         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
42661 }
42662
42663 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) {
42664         LDKPublicKey funding_pubkey_arg_ref;
42665         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
42666         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
42667         LDKPublicKey revocation_basepoint_arg_ref;
42668         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
42669         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
42670         LDKPublicKey payment_point_arg_ref;
42671         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
42672         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
42673         LDKPublicKey delayed_payment_basepoint_arg_ref;
42674         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
42675         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
42676         LDKPublicKey htlc_basepoint_arg_ref;
42677         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
42678         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
42679         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);
42680         int64_t ret_ref = 0;
42681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42683         return ret_ref;
42684 }
42685
42686 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
42687         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
42688         int64_t ret_ref = 0;
42689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42691         return ret_ref;
42692 }
42693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42694         LDKChannelPublicKeys arg_conv;
42695         arg_conv.inner = untag_ptr(arg);
42696         arg_conv.is_owned = ptr_is_owned(arg);
42697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42698         arg_conv.is_owned = false;
42699         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
42700         return ret_conv;
42701 }
42702
42703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42704         LDKChannelPublicKeys orig_conv;
42705         orig_conv.inner = untag_ptr(orig);
42706         orig_conv.is_owned = ptr_is_owned(orig);
42707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42708         orig_conv.is_owned = false;
42709         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
42710         int64_t ret_ref = 0;
42711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42713         return ret_ref;
42714 }
42715
42716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42717         LDKChannelPublicKeys a_conv;
42718         a_conv.inner = untag_ptr(a);
42719         a_conv.is_owned = ptr_is_owned(a);
42720         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42721         a_conv.is_owned = false;
42722         LDKChannelPublicKeys b_conv;
42723         b_conv.inner = untag_ptr(b);
42724         b_conv.is_owned = ptr_is_owned(b);
42725         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42726         b_conv.is_owned = false;
42727         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
42728         return ret_conv;
42729 }
42730
42731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
42732         LDKChannelPublicKeys obj_conv;
42733         obj_conv.inner = untag_ptr(obj);
42734         obj_conv.is_owned = ptr_is_owned(obj);
42735         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42736         obj_conv.is_owned = false;
42737         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
42738         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42739         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42740         CVec_u8Z_free(ret_var);
42741         return ret_arr;
42742 }
42743
42744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42745         LDKu8slice ser_ref;
42746         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42747         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42748         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
42749         *ret_conv = ChannelPublicKeys_read(ser_ref);
42750         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42751         return tag_ptr(ret_conv, true);
42752 }
42753
42754 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) {
42755         LDKPublicKey per_commitment_point_ref;
42756         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
42757         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
42758         LDKPublicKey broadcaster_delayed_payment_base_ref;
42759         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
42760         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
42761         LDKPublicKey broadcaster_htlc_base_ref;
42762         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
42763         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
42764         LDKPublicKey countersignatory_revocation_base_ref;
42765         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
42766         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
42767         LDKPublicKey countersignatory_htlc_base_ref;
42768         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
42769         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
42770         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);
42771         int64_t ret_ref = 0;
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42774         return ret_ref;
42775 }
42776
42777 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) {
42778         LDKPublicKey per_commitment_point_ref;
42779         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
42780         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
42781         LDKChannelPublicKeys broadcaster_keys_conv;
42782         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
42783         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
42784         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
42785         broadcaster_keys_conv.is_owned = false;
42786         LDKChannelPublicKeys countersignatory_keys_conv;
42787         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
42788         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
42789         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
42790         countersignatory_keys_conv.is_owned = false;
42791         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
42792         int64_t ret_ref = 0;
42793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42795         return ret_ref;
42796 }
42797
42798 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) {
42799         LDKPublicKey revocation_key_ref;
42800         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
42801         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
42802         LDKPublicKey broadcaster_delayed_payment_key_ref;
42803         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
42804         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
42805         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
42806         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42807         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42808         CVec_u8Z_free(ret_var);
42809         return ret_arr;
42810 }
42811
42812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42813         LDKHTLCOutputInCommitment this_obj_conv;
42814         this_obj_conv.inner = untag_ptr(this_obj);
42815         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42817         HTLCOutputInCommitment_free(this_obj_conv);
42818 }
42819
42820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
42821         LDKHTLCOutputInCommitment this_ptr_conv;
42822         this_ptr_conv.inner = untag_ptr(this_ptr);
42823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42825         this_ptr_conv.is_owned = false;
42826         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
42827         return ret_conv;
42828 }
42829
42830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42831         LDKHTLCOutputInCommitment this_ptr_conv;
42832         this_ptr_conv.inner = untag_ptr(this_ptr);
42833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42835         this_ptr_conv.is_owned = false;
42836         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
42837 }
42838
42839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42840         LDKHTLCOutputInCommitment this_ptr_conv;
42841         this_ptr_conv.inner = untag_ptr(this_ptr);
42842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42844         this_ptr_conv.is_owned = false;
42845         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
42846         return ret_conv;
42847 }
42848
42849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42850         LDKHTLCOutputInCommitment this_ptr_conv;
42851         this_ptr_conv.inner = untag_ptr(this_ptr);
42852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42854         this_ptr_conv.is_owned = false;
42855         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
42856 }
42857
42858 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
42859         LDKHTLCOutputInCommitment this_ptr_conv;
42860         this_ptr_conv.inner = untag_ptr(this_ptr);
42861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42863         this_ptr_conv.is_owned = false;
42864         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
42865         return ret_conv;
42866 }
42867
42868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42869         LDKHTLCOutputInCommitment this_ptr_conv;
42870         this_ptr_conv.inner = untag_ptr(this_ptr);
42871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42873         this_ptr_conv.is_owned = false;
42874         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
42875 }
42876
42877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
42878         LDKHTLCOutputInCommitment this_ptr_conv;
42879         this_ptr_conv.inner = untag_ptr(this_ptr);
42880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42882         this_ptr_conv.is_owned = false;
42883         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42884         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
42885         return ret_arr;
42886 }
42887
42888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42889         LDKHTLCOutputInCommitment this_ptr_conv;
42890         this_ptr_conv.inner = untag_ptr(this_ptr);
42891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42893         this_ptr_conv.is_owned = false;
42894         LDKThirtyTwoBytes val_ref;
42895         CHECK((*env)->GetArrayLength(env, val) == 32);
42896         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42897         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
42898 }
42899
42900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
42901         LDKHTLCOutputInCommitment this_ptr_conv;
42902         this_ptr_conv.inner = untag_ptr(this_ptr);
42903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42905         this_ptr_conv.is_owned = false;
42906         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42907         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
42908         int64_t ret_ref = tag_ptr(ret_copy, true);
42909         return ret_ref;
42910 }
42911
42912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42913         LDKHTLCOutputInCommitment this_ptr_conv;
42914         this_ptr_conv.inner = untag_ptr(this_ptr);
42915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42917         this_ptr_conv.is_owned = false;
42918         void* val_ptr = untag_ptr(val);
42919         CHECK_ACCESS(val_ptr);
42920         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
42921         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
42922         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
42923 }
42924
42925 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) {
42926         LDKThirtyTwoBytes payment_hash_arg_ref;
42927         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
42928         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
42929         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
42930         CHECK_ACCESS(transaction_output_index_arg_ptr);
42931         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
42932         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
42933         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
42934         int64_t ret_ref = 0;
42935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42937         return ret_ref;
42938 }
42939
42940 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
42941         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
42942         int64_t ret_ref = 0;
42943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42945         return ret_ref;
42946 }
42947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42948         LDKHTLCOutputInCommitment arg_conv;
42949         arg_conv.inner = untag_ptr(arg);
42950         arg_conv.is_owned = ptr_is_owned(arg);
42951         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42952         arg_conv.is_owned = false;
42953         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
42954         return ret_conv;
42955 }
42956
42957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42958         LDKHTLCOutputInCommitment orig_conv;
42959         orig_conv.inner = untag_ptr(orig);
42960         orig_conv.is_owned = ptr_is_owned(orig);
42961         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42962         orig_conv.is_owned = false;
42963         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
42964         int64_t ret_ref = 0;
42965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42967         return ret_ref;
42968 }
42969
42970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42971         LDKHTLCOutputInCommitment a_conv;
42972         a_conv.inner = untag_ptr(a);
42973         a_conv.is_owned = ptr_is_owned(a);
42974         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42975         a_conv.is_owned = false;
42976         LDKHTLCOutputInCommitment b_conv;
42977         b_conv.inner = untag_ptr(b);
42978         b_conv.is_owned = ptr_is_owned(b);
42979         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42980         b_conv.is_owned = false;
42981         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
42982         return ret_conv;
42983 }
42984
42985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
42986         LDKHTLCOutputInCommitment obj_conv;
42987         obj_conv.inner = untag_ptr(obj);
42988         obj_conv.is_owned = ptr_is_owned(obj);
42989         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42990         obj_conv.is_owned = false;
42991         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
42992         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42993         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42994         CVec_u8Z_free(ret_var);
42995         return ret_arr;
42996 }
42997
42998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42999         LDKu8slice ser_ref;
43000         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43001         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43002         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
43003         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
43004         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43005         return tag_ptr(ret_conv, true);
43006 }
43007
43008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, jboolean opt_anchors, int64_t keys) {
43009         LDKHTLCOutputInCommitment htlc_conv;
43010         htlc_conv.inner = untag_ptr(htlc);
43011         htlc_conv.is_owned = ptr_is_owned(htlc);
43012         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
43013         htlc_conv.is_owned = false;
43014         LDKTxCreationKeys keys_conv;
43015         keys_conv.inner = untag_ptr(keys);
43016         keys_conv.is_owned = ptr_is_owned(keys);
43017         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
43018         keys_conv.is_owned = false;
43019         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
43020         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43021         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43022         CVec_u8Z_free(ret_var);
43023         return ret_arr;
43024 }
43025
43026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
43027         LDKPublicKey broadcaster_ref;
43028         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
43029         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
43030         LDKPublicKey countersignatory_ref;
43031         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
43032         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
43033         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
43034         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43035         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43036         CVec_u8Z_free(ret_var);
43037         return ret_arr;
43038 }
43039
43040 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, jboolean opt_anchors, jboolean use_non_zero_fee_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
43041         uint8_t commitment_txid_arr[32];
43042         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
43043         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
43044         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
43045         LDKHTLCOutputInCommitment htlc_conv;
43046         htlc_conv.inner = untag_ptr(htlc);
43047         htlc_conv.is_owned = ptr_is_owned(htlc);
43048         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
43049         htlc_conv.is_owned = false;
43050         LDKPublicKey broadcaster_delayed_payment_key_ref;
43051         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
43052         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
43053         LDKPublicKey revocation_key_ref;
43054         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
43055         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
43056         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, use_non_zero_fee_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
43057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43059         Transaction_free(ret_var);
43060         return ret_arr;
43061 }
43062
43063 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, int8_tArray preimage, int8_tArray redeem_script, jboolean opt_anchors) {
43064         LDKSignature local_sig_ref;
43065         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
43066         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
43067         LDKSignature remote_sig_ref;
43068         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
43069         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
43070         LDKThirtyTwoBytes preimage_ref;
43071         CHECK((*env)->GetArrayLength(env, preimage) == 32);
43072         (*env)->GetByteArrayRegion(env, preimage, 0, 32, preimage_ref.data);
43073         LDKu8slice redeem_script_ref;
43074         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
43075         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
43076         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
43077         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43078         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43079         Witness_free(ret_var);
43080         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
43081         return ret_arr;
43082 }
43083
43084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
43085         LDKPublicKey payment_point_ref;
43086         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
43087         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
43088         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
43089         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43090         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43091         CVec_u8Z_free(ret_var);
43092         return ret_arr;
43093 }
43094
43095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
43096         LDKPublicKey funding_pubkey_ref;
43097         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
43098         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
43099         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
43100         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43101         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43102         CVec_u8Z_free(ret_var);
43103         return ret_arr;
43104 }
43105
43106 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) {
43107         LDKPublicKey funding_key_ref;
43108         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
43109         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
43110         LDKSignature funding_sig_ref;
43111         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
43112         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
43113         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
43114         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43115         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43116         Witness_free(ret_var);
43117         return ret_arr;
43118 }
43119
43120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43121         LDKChannelTransactionParameters this_obj_conv;
43122         this_obj_conv.inner = untag_ptr(this_obj);
43123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43125         ChannelTransactionParameters_free(this_obj_conv);
43126 }
43127
43128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
43129         LDKChannelTransactionParameters this_ptr_conv;
43130         this_ptr_conv.inner = untag_ptr(this_ptr);
43131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43133         this_ptr_conv.is_owned = false;
43134         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
43135         int64_t ret_ref = 0;
43136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43138         return ret_ref;
43139 }
43140
43141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43142         LDKChannelTransactionParameters this_ptr_conv;
43143         this_ptr_conv.inner = untag_ptr(this_ptr);
43144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43146         this_ptr_conv.is_owned = false;
43147         LDKChannelPublicKeys val_conv;
43148         val_conv.inner = untag_ptr(val);
43149         val_conv.is_owned = ptr_is_owned(val);
43150         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43151         val_conv = ChannelPublicKeys_clone(&val_conv);
43152         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
43153 }
43154
43155 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43156         LDKChannelTransactionParameters this_ptr_conv;
43157         this_ptr_conv.inner = untag_ptr(this_ptr);
43158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43160         this_ptr_conv.is_owned = false;
43161         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
43162         return ret_conv;
43163 }
43164
43165 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) {
43166         LDKChannelTransactionParameters this_ptr_conv;
43167         this_ptr_conv.inner = untag_ptr(this_ptr);
43168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43170         this_ptr_conv.is_owned = false;
43171         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
43172 }
43173
43174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
43175         LDKChannelTransactionParameters this_ptr_conv;
43176         this_ptr_conv.inner = untag_ptr(this_ptr);
43177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43179         this_ptr_conv.is_owned = false;
43180         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
43181         return ret_conv;
43182 }
43183
43184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43185         LDKChannelTransactionParameters this_ptr_conv;
43186         this_ptr_conv.inner = untag_ptr(this_ptr);
43187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43189         this_ptr_conv.is_owned = false;
43190         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
43191 }
43192
43193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
43194         LDKChannelTransactionParameters this_ptr_conv;
43195         this_ptr_conv.inner = untag_ptr(this_ptr);
43196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43198         this_ptr_conv.is_owned = false;
43199         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
43200         int64_t ret_ref = 0;
43201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43203         return ret_ref;
43204 }
43205
43206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43207         LDKChannelTransactionParameters this_ptr_conv;
43208         this_ptr_conv.inner = untag_ptr(this_ptr);
43209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43211         this_ptr_conv.is_owned = false;
43212         LDKCounterpartyChannelTransactionParameters val_conv;
43213         val_conv.inner = untag_ptr(val);
43214         val_conv.is_owned = ptr_is_owned(val);
43215         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43216         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
43217         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
43218 }
43219
43220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43221         LDKChannelTransactionParameters this_ptr_conv;
43222         this_ptr_conv.inner = untag_ptr(this_ptr);
43223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43225         this_ptr_conv.is_owned = false;
43226         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
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 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43234         LDKChannelTransactionParameters this_ptr_conv;
43235         this_ptr_conv.inner = untag_ptr(this_ptr);
43236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43238         this_ptr_conv.is_owned = false;
43239         LDKOutPoint val_conv;
43240         val_conv.inner = untag_ptr(val);
43241         val_conv.is_owned = ptr_is_owned(val);
43242         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43243         val_conv = OutPoint_clone(&val_conv);
43244         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
43245 }
43246
43247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
43248         LDKChannelTransactionParameters this_ptr_conv;
43249         this_ptr_conv.inner = untag_ptr(this_ptr);
43250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43252         this_ptr_conv.is_owned = false;
43253         jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
43254         return ret_conv;
43255 }
43256
43257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
43258         LDKChannelTransactionParameters this_ptr_conv;
43259         this_ptr_conv.inner = untag_ptr(this_ptr);
43260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43262         this_ptr_conv.is_owned = false;
43263         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
43264         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
43265 }
43266
43267 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1non_1zero_1fee_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
43268         LDKChannelTransactionParameters this_ptr_conv;
43269         this_ptr_conv.inner = untag_ptr(this_ptr);
43270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43272         this_ptr_conv.is_owned = false;
43273         jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
43274         return ret_conv;
43275 }
43276
43277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1non_1zero_1fee_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
43278         LDKChannelTransactionParameters this_ptr_conv;
43279         this_ptr_conv.inner = untag_ptr(this_ptr);
43280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43282         this_ptr_conv.is_owned = false;
43283         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
43284         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
43285 }
43286
43287 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, jclass opt_anchors_arg, jclass opt_non_zero_fee_anchors_arg) {
43288         LDKChannelPublicKeys holder_pubkeys_arg_conv;
43289         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
43290         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
43291         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
43292         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
43293         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
43294         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
43295         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
43296         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
43297         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
43298         LDKOutPoint funding_outpoint_arg_conv;
43299         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
43300         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
43301         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
43302         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
43303         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
43304         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_non_zero_fee_anchors_arg);
43305         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, opt_anchors_arg_conv, opt_non_zero_fee_anchors_arg_conv);
43306         int64_t ret_ref = 0;
43307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43309         return ret_ref;
43310 }
43311
43312 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
43313         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
43314         int64_t ret_ref = 0;
43315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43317         return ret_ref;
43318 }
43319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43320         LDKChannelTransactionParameters arg_conv;
43321         arg_conv.inner = untag_ptr(arg);
43322         arg_conv.is_owned = ptr_is_owned(arg);
43323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43324         arg_conv.is_owned = false;
43325         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
43326         return ret_conv;
43327 }
43328
43329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43330         LDKChannelTransactionParameters orig_conv;
43331         orig_conv.inner = untag_ptr(orig);
43332         orig_conv.is_owned = ptr_is_owned(orig);
43333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43334         orig_conv.is_owned = false;
43335         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
43336         int64_t ret_ref = 0;
43337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43339         return ret_ref;
43340 }
43341
43342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43343         LDKCounterpartyChannelTransactionParameters this_obj_conv;
43344         this_obj_conv.inner = untag_ptr(this_obj);
43345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43347         CounterpartyChannelTransactionParameters_free(this_obj_conv);
43348 }
43349
43350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
43351         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
43352         this_ptr_conv.inner = untag_ptr(this_ptr);
43353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43355         this_ptr_conv.is_owned = false;
43356         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
43357         int64_t ret_ref = 0;
43358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43360         return ret_ref;
43361 }
43362
43363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43364         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
43365         this_ptr_conv.inner = untag_ptr(this_ptr);
43366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43368         this_ptr_conv.is_owned = false;
43369         LDKChannelPublicKeys val_conv;
43370         val_conv.inner = untag_ptr(val);
43371         val_conv.is_owned = ptr_is_owned(val);
43372         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43373         val_conv = ChannelPublicKeys_clone(&val_conv);
43374         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
43375 }
43376
43377 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43378         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
43379         this_ptr_conv.inner = untag_ptr(this_ptr);
43380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43382         this_ptr_conv.is_owned = false;
43383         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
43384         return ret_conv;
43385 }
43386
43387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43388         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
43389         this_ptr_conv.inner = untag_ptr(this_ptr);
43390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43392         this_ptr_conv.is_owned = false;
43393         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
43394 }
43395
43396 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) {
43397         LDKChannelPublicKeys pubkeys_arg_conv;
43398         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
43399         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
43401         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
43402         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
43403         int64_t ret_ref = 0;
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43406         return ret_ref;
43407 }
43408
43409 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
43410         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43417         LDKCounterpartyChannelTransactionParameters arg_conv;
43418         arg_conv.inner = untag_ptr(arg);
43419         arg_conv.is_owned = ptr_is_owned(arg);
43420         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43421         arg_conv.is_owned = false;
43422         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
43423         return ret_conv;
43424 }
43425
43426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43427         LDKCounterpartyChannelTransactionParameters orig_conv;
43428         orig_conv.inner = untag_ptr(orig);
43429         orig_conv.is_owned = ptr_is_owned(orig);
43430         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43431         orig_conv.is_owned = false;
43432         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
43433         int64_t ret_ref = 0;
43434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43436         return ret_ref;
43437 }
43438
43439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
43440         LDKChannelTransactionParameters this_arg_conv;
43441         this_arg_conv.inner = untag_ptr(this_arg);
43442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43444         this_arg_conv.is_owned = false;
43445         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
43446         return ret_conv;
43447 }
43448
43449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
43450         LDKChannelTransactionParameters this_arg_conv;
43451         this_arg_conv.inner = untag_ptr(this_arg);
43452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43454         this_arg_conv.is_owned = false;
43455         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
43456         int64_t ret_ref = 0;
43457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43459         return ret_ref;
43460 }
43461
43462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
43463         LDKChannelTransactionParameters this_arg_conv;
43464         this_arg_conv.inner = untag_ptr(this_arg);
43465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43467         this_arg_conv.is_owned = false;
43468         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
43469         int64_t ret_ref = 0;
43470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43472         return ret_ref;
43473 }
43474
43475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
43476         LDKCounterpartyChannelTransactionParameters obj_conv;
43477         obj_conv.inner = untag_ptr(obj);
43478         obj_conv.is_owned = ptr_is_owned(obj);
43479         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43480         obj_conv.is_owned = false;
43481         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
43482         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43483         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43484         CVec_u8Z_free(ret_var);
43485         return ret_arr;
43486 }
43487
43488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43489         LDKu8slice ser_ref;
43490         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43491         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43492         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
43493         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
43494         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43495         return tag_ptr(ret_conv, true);
43496 }
43497
43498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
43499         LDKChannelTransactionParameters obj_conv;
43500         obj_conv.inner = untag_ptr(obj);
43501         obj_conv.is_owned = ptr_is_owned(obj);
43502         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43503         obj_conv.is_owned = false;
43504         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
43505         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43506         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43507         CVec_u8Z_free(ret_var);
43508         return ret_arr;
43509 }
43510
43511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43512         LDKu8slice ser_ref;
43513         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43514         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43515         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
43516         *ret_conv = ChannelTransactionParameters_read(ser_ref);
43517         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43518         return tag_ptr(ret_conv, true);
43519 }
43520
43521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43522         LDKDirectedChannelTransactionParameters this_obj_conv;
43523         this_obj_conv.inner = untag_ptr(this_obj);
43524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43526         DirectedChannelTransactionParameters_free(this_obj_conv);
43527 }
43528
43529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
43530         LDKDirectedChannelTransactionParameters this_arg_conv;
43531         this_arg_conv.inner = untag_ptr(this_arg);
43532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43534         this_arg_conv.is_owned = false;
43535         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
43536         int64_t ret_ref = 0;
43537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43539         return ret_ref;
43540 }
43541
43542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
43543         LDKDirectedChannelTransactionParameters this_arg_conv;
43544         this_arg_conv.inner = untag_ptr(this_arg);
43545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43547         this_arg_conv.is_owned = false;
43548         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
43549         int64_t ret_ref = 0;
43550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43552         return ret_ref;
43553 }
43554
43555 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
43556         LDKDirectedChannelTransactionParameters this_arg_conv;
43557         this_arg_conv.inner = untag_ptr(this_arg);
43558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43560         this_arg_conv.is_owned = false;
43561         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
43562         return ret_conv;
43563 }
43564
43565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
43566         LDKDirectedChannelTransactionParameters this_arg_conv;
43567         this_arg_conv.inner = untag_ptr(this_arg);
43568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43570         this_arg_conv.is_owned = false;
43571         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
43572         return ret_conv;
43573 }
43574
43575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
43576         LDKDirectedChannelTransactionParameters this_arg_conv;
43577         this_arg_conv.inner = untag_ptr(this_arg);
43578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43580         this_arg_conv.is_owned = false;
43581         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
43582         int64_t ret_ref = 0;
43583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43585         return ret_ref;
43586 }
43587
43588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
43589         LDKDirectedChannelTransactionParameters this_arg_conv;
43590         this_arg_conv.inner = untag_ptr(this_arg);
43591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43593         this_arg_conv.is_owned = false;
43594         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
43595         return ret_conv;
43596 }
43597
43598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43599         LDKHolderCommitmentTransaction this_obj_conv;
43600         this_obj_conv.inner = untag_ptr(this_obj);
43601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43603         HolderCommitmentTransaction_free(this_obj_conv);
43604 }
43605
43606 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
43607         LDKHolderCommitmentTransaction this_ptr_conv;
43608         this_ptr_conv.inner = untag_ptr(this_ptr);
43609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43611         this_ptr_conv.is_owned = false;
43612         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
43613         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
43614         return ret_arr;
43615 }
43616
43617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43618         LDKHolderCommitmentTransaction this_ptr_conv;
43619         this_ptr_conv.inner = untag_ptr(this_ptr);
43620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43622         this_ptr_conv.is_owned = false;
43623         LDKSignature val_ref;
43624         CHECK((*env)->GetArrayLength(env, val) == 64);
43625         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
43626         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
43627 }
43628
43629 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43630         LDKHolderCommitmentTransaction this_ptr_conv;
43631         this_ptr_conv.inner = untag_ptr(this_ptr);
43632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43634         this_ptr_conv.is_owned = false;
43635         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
43636         jobjectArray ret_arr = NULL;
43637         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
43638         ;
43639         for (size_t i = 0; i < ret_var.datalen; i++) {
43640                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
43641                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
43642                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
43643         }
43644         
43645         FREE(ret_var.data);
43646         return ret_arr;
43647 }
43648
43649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
43650         LDKHolderCommitmentTransaction this_ptr_conv;
43651         this_ptr_conv.inner = untag_ptr(this_ptr);
43652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43654         this_ptr_conv.is_owned = false;
43655         LDKCVec_SignatureZ val_constr;
43656         val_constr.datalen = (*env)->GetArrayLength(env, val);
43657         if (val_constr.datalen > 0)
43658                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
43659         else
43660                 val_constr.data = NULL;
43661         for (size_t i = 0; i < val_constr.datalen; i++) {
43662                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
43663                 LDKSignature val_conv_8_ref;
43664                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
43665                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
43666                 val_constr.data[i] = val_conv_8_ref;
43667         }
43668         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
43669 }
43670
43671 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
43672         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
43673         int64_t ret_ref = 0;
43674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43676         return ret_ref;
43677 }
43678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43679         LDKHolderCommitmentTransaction arg_conv;
43680         arg_conv.inner = untag_ptr(arg);
43681         arg_conv.is_owned = ptr_is_owned(arg);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43683         arg_conv.is_owned = false;
43684         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
43685         return ret_conv;
43686 }
43687
43688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43689         LDKHolderCommitmentTransaction orig_conv;
43690         orig_conv.inner = untag_ptr(orig);
43691         orig_conv.is_owned = ptr_is_owned(orig);
43692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43693         orig_conv.is_owned = false;
43694         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
43695         int64_t ret_ref = 0;
43696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43698         return ret_ref;
43699 }
43700
43701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
43702         LDKHolderCommitmentTransaction obj_conv;
43703         obj_conv.inner = untag_ptr(obj);
43704         obj_conv.is_owned = ptr_is_owned(obj);
43705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43706         obj_conv.is_owned = false;
43707         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
43708         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43709         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43710         CVec_u8Z_free(ret_var);
43711         return ret_arr;
43712 }
43713
43714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43715         LDKu8slice ser_ref;
43716         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43717         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43718         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
43719         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
43720         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43721         return tag_ptr(ret_conv, true);
43722 }
43723
43724 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) {
43725         LDKCommitmentTransaction commitment_tx_conv;
43726         commitment_tx_conv.inner = untag_ptr(commitment_tx);
43727         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
43728         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
43729         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
43730         LDKSignature counterparty_sig_ref;
43731         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
43732         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
43733         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
43734         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
43735         if (counterparty_htlc_sigs_constr.datalen > 0)
43736                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
43737         else
43738                 counterparty_htlc_sigs_constr.data = NULL;
43739         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
43740                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
43741                 LDKSignature counterparty_htlc_sigs_conv_8_ref;
43742                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
43743                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
43744                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
43745         }
43746         LDKPublicKey holder_funding_key_ref;
43747         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
43748         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
43749         LDKPublicKey counterparty_funding_key_ref;
43750         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
43751         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
43752         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
43753         int64_t ret_ref = 0;
43754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43756         return ret_ref;
43757 }
43758
43759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43760         LDKBuiltCommitmentTransaction this_obj_conv;
43761         this_obj_conv.inner = untag_ptr(this_obj);
43762         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43764         BuiltCommitmentTransaction_free(this_obj_conv);
43765 }
43766
43767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
43768         LDKBuiltCommitmentTransaction this_ptr_conv;
43769         this_ptr_conv.inner = untag_ptr(this_ptr);
43770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43772         this_ptr_conv.is_owned = false;
43773         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
43774         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43775         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43776         Transaction_free(ret_var);
43777         return ret_arr;
43778 }
43779
43780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43781         LDKBuiltCommitmentTransaction this_ptr_conv;
43782         this_ptr_conv.inner = untag_ptr(this_ptr);
43783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43785         this_ptr_conv.is_owned = false;
43786         LDKTransaction val_ref;
43787         val_ref.datalen = (*env)->GetArrayLength(env, val);
43788         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
43789         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
43790         val_ref.data_is_owned = true;
43791         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
43792 }
43793
43794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
43795         LDKBuiltCommitmentTransaction this_ptr_conv;
43796         this_ptr_conv.inner = untag_ptr(this_ptr);
43797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43799         this_ptr_conv.is_owned = false;
43800         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43801         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
43802         return ret_arr;
43803 }
43804
43805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43806         LDKBuiltCommitmentTransaction this_ptr_conv;
43807         this_ptr_conv.inner = untag_ptr(this_ptr);
43808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43810         this_ptr_conv.is_owned = false;
43811         LDKThirtyTwoBytes val_ref;
43812         CHECK((*env)->GetArrayLength(env, val) == 32);
43813         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43814         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
43815 }
43816
43817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
43818         LDKTransaction transaction_arg_ref;
43819         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
43820         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
43821         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
43822         transaction_arg_ref.data_is_owned = true;
43823         LDKThirtyTwoBytes txid_arg_ref;
43824         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
43825         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
43826         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
43827         int64_t ret_ref = 0;
43828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43830         return ret_ref;
43831 }
43832
43833 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
43834         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
43835         int64_t ret_ref = 0;
43836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43838         return ret_ref;
43839 }
43840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43841         LDKBuiltCommitmentTransaction arg_conv;
43842         arg_conv.inner = untag_ptr(arg);
43843         arg_conv.is_owned = ptr_is_owned(arg);
43844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43845         arg_conv.is_owned = false;
43846         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
43847         return ret_conv;
43848 }
43849
43850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43851         LDKBuiltCommitmentTransaction orig_conv;
43852         orig_conv.inner = untag_ptr(orig);
43853         orig_conv.is_owned = ptr_is_owned(orig);
43854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43855         orig_conv.is_owned = false;
43856         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
43857         int64_t ret_ref = 0;
43858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43860         return ret_ref;
43861 }
43862
43863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
43864         LDKBuiltCommitmentTransaction obj_conv;
43865         obj_conv.inner = untag_ptr(obj);
43866         obj_conv.is_owned = ptr_is_owned(obj);
43867         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43868         obj_conv.is_owned = false;
43869         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
43870         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43871         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43872         CVec_u8Z_free(ret_var);
43873         return ret_arr;
43874 }
43875
43876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43877         LDKu8slice ser_ref;
43878         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43879         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43880         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
43881         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
43882         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43883         return tag_ptr(ret_conv, true);
43884 }
43885
43886 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) {
43887         LDKBuiltCommitmentTransaction this_arg_conv;
43888         this_arg_conv.inner = untag_ptr(this_arg);
43889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43891         this_arg_conv.is_owned = false;
43892         LDKu8slice funding_redeemscript_ref;
43893         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
43894         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
43895         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43896         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
43897         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
43898         return ret_arr;
43899 }
43900
43901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
43902         LDKBuiltCommitmentTransaction this_arg_conv;
43903         this_arg_conv.inner = untag_ptr(this_arg);
43904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43906         this_arg_conv.is_owned = false;
43907         uint8_t funding_key_arr[32];
43908         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
43909         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
43910         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
43911         LDKu8slice funding_redeemscript_ref;
43912         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
43913         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
43914         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
43915         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
43916         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
43917         return ret_arr;
43918 }
43919
43920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43921         LDKClosingTransaction this_obj_conv;
43922         this_obj_conv.inner = untag_ptr(this_obj);
43923         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43925         ClosingTransaction_free(this_obj_conv);
43926 }
43927
43928 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
43929         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
43930         int64_t ret_ref = 0;
43931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43933         return ret_ref;
43934 }
43935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43936         LDKClosingTransaction arg_conv;
43937         arg_conv.inner = untag_ptr(arg);
43938         arg_conv.is_owned = ptr_is_owned(arg);
43939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43940         arg_conv.is_owned = false;
43941         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
43942         return ret_conv;
43943 }
43944
43945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43946         LDKClosingTransaction orig_conv;
43947         orig_conv.inner = untag_ptr(orig);
43948         orig_conv.is_owned = ptr_is_owned(orig);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43950         orig_conv.is_owned = false;
43951         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
43952         int64_t ret_ref = 0;
43953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43955         return ret_ref;
43956 }
43957
43958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
43959         LDKClosingTransaction o_conv;
43960         o_conv.inner = untag_ptr(o);
43961         o_conv.is_owned = ptr_is_owned(o);
43962         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43963         o_conv.is_owned = false;
43964         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
43965         return ret_conv;
43966 }
43967
43968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43969         LDKClosingTransaction a_conv;
43970         a_conv.inner = untag_ptr(a);
43971         a_conv.is_owned = ptr_is_owned(a);
43972         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43973         a_conv.is_owned = false;
43974         LDKClosingTransaction b_conv;
43975         b_conv.inner = untag_ptr(b);
43976         b_conv.is_owned = ptr_is_owned(b);
43977         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43978         b_conv.is_owned = false;
43979         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
43980         return ret_conv;
43981 }
43982
43983 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) {
43984         LDKCVec_u8Z to_holder_script_ref;
43985         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
43986         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
43987         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
43988         LDKCVec_u8Z to_counterparty_script_ref;
43989         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
43990         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
43991         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
43992         LDKOutPoint funding_outpoint_conv;
43993         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
43994         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
43995         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
43996         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
43997         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
43998         int64_t ret_ref = 0;
43999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44001         return ret_ref;
44002 }
44003
44004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
44005         LDKClosingTransaction this_arg_conv;
44006         this_arg_conv.inner = untag_ptr(this_arg);
44007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44009         this_arg_conv.is_owned = false;
44010         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
44011         int64_t ret_ref = 0;
44012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44014         return ret_ref;
44015 }
44016
44017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
44018         LDKClosingTransaction this_arg_conv;
44019         this_arg_conv.inner = untag_ptr(this_arg);
44020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44022         this_arg_conv.is_owned = false;
44023         LDKOutPoint funding_outpoint_conv;
44024         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
44025         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
44026         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
44027         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
44028         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
44029         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
44030         return tag_ptr(ret_conv, true);
44031 }
44032
44033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
44034         LDKClosingTransaction this_arg_conv;
44035         this_arg_conv.inner = untag_ptr(this_arg);
44036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44038         this_arg_conv.is_owned = false;
44039         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
44040         return ret_conv;
44041 }
44042
44043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
44044         LDKClosingTransaction this_arg_conv;
44045         this_arg_conv.inner = untag_ptr(this_arg);
44046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44048         this_arg_conv.is_owned = false;
44049         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
44050         return ret_conv;
44051 }
44052
44053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
44054         LDKClosingTransaction this_arg_conv;
44055         this_arg_conv.inner = untag_ptr(this_arg);
44056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44058         this_arg_conv.is_owned = false;
44059         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
44060         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44061         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44062         return ret_arr;
44063 }
44064
44065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
44066         LDKClosingTransaction this_arg_conv;
44067         this_arg_conv.inner = untag_ptr(this_arg);
44068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44070         this_arg_conv.is_owned = false;
44071         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
44072         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44073         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44074         return ret_arr;
44075 }
44076
44077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44078         LDKTrustedClosingTransaction this_obj_conv;
44079         this_obj_conv.inner = untag_ptr(this_obj);
44080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44082         TrustedClosingTransaction_free(this_obj_conv);
44083 }
44084
44085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
44086         LDKTrustedClosingTransaction this_arg_conv;
44087         this_arg_conv.inner = untag_ptr(this_arg);
44088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44090         this_arg_conv.is_owned = false;
44091         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
44092         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44093         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44094         Transaction_free(ret_var);
44095         return ret_arr;
44096 }
44097
44098 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) {
44099         LDKTrustedClosingTransaction this_arg_conv;
44100         this_arg_conv.inner = untag_ptr(this_arg);
44101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44103         this_arg_conv.is_owned = false;
44104         LDKu8slice funding_redeemscript_ref;
44105         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
44106         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
44107         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44108         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
44109         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
44110         return ret_arr;
44111 }
44112
44113 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) {
44114         LDKTrustedClosingTransaction this_arg_conv;
44115         this_arg_conv.inner = untag_ptr(this_arg);
44116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44118         this_arg_conv.is_owned = false;
44119         uint8_t funding_key_arr[32];
44120         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
44121         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
44122         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
44123         LDKu8slice funding_redeemscript_ref;
44124         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
44125         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
44126         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44127         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
44128         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
44129         return ret_arr;
44130 }
44131
44132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44133         LDKCommitmentTransaction this_obj_conv;
44134         this_obj_conv.inner = untag_ptr(this_obj);
44135         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44137         CommitmentTransaction_free(this_obj_conv);
44138 }
44139
44140 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
44141         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
44142         int64_t ret_ref = 0;
44143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44145         return ret_ref;
44146 }
44147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44148         LDKCommitmentTransaction arg_conv;
44149         arg_conv.inner = untag_ptr(arg);
44150         arg_conv.is_owned = ptr_is_owned(arg);
44151         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44152         arg_conv.is_owned = false;
44153         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
44154         return ret_conv;
44155 }
44156
44157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44158         LDKCommitmentTransaction orig_conv;
44159         orig_conv.inner = untag_ptr(orig);
44160         orig_conv.is_owned = ptr_is_owned(orig);
44161         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44162         orig_conv.is_owned = false;
44163         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
44164         int64_t ret_ref = 0;
44165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44167         return ret_ref;
44168 }
44169
44170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
44171         LDKCommitmentTransaction obj_conv;
44172         obj_conv.inner = untag_ptr(obj);
44173         obj_conv.is_owned = ptr_is_owned(obj);
44174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44175         obj_conv.is_owned = false;
44176         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
44177         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44178         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44179         CVec_u8Z_free(ret_var);
44180         return ret_arr;
44181 }
44182
44183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44184         LDKu8slice ser_ref;
44185         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44186         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44187         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
44188         *ret_conv = CommitmentTransaction_read(ser_ref);
44189         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44190         return tag_ptr(ret_conv, true);
44191 }
44192
44193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
44194         LDKCommitmentTransaction this_arg_conv;
44195         this_arg_conv.inner = untag_ptr(this_arg);
44196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44198         this_arg_conv.is_owned = false;
44199         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
44200         return ret_conv;
44201 }
44202
44203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
44204         LDKCommitmentTransaction this_arg_conv;
44205         this_arg_conv.inner = untag_ptr(this_arg);
44206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44208         this_arg_conv.is_owned = false;
44209         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
44210         return ret_conv;
44211 }
44212
44213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
44214         LDKCommitmentTransaction this_arg_conv;
44215         this_arg_conv.inner = untag_ptr(this_arg);
44216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44218         this_arg_conv.is_owned = false;
44219         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
44220         return ret_conv;
44221 }
44222
44223 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
44224         LDKCommitmentTransaction this_arg_conv;
44225         this_arg_conv.inner = untag_ptr(this_arg);
44226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44228         this_arg_conv.is_owned = false;
44229         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
44230         return ret_conv;
44231 }
44232
44233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
44234         LDKCommitmentTransaction this_arg_conv;
44235         this_arg_conv.inner = untag_ptr(this_arg);
44236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44238         this_arg_conv.is_owned = false;
44239         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
44240         int64_t ret_ref = 0;
44241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44243         return ret_ref;
44244 }
44245
44246 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) {
44247         LDKCommitmentTransaction this_arg_conv;
44248         this_arg_conv.inner = untag_ptr(this_arg);
44249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44251         this_arg_conv.is_owned = false;
44252         LDKDirectedChannelTransactionParameters channel_parameters_conv;
44253         channel_parameters_conv.inner = untag_ptr(channel_parameters);
44254         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
44255         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
44256         channel_parameters_conv.is_owned = false;
44257         LDKChannelPublicKeys broadcaster_keys_conv;
44258         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
44259         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
44260         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
44261         broadcaster_keys_conv.is_owned = false;
44262         LDKChannelPublicKeys countersignatory_keys_conv;
44263         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
44264         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
44266         countersignatory_keys_conv.is_owned = false;
44267         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
44268         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
44269         return tag_ptr(ret_conv, true);
44270 }
44271
44272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44273         LDKTrustedCommitmentTransaction this_obj_conv;
44274         this_obj_conv.inner = untag_ptr(this_obj);
44275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44277         TrustedCommitmentTransaction_free(this_obj_conv);
44278 }
44279
44280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
44281         LDKTrustedCommitmentTransaction this_arg_conv;
44282         this_arg_conv.inner = untag_ptr(this_arg);
44283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44285         this_arg_conv.is_owned = false;
44286         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44287         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
44288         return ret_arr;
44289 }
44290
44291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
44292         LDKTrustedCommitmentTransaction this_arg_conv;
44293         this_arg_conv.inner = untag_ptr(this_arg);
44294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44296         this_arg_conv.is_owned = false;
44297         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
44298         int64_t ret_ref = 0;
44299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44301         return ret_ref;
44302 }
44303
44304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
44305         LDKTrustedCommitmentTransaction this_arg_conv;
44306         this_arg_conv.inner = untag_ptr(this_arg);
44307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44309         this_arg_conv.is_owned = false;
44310         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
44311         int64_t ret_ref = 0;
44312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44314         return ret_ref;
44315 }
44316
44317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
44318         LDKTrustedCommitmentTransaction this_arg_conv;
44319         this_arg_conv.inner = untag_ptr(this_arg);
44320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44322         this_arg_conv.is_owned = false;
44323         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
44324         return ret_conv;
44325 }
44326
44327 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) {
44328         LDKTrustedCommitmentTransaction this_arg_conv;
44329         this_arg_conv.inner = untag_ptr(this_arg);
44330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44332         this_arg_conv.is_owned = false;
44333         uint8_t htlc_base_key_arr[32];
44334         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
44335         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
44336         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
44337         LDKDirectedChannelTransactionParameters channel_parameters_conv;
44338         channel_parameters_conv.inner = untag_ptr(channel_parameters);
44339         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
44340         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
44341         channel_parameters_conv.is_owned = false;
44342         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
44343         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
44344         return tag_ptr(ret_conv, true);
44345 }
44346
44347 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) {
44348         LDKPublicKey broadcaster_payment_basepoint_ref;
44349         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
44350         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
44351         LDKPublicKey countersignatory_payment_basepoint_ref;
44352         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
44353         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
44354         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
44355         return ret_conv;
44356 }
44357
44358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44359         LDKInitFeatures a_conv;
44360         a_conv.inner = untag_ptr(a);
44361         a_conv.is_owned = ptr_is_owned(a);
44362         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44363         a_conv.is_owned = false;
44364         LDKInitFeatures b_conv;
44365         b_conv.inner = untag_ptr(b);
44366         b_conv.is_owned = ptr_is_owned(b);
44367         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44368         b_conv.is_owned = false;
44369         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
44370         return ret_conv;
44371 }
44372
44373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44374         LDKNodeFeatures a_conv;
44375         a_conv.inner = untag_ptr(a);
44376         a_conv.is_owned = ptr_is_owned(a);
44377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44378         a_conv.is_owned = false;
44379         LDKNodeFeatures b_conv;
44380         b_conv.inner = untag_ptr(b);
44381         b_conv.is_owned = ptr_is_owned(b);
44382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44383         b_conv.is_owned = false;
44384         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
44385         return ret_conv;
44386 }
44387
44388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44389         LDKChannelFeatures a_conv;
44390         a_conv.inner = untag_ptr(a);
44391         a_conv.is_owned = ptr_is_owned(a);
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44393         a_conv.is_owned = false;
44394         LDKChannelFeatures b_conv;
44395         b_conv.inner = untag_ptr(b);
44396         b_conv.is_owned = ptr_is_owned(b);
44397         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44398         b_conv.is_owned = false;
44399         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
44400         return ret_conv;
44401 }
44402
44403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44404         LDKInvoiceFeatures a_conv;
44405         a_conv.inner = untag_ptr(a);
44406         a_conv.is_owned = ptr_is_owned(a);
44407         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44408         a_conv.is_owned = false;
44409         LDKInvoiceFeatures b_conv;
44410         b_conv.inner = untag_ptr(b);
44411         b_conv.is_owned = ptr_is_owned(b);
44412         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44413         b_conv.is_owned = false;
44414         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
44415         return ret_conv;
44416 }
44417
44418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44419         LDKOfferFeatures 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         LDKOfferFeatures 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 = OfferFeatures_eq(&a_conv, &b_conv);
44430         return ret_conv;
44431 }
44432
44433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44434         LDKInvoiceRequestFeatures a_conv;
44435         a_conv.inner = untag_ptr(a);
44436         a_conv.is_owned = ptr_is_owned(a);
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44438         a_conv.is_owned = false;
44439         LDKInvoiceRequestFeatures b_conv;
44440         b_conv.inner = untag_ptr(b);
44441         b_conv.is_owned = ptr_is_owned(b);
44442         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44443         b_conv.is_owned = false;
44444         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
44445         return ret_conv;
44446 }
44447
44448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44449         LDKBolt12InvoiceFeatures a_conv;
44450         a_conv.inner = untag_ptr(a);
44451         a_conv.is_owned = ptr_is_owned(a);
44452         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44453         a_conv.is_owned = false;
44454         LDKBolt12InvoiceFeatures b_conv;
44455         b_conv.inner = untag_ptr(b);
44456         b_conv.is_owned = ptr_is_owned(b);
44457         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44458         b_conv.is_owned = false;
44459         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
44460         return ret_conv;
44461 }
44462
44463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44464         LDKBlindedHopFeatures a_conv;
44465         a_conv.inner = untag_ptr(a);
44466         a_conv.is_owned = ptr_is_owned(a);
44467         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44468         a_conv.is_owned = false;
44469         LDKBlindedHopFeatures b_conv;
44470         b_conv.inner = untag_ptr(b);
44471         b_conv.is_owned = ptr_is_owned(b);
44472         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44473         b_conv.is_owned = false;
44474         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
44475         return ret_conv;
44476 }
44477
44478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44479         LDKChannelTypeFeatures a_conv;
44480         a_conv.inner = untag_ptr(a);
44481         a_conv.is_owned = ptr_is_owned(a);
44482         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44483         a_conv.is_owned = false;
44484         LDKChannelTypeFeatures b_conv;
44485         b_conv.inner = untag_ptr(b);
44486         b_conv.is_owned = ptr_is_owned(b);
44487         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44488         b_conv.is_owned = false;
44489         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
44490         return ret_conv;
44491 }
44492
44493 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
44494         LDKInitFeatures ret_var = InitFeatures_clone(arg);
44495         int64_t ret_ref = 0;
44496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44498         return ret_ref;
44499 }
44500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44501         LDKInitFeatures arg_conv;
44502         arg_conv.inner = untag_ptr(arg);
44503         arg_conv.is_owned = ptr_is_owned(arg);
44504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44505         arg_conv.is_owned = false;
44506         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
44507         return ret_conv;
44508 }
44509
44510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44511         LDKInitFeatures orig_conv;
44512         orig_conv.inner = untag_ptr(orig);
44513         orig_conv.is_owned = ptr_is_owned(orig);
44514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44515         orig_conv.is_owned = false;
44516         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
44517         int64_t ret_ref = 0;
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44520         return ret_ref;
44521 }
44522
44523 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
44524         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
44525         int64_t ret_ref = 0;
44526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44528         return ret_ref;
44529 }
44530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44531         LDKNodeFeatures arg_conv;
44532         arg_conv.inner = untag_ptr(arg);
44533         arg_conv.is_owned = ptr_is_owned(arg);
44534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44535         arg_conv.is_owned = false;
44536         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
44537         return ret_conv;
44538 }
44539
44540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44541         LDKNodeFeatures orig_conv;
44542         orig_conv.inner = untag_ptr(orig);
44543         orig_conv.is_owned = ptr_is_owned(orig);
44544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44545         orig_conv.is_owned = false;
44546         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
44547         int64_t ret_ref = 0;
44548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44550         return ret_ref;
44551 }
44552
44553 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
44554         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
44555         int64_t ret_ref = 0;
44556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44558         return ret_ref;
44559 }
44560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44561         LDKChannelFeatures arg_conv;
44562         arg_conv.inner = untag_ptr(arg);
44563         arg_conv.is_owned = ptr_is_owned(arg);
44564         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44565         arg_conv.is_owned = false;
44566         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
44567         return ret_conv;
44568 }
44569
44570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44571         LDKChannelFeatures orig_conv;
44572         orig_conv.inner = untag_ptr(orig);
44573         orig_conv.is_owned = ptr_is_owned(orig);
44574         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44575         orig_conv.is_owned = false;
44576         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
44577         int64_t ret_ref = 0;
44578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44580         return ret_ref;
44581 }
44582
44583 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
44584         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
44585         int64_t ret_ref = 0;
44586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44588         return ret_ref;
44589 }
44590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44591         LDKInvoiceFeatures arg_conv;
44592         arg_conv.inner = untag_ptr(arg);
44593         arg_conv.is_owned = ptr_is_owned(arg);
44594         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44595         arg_conv.is_owned = false;
44596         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
44597         return ret_conv;
44598 }
44599
44600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44601         LDKInvoiceFeatures orig_conv;
44602         orig_conv.inner = untag_ptr(orig);
44603         orig_conv.is_owned = ptr_is_owned(orig);
44604         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44605         orig_conv.is_owned = false;
44606         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
44607         int64_t ret_ref = 0;
44608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44610         return ret_ref;
44611 }
44612
44613 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
44614         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
44615         int64_t ret_ref = 0;
44616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44618         return ret_ref;
44619 }
44620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44621         LDKOfferFeatures arg_conv;
44622         arg_conv.inner = untag_ptr(arg);
44623         arg_conv.is_owned = ptr_is_owned(arg);
44624         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44625         arg_conv.is_owned = false;
44626         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
44627         return ret_conv;
44628 }
44629
44630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44631         LDKOfferFeatures orig_conv;
44632         orig_conv.inner = untag_ptr(orig);
44633         orig_conv.is_owned = ptr_is_owned(orig);
44634         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44635         orig_conv.is_owned = false;
44636         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
44637         int64_t ret_ref = 0;
44638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44640         return ret_ref;
44641 }
44642
44643 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
44644         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
44645         int64_t ret_ref = 0;
44646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44648         return ret_ref;
44649 }
44650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44651         LDKInvoiceRequestFeatures arg_conv;
44652         arg_conv.inner = untag_ptr(arg);
44653         arg_conv.is_owned = ptr_is_owned(arg);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44655         arg_conv.is_owned = false;
44656         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
44657         return ret_conv;
44658 }
44659
44660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44661         LDKInvoiceRequestFeatures orig_conv;
44662         orig_conv.inner = untag_ptr(orig);
44663         orig_conv.is_owned = ptr_is_owned(orig);
44664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44665         orig_conv.is_owned = false;
44666         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
44667         int64_t ret_ref = 0;
44668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44670         return ret_ref;
44671 }
44672
44673 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
44674         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
44675         int64_t ret_ref = 0;
44676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44678         return ret_ref;
44679 }
44680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44681         LDKBolt12InvoiceFeatures arg_conv;
44682         arg_conv.inner = untag_ptr(arg);
44683         arg_conv.is_owned = ptr_is_owned(arg);
44684         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44685         arg_conv.is_owned = false;
44686         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
44687         return ret_conv;
44688 }
44689
44690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44691         LDKBolt12InvoiceFeatures orig_conv;
44692         orig_conv.inner = untag_ptr(orig);
44693         orig_conv.is_owned = ptr_is_owned(orig);
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44695         orig_conv.is_owned = false;
44696         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
44697         int64_t ret_ref = 0;
44698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44700         return ret_ref;
44701 }
44702
44703 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
44704         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
44705         int64_t ret_ref = 0;
44706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44708         return ret_ref;
44709 }
44710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44711         LDKBlindedHopFeatures arg_conv;
44712         arg_conv.inner = untag_ptr(arg);
44713         arg_conv.is_owned = ptr_is_owned(arg);
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44715         arg_conv.is_owned = false;
44716         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
44717         return ret_conv;
44718 }
44719
44720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44721         LDKBlindedHopFeatures orig_conv;
44722         orig_conv.inner = untag_ptr(orig);
44723         orig_conv.is_owned = ptr_is_owned(orig);
44724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44725         orig_conv.is_owned = false;
44726         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
44727         int64_t ret_ref = 0;
44728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44730         return ret_ref;
44731 }
44732
44733 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
44734         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
44735         int64_t ret_ref = 0;
44736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44738         return ret_ref;
44739 }
44740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44741         LDKChannelTypeFeatures arg_conv;
44742         arg_conv.inner = untag_ptr(arg);
44743         arg_conv.is_owned = ptr_is_owned(arg);
44744         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44745         arg_conv.is_owned = false;
44746         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
44747         return ret_conv;
44748 }
44749
44750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44751         LDKChannelTypeFeatures orig_conv;
44752         orig_conv.inner = untag_ptr(orig);
44753         orig_conv.is_owned = ptr_is_owned(orig);
44754         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44755         orig_conv.is_owned = false;
44756         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
44757         int64_t ret_ref = 0;
44758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44760         return ret_ref;
44761 }
44762
44763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44764         LDKInitFeatures this_obj_conv;
44765         this_obj_conv.inner = untag_ptr(this_obj);
44766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44768         InitFeatures_free(this_obj_conv);
44769 }
44770
44771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44772         LDKNodeFeatures this_obj_conv;
44773         this_obj_conv.inner = untag_ptr(this_obj);
44774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44776         NodeFeatures_free(this_obj_conv);
44777 }
44778
44779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44780         LDKChannelFeatures this_obj_conv;
44781         this_obj_conv.inner = untag_ptr(this_obj);
44782         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44784         ChannelFeatures_free(this_obj_conv);
44785 }
44786
44787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44788         LDKInvoiceFeatures this_obj_conv;
44789         this_obj_conv.inner = untag_ptr(this_obj);
44790         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44792         InvoiceFeatures_free(this_obj_conv);
44793 }
44794
44795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44796         LDKOfferFeatures this_obj_conv;
44797         this_obj_conv.inner = untag_ptr(this_obj);
44798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44800         OfferFeatures_free(this_obj_conv);
44801 }
44802
44803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44804         LDKInvoiceRequestFeatures this_obj_conv;
44805         this_obj_conv.inner = untag_ptr(this_obj);
44806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44808         InvoiceRequestFeatures_free(this_obj_conv);
44809 }
44810
44811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44812         LDKBolt12InvoiceFeatures this_obj_conv;
44813         this_obj_conv.inner = untag_ptr(this_obj);
44814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44816         Bolt12InvoiceFeatures_free(this_obj_conv);
44817 }
44818
44819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44820         LDKBlindedHopFeatures this_obj_conv;
44821         this_obj_conv.inner = untag_ptr(this_obj);
44822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44824         BlindedHopFeatures_free(this_obj_conv);
44825 }
44826
44827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44828         LDKChannelTypeFeatures this_obj_conv;
44829         this_obj_conv.inner = untag_ptr(this_obj);
44830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44832         ChannelTypeFeatures_free(this_obj_conv);
44833 }
44834
44835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
44836         LDKInitFeatures ret_var = InitFeatures_empty();
44837         int64_t ret_ref = 0;
44838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44840         return ret_ref;
44841 }
44842
44843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44844         LDKInitFeatures this_arg_conv;
44845         this_arg_conv.inner = untag_ptr(this_arg);
44846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44848         this_arg_conv.is_owned = false;
44849         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
44850         return ret_conv;
44851 }
44852
44853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
44854         LDKNodeFeatures ret_var = NodeFeatures_empty();
44855         int64_t ret_ref = 0;
44856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44858         return ret_ref;
44859 }
44860
44861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44862         LDKNodeFeatures this_arg_conv;
44863         this_arg_conv.inner = untag_ptr(this_arg);
44864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44866         this_arg_conv.is_owned = false;
44867         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
44868         return ret_conv;
44869 }
44870
44871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
44872         LDKChannelFeatures ret_var = ChannelFeatures_empty();
44873         int64_t ret_ref = 0;
44874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44876         return ret_ref;
44877 }
44878
44879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44880         LDKChannelFeatures this_arg_conv;
44881         this_arg_conv.inner = untag_ptr(this_arg);
44882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44884         this_arg_conv.is_owned = false;
44885         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
44886         return ret_conv;
44887 }
44888
44889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
44890         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
44891         int64_t ret_ref = 0;
44892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44894         return ret_ref;
44895 }
44896
44897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44898         LDKInvoiceFeatures this_arg_conv;
44899         this_arg_conv.inner = untag_ptr(this_arg);
44900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44902         this_arg_conv.is_owned = false;
44903         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
44904         return ret_conv;
44905 }
44906
44907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
44908         LDKOfferFeatures ret_var = OfferFeatures_empty();
44909         int64_t ret_ref = 0;
44910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44912         return ret_ref;
44913 }
44914
44915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44916         LDKOfferFeatures this_arg_conv;
44917         this_arg_conv.inner = untag_ptr(this_arg);
44918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44920         this_arg_conv.is_owned = false;
44921         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
44922         return ret_conv;
44923 }
44924
44925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
44926         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
44927         int64_t ret_ref = 0;
44928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44930         return ret_ref;
44931 }
44932
44933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44934         LDKInvoiceRequestFeatures this_arg_conv;
44935         this_arg_conv.inner = untag_ptr(this_arg);
44936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44938         this_arg_conv.is_owned = false;
44939         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
44940         return ret_conv;
44941 }
44942
44943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
44944         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
44945         int64_t ret_ref = 0;
44946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44948         return ret_ref;
44949 }
44950
44951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44952         LDKBolt12InvoiceFeatures this_arg_conv;
44953         this_arg_conv.inner = untag_ptr(this_arg);
44954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44956         this_arg_conv.is_owned = false;
44957         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
44958         return ret_conv;
44959 }
44960
44961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
44962         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
44963         int64_t ret_ref = 0;
44964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44966         return ret_ref;
44967 }
44968
44969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44970         LDKBlindedHopFeatures this_arg_conv;
44971         this_arg_conv.inner = untag_ptr(this_arg);
44972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44974         this_arg_conv.is_owned = false;
44975         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
44976         return ret_conv;
44977 }
44978
44979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
44980         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
44981         int64_t ret_ref = 0;
44982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44984         return ret_ref;
44985 }
44986
44987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
44988         LDKChannelTypeFeatures this_arg_conv;
44989         this_arg_conv.inner = untag_ptr(this_arg);
44990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44992         this_arg_conv.is_owned = false;
44993         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
44994         return ret_conv;
44995 }
44996
44997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
44998         LDKInitFeatures obj_conv;
44999         obj_conv.inner = untag_ptr(obj);
45000         obj_conv.is_owned = ptr_is_owned(obj);
45001         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45002         obj_conv.is_owned = false;
45003         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
45004         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45005         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45006         CVec_u8Z_free(ret_var);
45007         return ret_arr;
45008 }
45009
45010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45011         LDKu8slice ser_ref;
45012         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45013         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45014         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
45015         *ret_conv = InitFeatures_read(ser_ref);
45016         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45017         return tag_ptr(ret_conv, true);
45018 }
45019
45020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
45021         LDKChannelFeatures obj_conv;
45022         obj_conv.inner = untag_ptr(obj);
45023         obj_conv.is_owned = ptr_is_owned(obj);
45024         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45025         obj_conv.is_owned = false;
45026         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
45027         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45028         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45029         CVec_u8Z_free(ret_var);
45030         return ret_arr;
45031 }
45032
45033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45034         LDKu8slice ser_ref;
45035         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45036         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45037         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
45038         *ret_conv = ChannelFeatures_read(ser_ref);
45039         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45040         return tag_ptr(ret_conv, true);
45041 }
45042
45043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
45044         LDKNodeFeatures obj_conv;
45045         obj_conv.inner = untag_ptr(obj);
45046         obj_conv.is_owned = ptr_is_owned(obj);
45047         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45048         obj_conv.is_owned = false;
45049         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
45050         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45051         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45052         CVec_u8Z_free(ret_var);
45053         return ret_arr;
45054 }
45055
45056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45057         LDKu8slice ser_ref;
45058         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45059         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45060         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
45061         *ret_conv = NodeFeatures_read(ser_ref);
45062         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45063         return tag_ptr(ret_conv, true);
45064 }
45065
45066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
45067         LDKInvoiceFeatures obj_conv;
45068         obj_conv.inner = untag_ptr(obj);
45069         obj_conv.is_owned = ptr_is_owned(obj);
45070         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45071         obj_conv.is_owned = false;
45072         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
45073         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45074         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45075         CVec_u8Z_free(ret_var);
45076         return ret_arr;
45077 }
45078
45079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45080         LDKu8slice ser_ref;
45081         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45082         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45083         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
45084         *ret_conv = InvoiceFeatures_read(ser_ref);
45085         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45086         return tag_ptr(ret_conv, true);
45087 }
45088
45089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
45090         LDKBlindedHopFeatures obj_conv;
45091         obj_conv.inner = untag_ptr(obj);
45092         obj_conv.is_owned = ptr_is_owned(obj);
45093         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45094         obj_conv.is_owned = false;
45095         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
45096         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45097         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45098         CVec_u8Z_free(ret_var);
45099         return ret_arr;
45100 }
45101
45102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45103         LDKu8slice ser_ref;
45104         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45105         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45106         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
45107         *ret_conv = BlindedHopFeatures_read(ser_ref);
45108         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45109         return tag_ptr(ret_conv, true);
45110 }
45111
45112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
45113         LDKChannelTypeFeatures obj_conv;
45114         obj_conv.inner = untag_ptr(obj);
45115         obj_conv.is_owned = ptr_is_owned(obj);
45116         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45117         obj_conv.is_owned = false;
45118         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
45119         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45120         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45121         CVec_u8Z_free(ret_var);
45122         return ret_arr;
45123 }
45124
45125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45126         LDKu8slice ser_ref;
45127         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45128         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45129         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
45130         *ret_conv = ChannelTypeFeatures_read(ser_ref);
45131         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45132         return tag_ptr(ret_conv, true);
45133 }
45134
45135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45136         LDKInitFeatures this_arg_conv;
45137         this_arg_conv.inner = untag_ptr(this_arg);
45138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45140         this_arg_conv.is_owned = false;
45141         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
45142 }
45143
45144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45145         LDKInitFeatures this_arg_conv;
45146         this_arg_conv.inner = untag_ptr(this_arg);
45147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45149         this_arg_conv.is_owned = false;
45150         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
45151 }
45152
45153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
45154         LDKInitFeatures this_arg_conv;
45155         this_arg_conv.inner = untag_ptr(this_arg);
45156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45158         this_arg_conv.is_owned = false;
45159         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
45160         return ret_conv;
45161 }
45162
45163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45164         LDKNodeFeatures this_arg_conv;
45165         this_arg_conv.inner = untag_ptr(this_arg);
45166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45168         this_arg_conv.is_owned = false;
45169         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
45170 }
45171
45172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45173         LDKNodeFeatures this_arg_conv;
45174         this_arg_conv.inner = untag_ptr(this_arg);
45175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45177         this_arg_conv.is_owned = false;
45178         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
45179 }
45180
45181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
45182         LDKNodeFeatures this_arg_conv;
45183         this_arg_conv.inner = untag_ptr(this_arg);
45184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45186         this_arg_conv.is_owned = false;
45187         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
45188         return ret_conv;
45189 }
45190
45191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
45192         LDKInitFeatures this_arg_conv;
45193         this_arg_conv.inner = untag_ptr(this_arg);
45194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45196         this_arg_conv.is_owned = false;
45197         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
45198         return ret_conv;
45199 }
45200
45201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
45202         LDKNodeFeatures this_arg_conv;
45203         this_arg_conv.inner = untag_ptr(this_arg);
45204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45206         this_arg_conv.is_owned = false;
45207         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
45208         return ret_conv;
45209 }
45210
45211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45212         LDKInitFeatures this_arg_conv;
45213         this_arg_conv.inner = untag_ptr(this_arg);
45214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45216         this_arg_conv.is_owned = false;
45217         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
45218 }
45219
45220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45221         LDKInitFeatures this_arg_conv;
45222         this_arg_conv.inner = untag_ptr(this_arg);
45223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45225         this_arg_conv.is_owned = false;
45226         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
45227 }
45228
45229 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
45230         LDKInitFeatures this_arg_conv;
45231         this_arg_conv.inner = untag_ptr(this_arg);
45232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45234         this_arg_conv.is_owned = false;
45235         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
45236         return ret_conv;
45237 }
45238
45239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45240         LDKInitFeatures this_arg_conv;
45241         this_arg_conv.inner = untag_ptr(this_arg);
45242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45244         this_arg_conv.is_owned = false;
45245         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
45246 }
45247
45248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45249         LDKInitFeatures this_arg_conv;
45250         this_arg_conv.inner = untag_ptr(this_arg);
45251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45253         this_arg_conv.is_owned = false;
45254         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
45255 }
45256
45257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
45258         LDKInitFeatures this_arg_conv;
45259         this_arg_conv.inner = untag_ptr(this_arg);
45260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45262         this_arg_conv.is_owned = false;
45263         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
45264         return ret_conv;
45265 }
45266
45267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45268         LDKNodeFeatures this_arg_conv;
45269         this_arg_conv.inner = untag_ptr(this_arg);
45270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45272         this_arg_conv.is_owned = false;
45273         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
45274 }
45275
45276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45277         LDKNodeFeatures this_arg_conv;
45278         this_arg_conv.inner = untag_ptr(this_arg);
45279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45281         this_arg_conv.is_owned = false;
45282         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
45283 }
45284
45285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
45286         LDKNodeFeatures this_arg_conv;
45287         this_arg_conv.inner = untag_ptr(this_arg);
45288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45290         this_arg_conv.is_owned = false;
45291         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
45292         return ret_conv;
45293 }
45294
45295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
45296         LDKInitFeatures this_arg_conv;
45297         this_arg_conv.inner = untag_ptr(this_arg);
45298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45300         this_arg_conv.is_owned = false;
45301         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
45302         return ret_conv;
45303 }
45304
45305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
45306         LDKNodeFeatures this_arg_conv;
45307         this_arg_conv.inner = untag_ptr(this_arg);
45308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45310         this_arg_conv.is_owned = false;
45311         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
45312         return ret_conv;
45313 }
45314
45315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45316         LDKInitFeatures this_arg_conv;
45317         this_arg_conv.inner = untag_ptr(this_arg);
45318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45320         this_arg_conv.is_owned = false;
45321         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
45322 }
45323
45324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45325         LDKInitFeatures this_arg_conv;
45326         this_arg_conv.inner = untag_ptr(this_arg);
45327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45329         this_arg_conv.is_owned = false;
45330         InitFeatures_set_gossip_queries_required(&this_arg_conv);
45331 }
45332
45333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
45334         LDKInitFeatures this_arg_conv;
45335         this_arg_conv.inner = untag_ptr(this_arg);
45336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45338         this_arg_conv.is_owned = false;
45339         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
45340         return ret_conv;
45341 }
45342
45343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45344         LDKNodeFeatures this_arg_conv;
45345         this_arg_conv.inner = untag_ptr(this_arg);
45346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45348         this_arg_conv.is_owned = false;
45349         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
45350 }
45351
45352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45353         LDKNodeFeatures this_arg_conv;
45354         this_arg_conv.inner = untag_ptr(this_arg);
45355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45357         this_arg_conv.is_owned = false;
45358         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
45359 }
45360
45361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
45362         LDKNodeFeatures this_arg_conv;
45363         this_arg_conv.inner = untag_ptr(this_arg);
45364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45366         this_arg_conv.is_owned = false;
45367         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
45368         return ret_conv;
45369 }
45370
45371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
45372         LDKInitFeatures this_arg_conv;
45373         this_arg_conv.inner = untag_ptr(this_arg);
45374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45376         this_arg_conv.is_owned = false;
45377         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
45378         return ret_conv;
45379 }
45380
45381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
45382         LDKNodeFeatures this_arg_conv;
45383         this_arg_conv.inner = untag_ptr(this_arg);
45384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45386         this_arg_conv.is_owned = false;
45387         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
45388         return ret_conv;
45389 }
45390
45391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45392         LDKInitFeatures this_arg_conv;
45393         this_arg_conv.inner = untag_ptr(this_arg);
45394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45396         this_arg_conv.is_owned = false;
45397         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
45398 }
45399
45400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45401         LDKInitFeatures this_arg_conv;
45402         this_arg_conv.inner = untag_ptr(this_arg);
45403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45405         this_arg_conv.is_owned = false;
45406         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
45407 }
45408
45409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
45410         LDKInitFeatures this_arg_conv;
45411         this_arg_conv.inner = untag_ptr(this_arg);
45412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45414         this_arg_conv.is_owned = false;
45415         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
45416         return ret_conv;
45417 }
45418
45419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45420         LDKNodeFeatures this_arg_conv;
45421         this_arg_conv.inner = untag_ptr(this_arg);
45422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45424         this_arg_conv.is_owned = false;
45425         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
45426 }
45427
45428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45429         LDKNodeFeatures this_arg_conv;
45430         this_arg_conv.inner = untag_ptr(this_arg);
45431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45433         this_arg_conv.is_owned = false;
45434         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
45435 }
45436
45437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
45438         LDKNodeFeatures this_arg_conv;
45439         this_arg_conv.inner = untag_ptr(this_arg);
45440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45442         this_arg_conv.is_owned = false;
45443         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
45444         return ret_conv;
45445 }
45446
45447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45448         LDKInvoiceFeatures this_arg_conv;
45449         this_arg_conv.inner = untag_ptr(this_arg);
45450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45452         this_arg_conv.is_owned = false;
45453         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
45454 }
45455
45456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45457         LDKInvoiceFeatures this_arg_conv;
45458         this_arg_conv.inner = untag_ptr(this_arg);
45459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45461         this_arg_conv.is_owned = false;
45462         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
45463 }
45464
45465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
45466         LDKInvoiceFeatures this_arg_conv;
45467         this_arg_conv.inner = untag_ptr(this_arg);
45468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45470         this_arg_conv.is_owned = false;
45471         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
45472         return ret_conv;
45473 }
45474
45475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
45476         LDKInitFeatures this_arg_conv;
45477         this_arg_conv.inner = untag_ptr(this_arg);
45478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45480         this_arg_conv.is_owned = false;
45481         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
45482         return ret_conv;
45483 }
45484
45485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
45486         LDKNodeFeatures this_arg_conv;
45487         this_arg_conv.inner = untag_ptr(this_arg);
45488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45490         this_arg_conv.is_owned = false;
45491         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
45492         return ret_conv;
45493 }
45494
45495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
45496         LDKInvoiceFeatures this_arg_conv;
45497         this_arg_conv.inner = untag_ptr(this_arg);
45498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45500         this_arg_conv.is_owned = false;
45501         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
45502         return ret_conv;
45503 }
45504
45505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45506         LDKInitFeatures this_arg_conv;
45507         this_arg_conv.inner = untag_ptr(this_arg);
45508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45510         this_arg_conv.is_owned = false;
45511         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
45512 }
45513
45514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45515         LDKInitFeatures this_arg_conv;
45516         this_arg_conv.inner = untag_ptr(this_arg);
45517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45519         this_arg_conv.is_owned = false;
45520         InitFeatures_set_static_remote_key_required(&this_arg_conv);
45521 }
45522
45523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45524         LDKInitFeatures this_arg_conv;
45525         this_arg_conv.inner = untag_ptr(this_arg);
45526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45528         this_arg_conv.is_owned = false;
45529         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
45530         return ret_conv;
45531 }
45532
45533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45534         LDKNodeFeatures this_arg_conv;
45535         this_arg_conv.inner = untag_ptr(this_arg);
45536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45538         this_arg_conv.is_owned = false;
45539         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
45540 }
45541
45542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45543         LDKNodeFeatures this_arg_conv;
45544         this_arg_conv.inner = untag_ptr(this_arg);
45545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45547         this_arg_conv.is_owned = false;
45548         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
45549 }
45550
45551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45552         LDKNodeFeatures this_arg_conv;
45553         this_arg_conv.inner = untag_ptr(this_arg);
45554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45556         this_arg_conv.is_owned = false;
45557         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
45558         return ret_conv;
45559 }
45560
45561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45562         LDKChannelTypeFeatures this_arg_conv;
45563         this_arg_conv.inner = untag_ptr(this_arg);
45564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45566         this_arg_conv.is_owned = false;
45567         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
45568 }
45569
45570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45571         LDKChannelTypeFeatures this_arg_conv;
45572         this_arg_conv.inner = untag_ptr(this_arg);
45573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45575         this_arg_conv.is_owned = false;
45576         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
45577 }
45578
45579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45580         LDKChannelTypeFeatures this_arg_conv;
45581         this_arg_conv.inner = untag_ptr(this_arg);
45582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45584         this_arg_conv.is_owned = false;
45585         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
45586         return ret_conv;
45587 }
45588
45589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45590         LDKInitFeatures this_arg_conv;
45591         this_arg_conv.inner = untag_ptr(this_arg);
45592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45594         this_arg_conv.is_owned = false;
45595         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
45596         return ret_conv;
45597 }
45598
45599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45600         LDKNodeFeatures this_arg_conv;
45601         this_arg_conv.inner = untag_ptr(this_arg);
45602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45604         this_arg_conv.is_owned = false;
45605         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
45606         return ret_conv;
45607 }
45608
45609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45610         LDKChannelTypeFeatures this_arg_conv;
45611         this_arg_conv.inner = untag_ptr(this_arg);
45612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45614         this_arg_conv.is_owned = false;
45615         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
45616         return ret_conv;
45617 }
45618
45619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45620         LDKInitFeatures this_arg_conv;
45621         this_arg_conv.inner = untag_ptr(this_arg);
45622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45624         this_arg_conv.is_owned = false;
45625         InitFeatures_set_payment_secret_optional(&this_arg_conv);
45626 }
45627
45628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45629         LDKInitFeatures this_arg_conv;
45630         this_arg_conv.inner = untag_ptr(this_arg);
45631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45633         this_arg_conv.is_owned = false;
45634         InitFeatures_set_payment_secret_required(&this_arg_conv);
45635 }
45636
45637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45638         LDKInitFeatures this_arg_conv;
45639         this_arg_conv.inner = untag_ptr(this_arg);
45640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45642         this_arg_conv.is_owned = false;
45643         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
45644         return ret_conv;
45645 }
45646
45647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45648         LDKNodeFeatures this_arg_conv;
45649         this_arg_conv.inner = untag_ptr(this_arg);
45650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45652         this_arg_conv.is_owned = false;
45653         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
45654 }
45655
45656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45657         LDKNodeFeatures this_arg_conv;
45658         this_arg_conv.inner = untag_ptr(this_arg);
45659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45661         this_arg_conv.is_owned = false;
45662         NodeFeatures_set_payment_secret_required(&this_arg_conv);
45663 }
45664
45665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45666         LDKNodeFeatures this_arg_conv;
45667         this_arg_conv.inner = untag_ptr(this_arg);
45668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45670         this_arg_conv.is_owned = false;
45671         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
45672         return ret_conv;
45673 }
45674
45675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45676         LDKInvoiceFeatures this_arg_conv;
45677         this_arg_conv.inner = untag_ptr(this_arg);
45678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45680         this_arg_conv.is_owned = false;
45681         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
45682 }
45683
45684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45685         LDKInvoiceFeatures this_arg_conv;
45686         this_arg_conv.inner = untag_ptr(this_arg);
45687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45689         this_arg_conv.is_owned = false;
45690         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
45691 }
45692
45693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45694         LDKInvoiceFeatures this_arg_conv;
45695         this_arg_conv.inner = untag_ptr(this_arg);
45696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45698         this_arg_conv.is_owned = false;
45699         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
45700         return ret_conv;
45701 }
45702
45703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45704         LDKInitFeatures this_arg_conv;
45705         this_arg_conv.inner = untag_ptr(this_arg);
45706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45708         this_arg_conv.is_owned = false;
45709         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
45710         return ret_conv;
45711 }
45712
45713 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45714         LDKNodeFeatures this_arg_conv;
45715         this_arg_conv.inner = untag_ptr(this_arg);
45716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45718         this_arg_conv.is_owned = false;
45719         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
45720         return ret_conv;
45721 }
45722
45723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45724         LDKInvoiceFeatures this_arg_conv;
45725         this_arg_conv.inner = untag_ptr(this_arg);
45726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45728         this_arg_conv.is_owned = false;
45729         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
45730         return ret_conv;
45731 }
45732
45733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45734         LDKInitFeatures this_arg_conv;
45735         this_arg_conv.inner = untag_ptr(this_arg);
45736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45738         this_arg_conv.is_owned = false;
45739         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
45740 }
45741
45742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45743         LDKInitFeatures this_arg_conv;
45744         this_arg_conv.inner = untag_ptr(this_arg);
45745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45747         this_arg_conv.is_owned = false;
45748         InitFeatures_set_basic_mpp_required(&this_arg_conv);
45749 }
45750
45751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45752         LDKInitFeatures this_arg_conv;
45753         this_arg_conv.inner = untag_ptr(this_arg);
45754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45756         this_arg_conv.is_owned = false;
45757         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
45758         return ret_conv;
45759 }
45760
45761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45762         LDKNodeFeatures this_arg_conv;
45763         this_arg_conv.inner = untag_ptr(this_arg);
45764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45766         this_arg_conv.is_owned = false;
45767         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
45768 }
45769
45770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45771         LDKNodeFeatures this_arg_conv;
45772         this_arg_conv.inner = untag_ptr(this_arg);
45773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45775         this_arg_conv.is_owned = false;
45776         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
45777 }
45778
45779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45780         LDKNodeFeatures this_arg_conv;
45781         this_arg_conv.inner = untag_ptr(this_arg);
45782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45784         this_arg_conv.is_owned = false;
45785         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
45786         return ret_conv;
45787 }
45788
45789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45790         LDKInvoiceFeatures this_arg_conv;
45791         this_arg_conv.inner = untag_ptr(this_arg);
45792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45794         this_arg_conv.is_owned = false;
45795         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
45796 }
45797
45798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45799         LDKInvoiceFeatures this_arg_conv;
45800         this_arg_conv.inner = untag_ptr(this_arg);
45801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45803         this_arg_conv.is_owned = false;
45804         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
45805 }
45806
45807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45808         LDKInvoiceFeatures this_arg_conv;
45809         this_arg_conv.inner = untag_ptr(this_arg);
45810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45812         this_arg_conv.is_owned = false;
45813         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
45814         return ret_conv;
45815 }
45816
45817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45818         LDKBolt12InvoiceFeatures this_arg_conv;
45819         this_arg_conv.inner = untag_ptr(this_arg);
45820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45822         this_arg_conv.is_owned = false;
45823         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
45824 }
45825
45826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45827         LDKBolt12InvoiceFeatures this_arg_conv;
45828         this_arg_conv.inner = untag_ptr(this_arg);
45829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45831         this_arg_conv.is_owned = false;
45832         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
45833 }
45834
45835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45836         LDKBolt12InvoiceFeatures this_arg_conv;
45837         this_arg_conv.inner = untag_ptr(this_arg);
45838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45840         this_arg_conv.is_owned = false;
45841         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
45842         return ret_conv;
45843 }
45844
45845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45846         LDKInitFeatures this_arg_conv;
45847         this_arg_conv.inner = untag_ptr(this_arg);
45848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45850         this_arg_conv.is_owned = false;
45851         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
45852         return ret_conv;
45853 }
45854
45855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45856         LDKNodeFeatures this_arg_conv;
45857         this_arg_conv.inner = untag_ptr(this_arg);
45858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45860         this_arg_conv.is_owned = false;
45861         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
45862         return ret_conv;
45863 }
45864
45865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45866         LDKInvoiceFeatures this_arg_conv;
45867         this_arg_conv.inner = untag_ptr(this_arg);
45868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45870         this_arg_conv.is_owned = false;
45871         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
45872         return ret_conv;
45873 }
45874
45875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
45876         LDKBolt12InvoiceFeatures this_arg_conv;
45877         this_arg_conv.inner = untag_ptr(this_arg);
45878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45880         this_arg_conv.is_owned = false;
45881         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
45882         return ret_conv;
45883 }
45884
45885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45886         LDKInitFeatures this_arg_conv;
45887         this_arg_conv.inner = untag_ptr(this_arg);
45888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45890         this_arg_conv.is_owned = false;
45891         InitFeatures_set_wumbo_optional(&this_arg_conv);
45892 }
45893
45894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45895         LDKInitFeatures this_arg_conv;
45896         this_arg_conv.inner = untag_ptr(this_arg);
45897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45899         this_arg_conv.is_owned = false;
45900         InitFeatures_set_wumbo_required(&this_arg_conv);
45901 }
45902
45903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
45904         LDKInitFeatures this_arg_conv;
45905         this_arg_conv.inner = untag_ptr(this_arg);
45906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45908         this_arg_conv.is_owned = false;
45909         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
45910         return ret_conv;
45911 }
45912
45913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45914         LDKNodeFeatures this_arg_conv;
45915         this_arg_conv.inner = untag_ptr(this_arg);
45916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45918         this_arg_conv.is_owned = false;
45919         NodeFeatures_set_wumbo_optional(&this_arg_conv);
45920 }
45921
45922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45923         LDKNodeFeatures this_arg_conv;
45924         this_arg_conv.inner = untag_ptr(this_arg);
45925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45927         this_arg_conv.is_owned = false;
45928         NodeFeatures_set_wumbo_required(&this_arg_conv);
45929 }
45930
45931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
45932         LDKNodeFeatures this_arg_conv;
45933         this_arg_conv.inner = untag_ptr(this_arg);
45934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45936         this_arg_conv.is_owned = false;
45937         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
45938         return ret_conv;
45939 }
45940
45941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
45942         LDKInitFeatures this_arg_conv;
45943         this_arg_conv.inner = untag_ptr(this_arg);
45944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45946         this_arg_conv.is_owned = false;
45947         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
45948         return ret_conv;
45949 }
45950
45951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
45952         LDKNodeFeatures this_arg_conv;
45953         this_arg_conv.inner = untag_ptr(this_arg);
45954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45956         this_arg_conv.is_owned = false;
45957         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
45958         return ret_conv;
45959 }
45960
45961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45962         LDKInitFeatures this_arg_conv;
45963         this_arg_conv.inner = untag_ptr(this_arg);
45964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45966         this_arg_conv.is_owned = false;
45967         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
45968 }
45969
45970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45971         LDKInitFeatures this_arg_conv;
45972         this_arg_conv.inner = untag_ptr(this_arg);
45973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45975         this_arg_conv.is_owned = false;
45976         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
45977 }
45978
45979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
45980         LDKInitFeatures this_arg_conv;
45981         this_arg_conv.inner = untag_ptr(this_arg);
45982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45984         this_arg_conv.is_owned = false;
45985         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
45986         return ret_conv;
45987 }
45988
45989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
45990         LDKNodeFeatures this_arg_conv;
45991         this_arg_conv.inner = untag_ptr(this_arg);
45992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45994         this_arg_conv.is_owned = false;
45995         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
45996 }
45997
45998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
45999         LDKNodeFeatures this_arg_conv;
46000         this_arg_conv.inner = untag_ptr(this_arg);
46001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46003         this_arg_conv.is_owned = false;
46004         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
46005 }
46006
46007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
46008         LDKNodeFeatures this_arg_conv;
46009         this_arg_conv.inner = untag_ptr(this_arg);
46010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46012         this_arg_conv.is_owned = false;
46013         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
46014         return ret_conv;
46015 }
46016
46017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46018         LDKChannelTypeFeatures this_arg_conv;
46019         this_arg_conv.inner = untag_ptr(this_arg);
46020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46022         this_arg_conv.is_owned = false;
46023         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
46024 }
46025
46026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46027         LDKChannelTypeFeatures this_arg_conv;
46028         this_arg_conv.inner = untag_ptr(this_arg);
46029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46031         this_arg_conv.is_owned = false;
46032         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
46033 }
46034
46035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
46036         LDKChannelTypeFeatures this_arg_conv;
46037         this_arg_conv.inner = untag_ptr(this_arg);
46038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46040         this_arg_conv.is_owned = false;
46041         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
46042         return ret_conv;
46043 }
46044
46045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
46046         LDKInitFeatures this_arg_conv;
46047         this_arg_conv.inner = untag_ptr(this_arg);
46048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46050         this_arg_conv.is_owned = false;
46051         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
46052         return ret_conv;
46053 }
46054
46055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
46056         LDKNodeFeatures this_arg_conv;
46057         this_arg_conv.inner = untag_ptr(this_arg);
46058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46060         this_arg_conv.is_owned = false;
46061         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
46062         return ret_conv;
46063 }
46064
46065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
46066         LDKChannelTypeFeatures this_arg_conv;
46067         this_arg_conv.inner = untag_ptr(this_arg);
46068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46070         this_arg_conv.is_owned = false;
46071         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
46072         return ret_conv;
46073 }
46074
46075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46076         LDKInitFeatures this_arg_conv;
46077         this_arg_conv.inner = untag_ptr(this_arg);
46078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46080         this_arg_conv.is_owned = false;
46081         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
46082 }
46083
46084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46085         LDKInitFeatures this_arg_conv;
46086         this_arg_conv.inner = untag_ptr(this_arg);
46087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46089         this_arg_conv.is_owned = false;
46090         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
46091 }
46092
46093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
46094         LDKInitFeatures this_arg_conv;
46095         this_arg_conv.inner = untag_ptr(this_arg);
46096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46098         this_arg_conv.is_owned = false;
46099         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
46100         return ret_conv;
46101 }
46102
46103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46104         LDKNodeFeatures this_arg_conv;
46105         this_arg_conv.inner = untag_ptr(this_arg);
46106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46108         this_arg_conv.is_owned = false;
46109         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
46110 }
46111
46112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46113         LDKNodeFeatures this_arg_conv;
46114         this_arg_conv.inner = untag_ptr(this_arg);
46115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46117         this_arg_conv.is_owned = false;
46118         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
46119 }
46120
46121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
46122         LDKNodeFeatures this_arg_conv;
46123         this_arg_conv.inner = untag_ptr(this_arg);
46124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46126         this_arg_conv.is_owned = false;
46127         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
46128         return ret_conv;
46129 }
46130
46131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
46132         LDKInitFeatures this_arg_conv;
46133         this_arg_conv.inner = untag_ptr(this_arg);
46134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46136         this_arg_conv.is_owned = false;
46137         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
46138         return ret_conv;
46139 }
46140
46141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
46142         LDKNodeFeatures this_arg_conv;
46143         this_arg_conv.inner = untag_ptr(this_arg);
46144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46146         this_arg_conv.is_owned = false;
46147         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
46148         return ret_conv;
46149 }
46150
46151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46152         LDKInitFeatures this_arg_conv;
46153         this_arg_conv.inner = untag_ptr(this_arg);
46154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46156         this_arg_conv.is_owned = false;
46157         InitFeatures_set_onion_messages_optional(&this_arg_conv);
46158 }
46159
46160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46161         LDKInitFeatures this_arg_conv;
46162         this_arg_conv.inner = untag_ptr(this_arg);
46163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46165         this_arg_conv.is_owned = false;
46166         InitFeatures_set_onion_messages_required(&this_arg_conv);
46167 }
46168
46169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
46170         LDKInitFeatures this_arg_conv;
46171         this_arg_conv.inner = untag_ptr(this_arg);
46172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46174         this_arg_conv.is_owned = false;
46175         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
46176         return ret_conv;
46177 }
46178
46179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46180         LDKNodeFeatures this_arg_conv;
46181         this_arg_conv.inner = untag_ptr(this_arg);
46182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46184         this_arg_conv.is_owned = false;
46185         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
46186 }
46187
46188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46189         LDKNodeFeatures this_arg_conv;
46190         this_arg_conv.inner = untag_ptr(this_arg);
46191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46193         this_arg_conv.is_owned = false;
46194         NodeFeatures_set_onion_messages_required(&this_arg_conv);
46195 }
46196
46197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
46198         LDKNodeFeatures this_arg_conv;
46199         this_arg_conv.inner = untag_ptr(this_arg);
46200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46202         this_arg_conv.is_owned = false;
46203         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
46204         return ret_conv;
46205 }
46206
46207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
46208         LDKInitFeatures this_arg_conv;
46209         this_arg_conv.inner = untag_ptr(this_arg);
46210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46212         this_arg_conv.is_owned = false;
46213         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
46214         return ret_conv;
46215 }
46216
46217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
46218         LDKNodeFeatures this_arg_conv;
46219         this_arg_conv.inner = untag_ptr(this_arg);
46220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46222         this_arg_conv.is_owned = false;
46223         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
46224         return ret_conv;
46225 }
46226
46227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46228         LDKInitFeatures this_arg_conv;
46229         this_arg_conv.inner = untag_ptr(this_arg);
46230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46232         this_arg_conv.is_owned = false;
46233         InitFeatures_set_channel_type_optional(&this_arg_conv);
46234 }
46235
46236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46237         LDKInitFeatures this_arg_conv;
46238         this_arg_conv.inner = untag_ptr(this_arg);
46239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46241         this_arg_conv.is_owned = false;
46242         InitFeatures_set_channel_type_required(&this_arg_conv);
46243 }
46244
46245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
46246         LDKInitFeatures this_arg_conv;
46247         this_arg_conv.inner = untag_ptr(this_arg);
46248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46250         this_arg_conv.is_owned = false;
46251         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
46252         return ret_conv;
46253 }
46254
46255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46256         LDKNodeFeatures this_arg_conv;
46257         this_arg_conv.inner = untag_ptr(this_arg);
46258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46260         this_arg_conv.is_owned = false;
46261         NodeFeatures_set_channel_type_optional(&this_arg_conv);
46262 }
46263
46264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46265         LDKNodeFeatures this_arg_conv;
46266         this_arg_conv.inner = untag_ptr(this_arg);
46267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46269         this_arg_conv.is_owned = false;
46270         NodeFeatures_set_channel_type_required(&this_arg_conv);
46271 }
46272
46273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
46274         LDKNodeFeatures this_arg_conv;
46275         this_arg_conv.inner = untag_ptr(this_arg);
46276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46278         this_arg_conv.is_owned = false;
46279         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
46280         return ret_conv;
46281 }
46282
46283 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
46284         LDKInitFeatures this_arg_conv;
46285         this_arg_conv.inner = untag_ptr(this_arg);
46286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46288         this_arg_conv.is_owned = false;
46289         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
46290         return ret_conv;
46291 }
46292
46293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
46294         LDKNodeFeatures this_arg_conv;
46295         this_arg_conv.inner = untag_ptr(this_arg);
46296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46298         this_arg_conv.is_owned = false;
46299         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
46300         return ret_conv;
46301 }
46302
46303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46304         LDKInitFeatures this_arg_conv;
46305         this_arg_conv.inner = untag_ptr(this_arg);
46306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46308         this_arg_conv.is_owned = false;
46309         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
46310 }
46311
46312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46313         LDKInitFeatures this_arg_conv;
46314         this_arg_conv.inner = untag_ptr(this_arg);
46315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46317         this_arg_conv.is_owned = false;
46318         InitFeatures_set_scid_privacy_required(&this_arg_conv);
46319 }
46320
46321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
46322         LDKInitFeatures this_arg_conv;
46323         this_arg_conv.inner = untag_ptr(this_arg);
46324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46326         this_arg_conv.is_owned = false;
46327         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
46328         return ret_conv;
46329 }
46330
46331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46332         LDKNodeFeatures this_arg_conv;
46333         this_arg_conv.inner = untag_ptr(this_arg);
46334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46336         this_arg_conv.is_owned = false;
46337         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
46338 }
46339
46340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46341         LDKNodeFeatures this_arg_conv;
46342         this_arg_conv.inner = untag_ptr(this_arg);
46343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46345         this_arg_conv.is_owned = false;
46346         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
46347 }
46348
46349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
46350         LDKNodeFeatures this_arg_conv;
46351         this_arg_conv.inner = untag_ptr(this_arg);
46352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46354         this_arg_conv.is_owned = false;
46355         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
46356         return ret_conv;
46357 }
46358
46359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46360         LDKChannelTypeFeatures this_arg_conv;
46361         this_arg_conv.inner = untag_ptr(this_arg);
46362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46364         this_arg_conv.is_owned = false;
46365         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
46366 }
46367
46368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46369         LDKChannelTypeFeatures this_arg_conv;
46370         this_arg_conv.inner = untag_ptr(this_arg);
46371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46373         this_arg_conv.is_owned = false;
46374         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
46375 }
46376
46377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
46378         LDKChannelTypeFeatures this_arg_conv;
46379         this_arg_conv.inner = untag_ptr(this_arg);
46380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46382         this_arg_conv.is_owned = false;
46383         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
46384         return ret_conv;
46385 }
46386
46387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
46388         LDKInitFeatures this_arg_conv;
46389         this_arg_conv.inner = untag_ptr(this_arg);
46390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46392         this_arg_conv.is_owned = false;
46393         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
46394         return ret_conv;
46395 }
46396
46397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
46398         LDKNodeFeatures this_arg_conv;
46399         this_arg_conv.inner = untag_ptr(this_arg);
46400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46402         this_arg_conv.is_owned = false;
46403         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
46404         return ret_conv;
46405 }
46406
46407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
46408         LDKChannelTypeFeatures this_arg_conv;
46409         this_arg_conv.inner = untag_ptr(this_arg);
46410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46412         this_arg_conv.is_owned = false;
46413         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
46414         return ret_conv;
46415 }
46416
46417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46418         LDKInitFeatures this_arg_conv;
46419         this_arg_conv.inner = untag_ptr(this_arg);
46420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46422         this_arg_conv.is_owned = false;
46423         InitFeatures_set_zero_conf_optional(&this_arg_conv);
46424 }
46425
46426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46427         LDKInitFeatures this_arg_conv;
46428         this_arg_conv.inner = untag_ptr(this_arg);
46429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46431         this_arg_conv.is_owned = false;
46432         InitFeatures_set_zero_conf_required(&this_arg_conv);
46433 }
46434
46435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
46436         LDKInitFeatures this_arg_conv;
46437         this_arg_conv.inner = untag_ptr(this_arg);
46438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46440         this_arg_conv.is_owned = false;
46441         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
46442         return ret_conv;
46443 }
46444
46445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46446         LDKNodeFeatures this_arg_conv;
46447         this_arg_conv.inner = untag_ptr(this_arg);
46448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46450         this_arg_conv.is_owned = false;
46451         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
46452 }
46453
46454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46455         LDKNodeFeatures this_arg_conv;
46456         this_arg_conv.inner = untag_ptr(this_arg);
46457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46459         this_arg_conv.is_owned = false;
46460         NodeFeatures_set_zero_conf_required(&this_arg_conv);
46461 }
46462
46463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
46464         LDKNodeFeatures this_arg_conv;
46465         this_arg_conv.inner = untag_ptr(this_arg);
46466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46468         this_arg_conv.is_owned = false;
46469         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
46470         return ret_conv;
46471 }
46472
46473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46474         LDKChannelTypeFeatures this_arg_conv;
46475         this_arg_conv.inner = untag_ptr(this_arg);
46476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46478         this_arg_conv.is_owned = false;
46479         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
46480 }
46481
46482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46483         LDKChannelTypeFeatures this_arg_conv;
46484         this_arg_conv.inner = untag_ptr(this_arg);
46485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46487         this_arg_conv.is_owned = false;
46488         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
46489 }
46490
46491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
46492         LDKChannelTypeFeatures this_arg_conv;
46493         this_arg_conv.inner = untag_ptr(this_arg);
46494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46496         this_arg_conv.is_owned = false;
46497         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
46498         return ret_conv;
46499 }
46500
46501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
46502         LDKInitFeatures this_arg_conv;
46503         this_arg_conv.inner = untag_ptr(this_arg);
46504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46506         this_arg_conv.is_owned = false;
46507         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
46508         return ret_conv;
46509 }
46510
46511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
46512         LDKNodeFeatures this_arg_conv;
46513         this_arg_conv.inner = untag_ptr(this_arg);
46514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46516         this_arg_conv.is_owned = false;
46517         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
46518         return ret_conv;
46519 }
46520
46521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
46522         LDKChannelTypeFeatures this_arg_conv;
46523         this_arg_conv.inner = untag_ptr(this_arg);
46524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46526         this_arg_conv.is_owned = false;
46527         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
46528         return ret_conv;
46529 }
46530
46531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
46532         LDKNodeFeatures this_arg_conv;
46533         this_arg_conv.inner = untag_ptr(this_arg);
46534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46536         this_arg_conv.is_owned = false;
46537         NodeFeatures_set_keysend_optional(&this_arg_conv);
46538 }
46539
46540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
46541         LDKNodeFeatures this_arg_conv;
46542         this_arg_conv.inner = untag_ptr(this_arg);
46543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46545         this_arg_conv.is_owned = false;
46546         NodeFeatures_set_keysend_required(&this_arg_conv);
46547 }
46548
46549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
46550         LDKNodeFeatures this_arg_conv;
46551         this_arg_conv.inner = untag_ptr(this_arg);
46552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46554         this_arg_conv.is_owned = false;
46555         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
46556         return ret_conv;
46557 }
46558
46559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
46560         LDKNodeFeatures this_arg_conv;
46561         this_arg_conv.inner = untag_ptr(this_arg);
46562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46564         this_arg_conv.is_owned = false;
46565         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
46566         return ret_conv;
46567 }
46568
46569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46570         LDKShutdownScript this_obj_conv;
46571         this_obj_conv.inner = untag_ptr(this_obj);
46572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46574         ShutdownScript_free(this_obj_conv);
46575 }
46576
46577 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
46578         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
46579         int64_t ret_ref = 0;
46580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46582         return ret_ref;
46583 }
46584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46585         LDKShutdownScript arg_conv;
46586         arg_conv.inner = untag_ptr(arg);
46587         arg_conv.is_owned = ptr_is_owned(arg);
46588         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46589         arg_conv.is_owned = false;
46590         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
46591         return ret_conv;
46592 }
46593
46594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46595         LDKShutdownScript orig_conv;
46596         orig_conv.inner = untag_ptr(orig);
46597         orig_conv.is_owned = ptr_is_owned(orig);
46598         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46599         orig_conv.is_owned = false;
46600         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
46601         int64_t ret_ref = 0;
46602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46604         return ret_ref;
46605 }
46606
46607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46608         LDKShutdownScript a_conv;
46609         a_conv.inner = untag_ptr(a);
46610         a_conv.is_owned = ptr_is_owned(a);
46611         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46612         a_conv.is_owned = false;
46613         LDKShutdownScript b_conv;
46614         b_conv.inner = untag_ptr(b);
46615         b_conv.is_owned = ptr_is_owned(b);
46616         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46617         b_conv.is_owned = false;
46618         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
46619         return ret_conv;
46620 }
46621
46622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46623         LDKInvalidShutdownScript this_obj_conv;
46624         this_obj_conv.inner = untag_ptr(this_obj);
46625         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46627         InvalidShutdownScript_free(this_obj_conv);
46628 }
46629
46630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
46631         LDKInvalidShutdownScript this_ptr_conv;
46632         this_ptr_conv.inner = untag_ptr(this_ptr);
46633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46635         this_ptr_conv.is_owned = false;
46636         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
46637         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46638         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46639         return ret_arr;
46640 }
46641
46642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46643         LDKInvalidShutdownScript this_ptr_conv;
46644         this_ptr_conv.inner = untag_ptr(this_ptr);
46645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46647         this_ptr_conv.is_owned = false;
46648         LDKCVec_u8Z val_ref;
46649         val_ref.datalen = (*env)->GetArrayLength(env, val);
46650         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46651         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46652         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
46653 }
46654
46655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
46656         LDKCVec_u8Z script_arg_ref;
46657         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
46658         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46659         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
46660         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
46661         int64_t ret_ref = 0;
46662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46664         return ret_ref;
46665 }
46666
46667 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
46668         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
46669         int64_t ret_ref = 0;
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46672         return ret_ref;
46673 }
46674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46675         LDKInvalidShutdownScript arg_conv;
46676         arg_conv.inner = untag_ptr(arg);
46677         arg_conv.is_owned = ptr_is_owned(arg);
46678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46679         arg_conv.is_owned = false;
46680         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
46681         return ret_conv;
46682 }
46683
46684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46685         LDKInvalidShutdownScript orig_conv;
46686         orig_conv.inner = untag_ptr(orig);
46687         orig_conv.is_owned = ptr_is_owned(orig);
46688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46689         orig_conv.is_owned = false;
46690         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
46691         int64_t ret_ref = 0;
46692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46694         return ret_ref;
46695 }
46696
46697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
46698         LDKShutdownScript obj_conv;
46699         obj_conv.inner = untag_ptr(obj);
46700         obj_conv.is_owned = ptr_is_owned(obj);
46701         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46702         obj_conv.is_owned = false;
46703         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
46704         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46705         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46706         CVec_u8Z_free(ret_var);
46707         return ret_arr;
46708 }
46709
46710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46711         LDKu8slice ser_ref;
46712         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46713         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46714         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
46715         *ret_conv = ShutdownScript_read(ser_ref);
46716         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46717         return tag_ptr(ret_conv, true);
46718 }
46719
46720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
46721         uint8_t pubkey_hash_arr[20];
46722         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
46723         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
46724         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
46725         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
46726         int64_t ret_ref = 0;
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46729         return ret_ref;
46730 }
46731
46732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
46733         uint8_t script_hash_arr[32];
46734         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
46735         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
46736         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
46737         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
46738         int64_t ret_ref = 0;
46739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46741         return ret_ref;
46742 }
46743
46744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
46745         
46746         LDKu8slice program_ref;
46747         program_ref.datalen = (*env)->GetArrayLength(env, program);
46748         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
46749         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
46750         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
46751         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
46752         return tag_ptr(ret_conv, true);
46753 }
46754
46755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
46756         LDKShutdownScript this_arg_conv;
46757         this_arg_conv.inner = untag_ptr(this_arg);
46758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46760         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
46761         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
46762         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46763         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46764         CVec_u8Z_free(ret_var);
46765         return ret_arr;
46766 }
46767
46768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
46769         LDKShutdownScript this_arg_conv;
46770         this_arg_conv.inner = untag_ptr(this_arg);
46771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46773         this_arg_conv.is_owned = false;
46774         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46775         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
46776         return ret_arr;
46777 }
46778
46779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
46780         LDKShutdownScript this_arg_conv;
46781         this_arg_conv.inner = untag_ptr(this_arg);
46782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46784         this_arg_conv.is_owned = false;
46785         LDKInitFeatures features_conv;
46786         features_conv.inner = untag_ptr(features);
46787         features_conv.is_owned = ptr_is_owned(features);
46788         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
46789         features_conv.is_owned = false;
46790         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
46791         return ret_conv;
46792 }
46793
46794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46795         if (!ptr_is_owned(this_ptr)) return;
46796         void* this_ptr_ptr = untag_ptr(this_ptr);
46797         CHECK_ACCESS(this_ptr_ptr);
46798         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
46799         FREE(untag_ptr(this_ptr));
46800         Retry_free(this_ptr_conv);
46801 }
46802
46803 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
46804         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46805         *ret_copy = Retry_clone(arg);
46806         int64_t ret_ref = tag_ptr(ret_copy, true);
46807         return ret_ref;
46808 }
46809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46810         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
46811         int64_t ret_conv = Retry_clone_ptr(arg_conv);
46812         return ret_conv;
46813 }
46814
46815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46816         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
46817         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46818         *ret_copy = Retry_clone(orig_conv);
46819         int64_t ret_ref = tag_ptr(ret_copy, true);
46820         return ret_ref;
46821 }
46822
46823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
46824         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46825         *ret_copy = Retry_attempts(a);
46826         int64_t ret_ref = tag_ptr(ret_copy, true);
46827         return ret_ref;
46828 }
46829
46830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
46831         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46832         *ret_copy = Retry_timeout(a);
46833         int64_t ret_ref = tag_ptr(ret_copy, true);
46834         return ret_ref;
46835 }
46836
46837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46838         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
46839         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
46840         jboolean ret_conv = Retry_eq(a_conv, b_conv);
46841         return ret_conv;
46842 }
46843
46844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
46845         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
46846         int64_t ret_conv = Retry_hash(o_conv);
46847         return ret_conv;
46848 }
46849
46850 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46851         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
46852         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
46853         return ret_conv;
46854 }
46855
46856 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
46857         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
46858         return ret_conv;
46859 }
46860
46861 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
46862         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
46863         return ret_conv;
46864 }
46865
46866 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
46867         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
46868         return ret_conv;
46869 }
46870
46871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46872         if (!ptr_is_owned(this_ptr)) return;
46873         void* this_ptr_ptr = untag_ptr(this_ptr);
46874         CHECK_ACCESS(this_ptr_ptr);
46875         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
46876         FREE(untag_ptr(this_ptr));
46877         PaymentSendFailure_free(this_ptr_conv);
46878 }
46879
46880 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
46881         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
46882         *ret_copy = PaymentSendFailure_clone(arg);
46883         int64_t ret_ref = tag_ptr(ret_copy, true);
46884         return ret_ref;
46885 }
46886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46887         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
46888         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
46889         return ret_conv;
46890 }
46891
46892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46893         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
46894         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
46895         *ret_copy = PaymentSendFailure_clone(orig_conv);
46896         int64_t ret_ref = tag_ptr(ret_copy, true);
46897         return ret_ref;
46898 }
46899
46900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
46901         void* a_ptr = untag_ptr(a);
46902         CHECK_ACCESS(a_ptr);
46903         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
46904         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
46905         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
46906         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
46907         int64_t ret_ref = tag_ptr(ret_copy, true);
46908         return ret_ref;
46909 }
46910
46911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
46912         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
46913         a_constr.datalen = (*env)->GetArrayLength(env, a);
46914         if (a_constr.datalen > 0)
46915                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
46916         else
46917                 a_constr.data = NULL;
46918         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
46919         for (size_t w = 0; w < a_constr.datalen; w++) {
46920                 int64_t a_conv_22 = a_vals[w];
46921                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
46922                 CHECK_ACCESS(a_conv_22_ptr);
46923                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
46924                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
46925                 a_constr.data[w] = a_conv_22_conv;
46926         }
46927         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
46928         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
46929         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
46930         int64_t ret_ref = tag_ptr(ret_copy, true);
46931         return ret_ref;
46932 }
46933
46934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
46935         LDKCVec_APIErrorZ a_constr;
46936         a_constr.datalen = (*env)->GetArrayLength(env, a);
46937         if (a_constr.datalen > 0)
46938                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
46939         else
46940                 a_constr.data = NULL;
46941         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
46942         for (size_t k = 0; k < a_constr.datalen; k++) {
46943                 int64_t a_conv_10 = a_vals[k];
46944                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
46945                 CHECK_ACCESS(a_conv_10_ptr);
46946                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
46947                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
46948                 a_constr.data[k] = a_conv_10_conv;
46949         }
46950         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
46951         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
46952         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
46953         int64_t ret_ref = tag_ptr(ret_copy, true);
46954         return ret_ref;
46955 }
46956
46957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
46958         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
46959         *ret_copy = PaymentSendFailure_duplicate_payment();
46960         int64_t ret_ref = tag_ptr(ret_copy, true);
46961         return ret_ref;
46962 }
46963
46964 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) {
46965         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
46966         results_constr.datalen = (*env)->GetArrayLength(env, results);
46967         if (results_constr.datalen > 0)
46968                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
46969         else
46970                 results_constr.data = NULL;
46971         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
46972         for (size_t w = 0; w < results_constr.datalen; w++) {
46973                 int64_t results_conv_22 = results_vals[w];
46974                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
46975                 CHECK_ACCESS(results_conv_22_ptr);
46976                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
46977                 results_constr.data[w] = results_conv_22_conv;
46978         }
46979         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
46980         LDKRouteParameters failed_paths_retry_conv;
46981         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
46982         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
46984         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
46985         LDKThirtyTwoBytes payment_id_ref;
46986         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
46987         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
46988         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
46989         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
46990         int64_t ret_ref = tag_ptr(ret_copy, true);
46991         return ret_ref;
46992 }
46993
46994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46995         if (!ptr_is_owned(this_ptr)) return;
46996         void* this_ptr_ptr = untag_ptr(this_ptr);
46997         CHECK_ACCESS(this_ptr_ptr);
46998         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
46999         FREE(untag_ptr(this_ptr));
47000         CustomMessageReader_free(this_ptr_conv);
47001 }
47002
47003 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
47004         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
47005         *ret_ret = Type_clone(arg);
47006         return tag_ptr(ret_ret, true);
47007 }
47008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47009         void* arg_ptr = untag_ptr(arg);
47010         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
47011         LDKType* arg_conv = (LDKType*)arg_ptr;
47012         int64_t ret_conv = Type_clone_ptr(arg_conv);
47013         return ret_conv;
47014 }
47015
47016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47017         void* orig_ptr = untag_ptr(orig);
47018         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
47019         LDKType* orig_conv = (LDKType*)orig_ptr;
47020         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
47021         *ret_ret = Type_clone(orig_conv);
47022         return tag_ptr(ret_ret, true);
47023 }
47024
47025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47026         if (!ptr_is_owned(this_ptr)) return;
47027         void* this_ptr_ptr = untag_ptr(this_ptr);
47028         CHECK_ACCESS(this_ptr_ptr);
47029         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
47030         FREE(untag_ptr(this_ptr));
47031         Type_free(this_ptr_conv);
47032 }
47033
47034 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47035         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
47036         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
47037         return ret_conv;
47038 }
47039
47040 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
47041         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
47042         return ret_conv;
47043 }
47044
47045 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
47046         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
47047         return ret_conv;
47048 }
47049
47050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47051         if (!ptr_is_owned(this_ptr)) return;
47052         void* this_ptr_ptr = untag_ptr(this_ptr);
47053         CHECK_ACCESS(this_ptr_ptr);
47054         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
47055         FREE(untag_ptr(this_ptr));
47056         UtxoResult_free(this_ptr_conv);
47057 }
47058
47059 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
47060         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
47061         *ret_copy = UtxoResult_clone(arg);
47062         int64_t ret_ref = tag_ptr(ret_copy, true);
47063         return ret_ref;
47064 }
47065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47066         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
47067         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
47068         return ret_conv;
47069 }
47070
47071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47072         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
47073         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
47074         *ret_copy = UtxoResult_clone(orig_conv);
47075         int64_t ret_ref = tag_ptr(ret_copy, true);
47076         return ret_ref;
47077 }
47078
47079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
47080         void* a_ptr = untag_ptr(a);
47081         CHECK_ACCESS(a_ptr);
47082         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
47083         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
47084         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
47085         *ret_copy = UtxoResult_sync(a_conv);
47086         int64_t ret_ref = tag_ptr(ret_copy, true);
47087         return ret_ref;
47088 }
47089
47090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
47091         LDKUtxoFuture a_conv;
47092         a_conv.inner = untag_ptr(a);
47093         a_conv.is_owned = ptr_is_owned(a);
47094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47095         a_conv = UtxoFuture_clone(&a_conv);
47096         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
47097         *ret_copy = UtxoResult_async(a_conv);
47098         int64_t ret_ref = tag_ptr(ret_copy, true);
47099         return ret_ref;
47100 }
47101
47102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47103         if (!ptr_is_owned(this_ptr)) return;
47104         void* this_ptr_ptr = untag_ptr(this_ptr);
47105         CHECK_ACCESS(this_ptr_ptr);
47106         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
47107         FREE(untag_ptr(this_ptr));
47108         UtxoLookup_free(this_ptr_conv);
47109 }
47110
47111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47112         LDKUtxoFuture this_obj_conv;
47113         this_obj_conv.inner = untag_ptr(this_obj);
47114         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47116         UtxoFuture_free(this_obj_conv);
47117 }
47118
47119 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
47120         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
47121         int64_t ret_ref = 0;
47122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47124         return ret_ref;
47125 }
47126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47127         LDKUtxoFuture arg_conv;
47128         arg_conv.inner = untag_ptr(arg);
47129         arg_conv.is_owned = ptr_is_owned(arg);
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47131         arg_conv.is_owned = false;
47132         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
47133         return ret_conv;
47134 }
47135
47136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47137         LDKUtxoFuture orig_conv;
47138         orig_conv.inner = untag_ptr(orig);
47139         orig_conv.is_owned = ptr_is_owned(orig);
47140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47141         orig_conv.is_owned = false;
47142         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
47143         int64_t ret_ref = 0;
47144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47146         return ret_ref;
47147 }
47148
47149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
47150         LDKUtxoFuture ret_var = UtxoFuture_new();
47151         int64_t ret_ref = 0;
47152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47154         return ret_ref;
47155 }
47156
47157 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) {
47158         LDKUtxoFuture this_arg_conv;
47159         this_arg_conv.inner = untag_ptr(this_arg);
47160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47162         this_arg_conv.is_owned = false;
47163         LDKNetworkGraph graph_conv;
47164         graph_conv.inner = untag_ptr(graph);
47165         graph_conv.is_owned = ptr_is_owned(graph);
47166         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
47167         graph_conv.is_owned = false;
47168         void* result_ptr = untag_ptr(result);
47169         CHECK_ACCESS(result_ptr);
47170         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
47171         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
47172 }
47173
47174 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) {
47175         LDKUtxoFuture this_arg_conv;
47176         this_arg_conv.inner = untag_ptr(this_arg);
47177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47179         this_arg_conv.is_owned = false;
47180         LDKNetworkGraph graph_conv;
47181         graph_conv.inner = untag_ptr(graph);
47182         graph_conv.is_owned = ptr_is_owned(graph);
47183         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
47184         graph_conv.is_owned = false;
47185         LDKP2PGossipSync gossip_conv;
47186         gossip_conv.inner = untag_ptr(gossip);
47187         gossip_conv.is_owned = ptr_is_owned(gossip);
47188         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
47189         gossip_conv.is_owned = false;
47190         void* result_ptr = untag_ptr(result);
47191         CHECK_ACCESS(result_ptr);
47192         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
47193         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
47194 }
47195
47196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47197         LDKNodeId this_obj_conv;
47198         this_obj_conv.inner = untag_ptr(this_obj);
47199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47201         NodeId_free(this_obj_conv);
47202 }
47203
47204 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
47205         LDKNodeId ret_var = NodeId_clone(arg);
47206         int64_t ret_ref = 0;
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47209         return ret_ref;
47210 }
47211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47212         LDKNodeId arg_conv;
47213         arg_conv.inner = untag_ptr(arg);
47214         arg_conv.is_owned = ptr_is_owned(arg);
47215         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47216         arg_conv.is_owned = false;
47217         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
47218         return ret_conv;
47219 }
47220
47221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47222         LDKNodeId orig_conv;
47223         orig_conv.inner = untag_ptr(orig);
47224         orig_conv.is_owned = ptr_is_owned(orig);
47225         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47226         orig_conv.is_owned = false;
47227         LDKNodeId ret_var = NodeId_clone(&orig_conv);
47228         int64_t ret_ref = 0;
47229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47231         return ret_ref;
47232 }
47233
47234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
47235         LDKPublicKey pubkey_ref;
47236         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
47237         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
47238         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
47239         int64_t ret_ref = 0;
47240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47242         return ret_ref;
47243 }
47244
47245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
47246         LDKNodeId this_arg_conv;
47247         this_arg_conv.inner = untag_ptr(this_arg);
47248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47250         this_arg_conv.is_owned = false;
47251         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
47252         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47253         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47254         return ret_arr;
47255 }
47256
47257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
47258         LDKNodeId o_conv;
47259         o_conv.inner = untag_ptr(o);
47260         o_conv.is_owned = ptr_is_owned(o);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47262         o_conv.is_owned = false;
47263         int64_t ret_conv = NodeId_hash(&o_conv);
47264         return ret_conv;
47265 }
47266
47267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
47268         LDKNodeId obj_conv;
47269         obj_conv.inner = untag_ptr(obj);
47270         obj_conv.is_owned = ptr_is_owned(obj);
47271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47272         obj_conv.is_owned = false;
47273         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
47274         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47275         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47276         CVec_u8Z_free(ret_var);
47277         return ret_arr;
47278 }
47279
47280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47281         LDKu8slice ser_ref;
47282         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47283         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47284         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
47285         *ret_conv = NodeId_read(ser_ref);
47286         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47287         return tag_ptr(ret_conv, true);
47288 }
47289
47290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47291         LDKNetworkGraph this_obj_conv;
47292         this_obj_conv.inner = untag_ptr(this_obj);
47293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47295         NetworkGraph_free(this_obj_conv);
47296 }
47297
47298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47299         LDKReadOnlyNetworkGraph this_obj_conv;
47300         this_obj_conv.inner = untag_ptr(this_obj);
47301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47303         ReadOnlyNetworkGraph_free(this_obj_conv);
47304 }
47305
47306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47307         if (!ptr_is_owned(this_ptr)) return;
47308         void* this_ptr_ptr = untag_ptr(this_ptr);
47309         CHECK_ACCESS(this_ptr_ptr);
47310         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
47311         FREE(untag_ptr(this_ptr));
47312         NetworkUpdate_free(this_ptr_conv);
47313 }
47314
47315 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
47316         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
47317         *ret_copy = NetworkUpdate_clone(arg);
47318         int64_t ret_ref = tag_ptr(ret_copy, true);
47319         return ret_ref;
47320 }
47321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47322         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
47323         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
47324         return ret_conv;
47325 }
47326
47327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47328         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
47329         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
47330         *ret_copy = NetworkUpdate_clone(orig_conv);
47331         int64_t ret_ref = tag_ptr(ret_copy, true);
47332         return ret_ref;
47333 }
47334
47335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
47336         LDKChannelUpdate msg_conv;
47337         msg_conv.inner = untag_ptr(msg);
47338         msg_conv.is_owned = ptr_is_owned(msg);
47339         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47340         msg_conv = ChannelUpdate_clone(&msg_conv);
47341         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
47342         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
47343         int64_t ret_ref = tag_ptr(ret_copy, true);
47344         return ret_ref;
47345 }
47346
47347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
47348         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
47349         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
47350         int64_t ret_ref = tag_ptr(ret_copy, true);
47351         return ret_ref;
47352 }
47353
47354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
47355         LDKPublicKey node_id_ref;
47356         CHECK((*env)->GetArrayLength(env, node_id) == 33);
47357         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
47358         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
47359         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
47360         int64_t ret_ref = tag_ptr(ret_copy, true);
47361         return ret_ref;
47362 }
47363
47364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47365         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
47366         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
47367         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
47368         return ret_conv;
47369 }
47370
47371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
47372         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
47373         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
47374         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47375         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47376         CVec_u8Z_free(ret_var);
47377         return ret_arr;
47378 }
47379
47380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47381         LDKu8slice ser_ref;
47382         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47383         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47384         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
47385         *ret_conv = NetworkUpdate_read(ser_ref);
47386         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47387         return tag_ptr(ret_conv, true);
47388 }
47389
47390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47391         LDKP2PGossipSync this_obj_conv;
47392         this_obj_conv.inner = untag_ptr(this_obj);
47393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47395         P2PGossipSync_free(this_obj_conv);
47396 }
47397
47398 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) {
47399         LDKNetworkGraph network_graph_conv;
47400         network_graph_conv.inner = untag_ptr(network_graph);
47401         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47402         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47403         network_graph_conv.is_owned = false;
47404         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
47405         CHECK_ACCESS(utxo_lookup_ptr);
47406         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
47407         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
47408         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
47409                 // Manually implement clone for Java trait instances
47410                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
47411                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47412                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
47413                 }
47414         }
47415         void* logger_ptr = untag_ptr(logger);
47416         CHECK_ACCESS(logger_ptr);
47417         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47418         if (logger_conv.free == LDKLogger_JCalls_free) {
47419                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47420                 LDKLogger_JCalls_cloned(&logger_conv);
47421         }
47422         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
47423         int64_t ret_ref = 0;
47424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47426         return ret_ref;
47427 }
47428
47429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
47430         LDKP2PGossipSync this_arg_conv;
47431         this_arg_conv.inner = untag_ptr(this_arg);
47432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47434         this_arg_conv.is_owned = false;
47435         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
47436         CHECK_ACCESS(utxo_lookup_ptr);
47437         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
47438         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
47439         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
47440                 // Manually implement clone for Java trait instances
47441                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
47442                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47443                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
47444                 }
47445         }
47446         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
47447 }
47448
47449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
47450         LDKNetworkGraph this_arg_conv;
47451         this_arg_conv.inner = untag_ptr(this_arg);
47452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47454         this_arg_conv.is_owned = false;
47455         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
47456         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
47457 }
47458
47459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
47460         LDKP2PGossipSync this_arg_conv;
47461         this_arg_conv.inner = untag_ptr(this_arg);
47462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47464         this_arg_conv.is_owned = false;
47465         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
47466         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
47467         return tag_ptr(ret_ret, true);
47468 }
47469
47470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
47471         LDKP2PGossipSync this_arg_conv;
47472         this_arg_conv.inner = untag_ptr(this_arg);
47473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47475         this_arg_conv.is_owned = false;
47476         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
47477         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
47478         return tag_ptr(ret_ret, true);
47479 }
47480
47481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47482         LDKChannelUpdateInfo this_obj_conv;
47483         this_obj_conv.inner = untag_ptr(this_obj);
47484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47486         ChannelUpdateInfo_free(this_obj_conv);
47487 }
47488
47489 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
47490         LDKChannelUpdateInfo this_ptr_conv;
47491         this_ptr_conv.inner = untag_ptr(this_ptr);
47492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47494         this_ptr_conv.is_owned = false;
47495         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
47496         return ret_conv;
47497 }
47498
47499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47500         LDKChannelUpdateInfo this_ptr_conv;
47501         this_ptr_conv.inner = untag_ptr(this_ptr);
47502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47504         this_ptr_conv.is_owned = false;
47505         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
47506 }
47507
47508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
47509         LDKChannelUpdateInfo this_ptr_conv;
47510         this_ptr_conv.inner = untag_ptr(this_ptr);
47511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47513         this_ptr_conv.is_owned = false;
47514         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
47515         return ret_conv;
47516 }
47517
47518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47519         LDKChannelUpdateInfo this_ptr_conv;
47520         this_ptr_conv.inner = untag_ptr(this_ptr);
47521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47523         this_ptr_conv.is_owned = false;
47524         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
47525 }
47526
47527 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
47528         LDKChannelUpdateInfo this_ptr_conv;
47529         this_ptr_conv.inner = untag_ptr(this_ptr);
47530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47532         this_ptr_conv.is_owned = false;
47533         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
47534         return ret_conv;
47535 }
47536
47537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47538         LDKChannelUpdateInfo this_ptr_conv;
47539         this_ptr_conv.inner = untag_ptr(this_ptr);
47540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47542         this_ptr_conv.is_owned = false;
47543         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
47544 }
47545
47546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47547         LDKChannelUpdateInfo this_ptr_conv;
47548         this_ptr_conv.inner = untag_ptr(this_ptr);
47549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47551         this_ptr_conv.is_owned = false;
47552         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
47553         return ret_conv;
47554 }
47555
47556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47557         LDKChannelUpdateInfo this_ptr_conv;
47558         this_ptr_conv.inner = untag_ptr(this_ptr);
47559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47561         this_ptr_conv.is_owned = false;
47562         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
47563 }
47564
47565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47566         LDKChannelUpdateInfo this_ptr_conv;
47567         this_ptr_conv.inner = untag_ptr(this_ptr);
47568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47570         this_ptr_conv.is_owned = false;
47571         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
47572         return ret_conv;
47573 }
47574
47575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47576         LDKChannelUpdateInfo this_ptr_conv;
47577         this_ptr_conv.inner = untag_ptr(this_ptr);
47578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47580         this_ptr_conv.is_owned = false;
47581         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
47582 }
47583
47584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
47585         LDKChannelUpdateInfo this_ptr_conv;
47586         this_ptr_conv.inner = untag_ptr(this_ptr);
47587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47589         this_ptr_conv.is_owned = false;
47590         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
47591         int64_t ret_ref = 0;
47592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47594         return ret_ref;
47595 }
47596
47597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47598         LDKChannelUpdateInfo this_ptr_conv;
47599         this_ptr_conv.inner = untag_ptr(this_ptr);
47600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47602         this_ptr_conv.is_owned = false;
47603         LDKRoutingFees val_conv;
47604         val_conv.inner = untag_ptr(val);
47605         val_conv.is_owned = ptr_is_owned(val);
47606         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47607         val_conv = RoutingFees_clone(&val_conv);
47608         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
47609 }
47610
47611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
47612         LDKChannelUpdateInfo this_ptr_conv;
47613         this_ptr_conv.inner = untag_ptr(this_ptr);
47614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47616         this_ptr_conv.is_owned = false;
47617         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
47618         int64_t ret_ref = 0;
47619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47621         return ret_ref;
47622 }
47623
47624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47625         LDKChannelUpdateInfo this_ptr_conv;
47626         this_ptr_conv.inner = untag_ptr(this_ptr);
47627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47629         this_ptr_conv.is_owned = false;
47630         LDKChannelUpdate val_conv;
47631         val_conv.inner = untag_ptr(val);
47632         val_conv.is_owned = ptr_is_owned(val);
47633         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47634         val_conv = ChannelUpdate_clone(&val_conv);
47635         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
47636 }
47637
47638 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) {
47639         LDKRoutingFees fees_arg_conv;
47640         fees_arg_conv.inner = untag_ptr(fees_arg);
47641         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
47642         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
47643         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
47644         LDKChannelUpdate last_update_message_arg_conv;
47645         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
47646         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
47647         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
47648         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
47649         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);
47650         int64_t ret_ref = 0;
47651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47653         return ret_ref;
47654 }
47655
47656 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
47657         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
47658         int64_t ret_ref = 0;
47659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47661         return ret_ref;
47662 }
47663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47664         LDKChannelUpdateInfo arg_conv;
47665         arg_conv.inner = untag_ptr(arg);
47666         arg_conv.is_owned = ptr_is_owned(arg);
47667         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47668         arg_conv.is_owned = false;
47669         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
47670         return ret_conv;
47671 }
47672
47673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47674         LDKChannelUpdateInfo orig_conv;
47675         orig_conv.inner = untag_ptr(orig);
47676         orig_conv.is_owned = ptr_is_owned(orig);
47677         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47678         orig_conv.is_owned = false;
47679         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
47680         int64_t ret_ref = 0;
47681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47683         return ret_ref;
47684 }
47685
47686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47687         LDKChannelUpdateInfo a_conv;
47688         a_conv.inner = untag_ptr(a);
47689         a_conv.is_owned = ptr_is_owned(a);
47690         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47691         a_conv.is_owned = false;
47692         LDKChannelUpdateInfo b_conv;
47693         b_conv.inner = untag_ptr(b);
47694         b_conv.is_owned = ptr_is_owned(b);
47695         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47696         b_conv.is_owned = false;
47697         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
47698         return ret_conv;
47699 }
47700
47701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
47702         LDKChannelUpdateInfo obj_conv;
47703         obj_conv.inner = untag_ptr(obj);
47704         obj_conv.is_owned = ptr_is_owned(obj);
47705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47706         obj_conv.is_owned = false;
47707         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
47708         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47709         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47710         CVec_u8Z_free(ret_var);
47711         return ret_arr;
47712 }
47713
47714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47715         LDKu8slice ser_ref;
47716         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47717         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47718         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
47719         *ret_conv = ChannelUpdateInfo_read(ser_ref);
47720         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47721         return tag_ptr(ret_conv, true);
47722 }
47723
47724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47725         LDKChannelInfo this_obj_conv;
47726         this_obj_conv.inner = untag_ptr(this_obj);
47727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47729         ChannelInfo_free(this_obj_conv);
47730 }
47731
47732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
47733         LDKChannelInfo this_ptr_conv;
47734         this_ptr_conv.inner = untag_ptr(this_ptr);
47735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47737         this_ptr_conv.is_owned = false;
47738         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
47739         int64_t ret_ref = 0;
47740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47742         return ret_ref;
47743 }
47744
47745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47746         LDKChannelInfo this_ptr_conv;
47747         this_ptr_conv.inner = untag_ptr(this_ptr);
47748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47750         this_ptr_conv.is_owned = false;
47751         LDKChannelFeatures val_conv;
47752         val_conv.inner = untag_ptr(val);
47753         val_conv.is_owned = ptr_is_owned(val);
47754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47755         val_conv = ChannelFeatures_clone(&val_conv);
47756         ChannelInfo_set_features(&this_ptr_conv, val_conv);
47757 }
47758
47759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
47760         LDKChannelInfo this_ptr_conv;
47761         this_ptr_conv.inner = untag_ptr(this_ptr);
47762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47764         this_ptr_conv.is_owned = false;
47765         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
47766         int64_t ret_ref = 0;
47767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47769         return ret_ref;
47770 }
47771
47772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47773         LDKChannelInfo this_ptr_conv;
47774         this_ptr_conv.inner = untag_ptr(this_ptr);
47775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47777         this_ptr_conv.is_owned = false;
47778         LDKNodeId val_conv;
47779         val_conv.inner = untag_ptr(val);
47780         val_conv.is_owned = ptr_is_owned(val);
47781         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47782         val_conv = NodeId_clone(&val_conv);
47783         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
47784 }
47785
47786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
47787         LDKChannelInfo this_ptr_conv;
47788         this_ptr_conv.inner = untag_ptr(this_ptr);
47789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47791         this_ptr_conv.is_owned = false;
47792         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
47793         int64_t ret_ref = 0;
47794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47796         return ret_ref;
47797 }
47798
47799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47800         LDKChannelInfo this_ptr_conv;
47801         this_ptr_conv.inner = untag_ptr(this_ptr);
47802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47804         this_ptr_conv.is_owned = false;
47805         LDKChannelUpdateInfo val_conv;
47806         val_conv.inner = untag_ptr(val);
47807         val_conv.is_owned = ptr_is_owned(val);
47808         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47809         val_conv = ChannelUpdateInfo_clone(&val_conv);
47810         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
47811 }
47812
47813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
47814         LDKChannelInfo this_ptr_conv;
47815         this_ptr_conv.inner = untag_ptr(this_ptr);
47816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47818         this_ptr_conv.is_owned = false;
47819         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
47820         int64_t ret_ref = 0;
47821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47823         return ret_ref;
47824 }
47825
47826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47827         LDKChannelInfo this_ptr_conv;
47828         this_ptr_conv.inner = untag_ptr(this_ptr);
47829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47831         this_ptr_conv.is_owned = false;
47832         LDKNodeId val_conv;
47833         val_conv.inner = untag_ptr(val);
47834         val_conv.is_owned = ptr_is_owned(val);
47835         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47836         val_conv = NodeId_clone(&val_conv);
47837         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
47838 }
47839
47840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
47841         LDKChannelInfo this_ptr_conv;
47842         this_ptr_conv.inner = untag_ptr(this_ptr);
47843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47845         this_ptr_conv.is_owned = false;
47846         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
47847         int64_t ret_ref = 0;
47848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47850         return ret_ref;
47851 }
47852
47853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47854         LDKChannelInfo this_ptr_conv;
47855         this_ptr_conv.inner = untag_ptr(this_ptr);
47856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47858         this_ptr_conv.is_owned = false;
47859         LDKChannelUpdateInfo val_conv;
47860         val_conv.inner = untag_ptr(val);
47861         val_conv.is_owned = ptr_is_owned(val);
47862         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47863         val_conv = ChannelUpdateInfo_clone(&val_conv);
47864         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
47865 }
47866
47867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
47868         LDKChannelInfo this_ptr_conv;
47869         this_ptr_conv.inner = untag_ptr(this_ptr);
47870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47872         this_ptr_conv.is_owned = false;
47873         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47874         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
47875         int64_t ret_ref = tag_ptr(ret_copy, true);
47876         return ret_ref;
47877 }
47878
47879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47880         LDKChannelInfo this_ptr_conv;
47881         this_ptr_conv.inner = untag_ptr(this_ptr);
47882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47884         this_ptr_conv.is_owned = false;
47885         void* val_ptr = untag_ptr(val);
47886         CHECK_ACCESS(val_ptr);
47887         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47888         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47889         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
47890 }
47891
47892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
47893         LDKChannelInfo this_ptr_conv;
47894         this_ptr_conv.inner = untag_ptr(this_ptr);
47895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47897         this_ptr_conv.is_owned = false;
47898         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
47899         int64_t ret_ref = 0;
47900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47902         return ret_ref;
47903 }
47904
47905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47906         LDKChannelInfo this_ptr_conv;
47907         this_ptr_conv.inner = untag_ptr(this_ptr);
47908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47910         this_ptr_conv.is_owned = false;
47911         LDKChannelAnnouncement val_conv;
47912         val_conv.inner = untag_ptr(val);
47913         val_conv.is_owned = ptr_is_owned(val);
47914         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47915         val_conv = ChannelAnnouncement_clone(&val_conv);
47916         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
47917 }
47918
47919 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
47920         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
47921         int64_t ret_ref = 0;
47922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47924         return ret_ref;
47925 }
47926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47927         LDKChannelInfo arg_conv;
47928         arg_conv.inner = untag_ptr(arg);
47929         arg_conv.is_owned = ptr_is_owned(arg);
47930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47931         arg_conv.is_owned = false;
47932         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
47933         return ret_conv;
47934 }
47935
47936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47937         LDKChannelInfo orig_conv;
47938         orig_conv.inner = untag_ptr(orig);
47939         orig_conv.is_owned = ptr_is_owned(orig);
47940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47941         orig_conv.is_owned = false;
47942         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
47943         int64_t ret_ref = 0;
47944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47946         return ret_ref;
47947 }
47948
47949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47950         LDKChannelInfo a_conv;
47951         a_conv.inner = untag_ptr(a);
47952         a_conv.is_owned = ptr_is_owned(a);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47954         a_conv.is_owned = false;
47955         LDKChannelInfo b_conv;
47956         b_conv.inner = untag_ptr(b);
47957         b_conv.is_owned = ptr_is_owned(b);
47958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47959         b_conv.is_owned = false;
47960         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
47961         return ret_conv;
47962 }
47963
47964 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) {
47965         LDKChannelInfo this_arg_conv;
47966         this_arg_conv.inner = untag_ptr(this_arg);
47967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47969         this_arg_conv.is_owned = false;
47970         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
47971         int64_t ret_ref = 0;
47972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47974         return ret_ref;
47975 }
47976
47977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
47978         LDKChannelInfo obj_conv;
47979         obj_conv.inner = untag_ptr(obj);
47980         obj_conv.is_owned = ptr_is_owned(obj);
47981         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47982         obj_conv.is_owned = false;
47983         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
47984         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47985         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47986         CVec_u8Z_free(ret_var);
47987         return ret_arr;
47988 }
47989
47990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47991         LDKu8slice ser_ref;
47992         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47993         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47994         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
47995         *ret_conv = ChannelInfo_read(ser_ref);
47996         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47997         return tag_ptr(ret_conv, true);
47998 }
47999
48000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48001         LDKDirectedChannelInfo this_obj_conv;
48002         this_obj_conv.inner = untag_ptr(this_obj);
48003         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48005         DirectedChannelInfo_free(this_obj_conv);
48006 }
48007
48008 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
48009         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
48010         int64_t ret_ref = 0;
48011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48013         return ret_ref;
48014 }
48015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48016         LDKDirectedChannelInfo arg_conv;
48017         arg_conv.inner = untag_ptr(arg);
48018         arg_conv.is_owned = ptr_is_owned(arg);
48019         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48020         arg_conv.is_owned = false;
48021         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
48022         return ret_conv;
48023 }
48024
48025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48026         LDKDirectedChannelInfo orig_conv;
48027         orig_conv.inner = untag_ptr(orig);
48028         orig_conv.is_owned = ptr_is_owned(orig);
48029         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48030         orig_conv.is_owned = false;
48031         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
48032         int64_t ret_ref = 0;
48033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48035         return ret_ref;
48036 }
48037
48038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
48039         LDKDirectedChannelInfo this_arg_conv;
48040         this_arg_conv.inner = untag_ptr(this_arg);
48041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48043         this_arg_conv.is_owned = false;
48044         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
48045         int64_t ret_ref = 0;
48046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48048         return ret_ref;
48049 }
48050
48051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
48052         LDKDirectedChannelInfo this_arg_conv;
48053         this_arg_conv.inner = untag_ptr(this_arg);
48054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48056         this_arg_conv.is_owned = false;
48057         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
48058         return ret_conv;
48059 }
48060
48061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
48062         LDKDirectedChannelInfo this_arg_conv;
48063         this_arg_conv.inner = untag_ptr(this_arg);
48064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48066         this_arg_conv.is_owned = false;
48067         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48068         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
48069         int64_t ret_ref = tag_ptr(ret_copy, true);
48070         return ret_ref;
48071 }
48072
48073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48074         if (!ptr_is_owned(this_ptr)) return;
48075         void* this_ptr_ptr = untag_ptr(this_ptr);
48076         CHECK_ACCESS(this_ptr_ptr);
48077         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
48078         FREE(untag_ptr(this_ptr));
48079         EffectiveCapacity_free(this_ptr_conv);
48080 }
48081
48082 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
48083         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48084         *ret_copy = EffectiveCapacity_clone(arg);
48085         int64_t ret_ref = tag_ptr(ret_copy, true);
48086         return ret_ref;
48087 }
48088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48089         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
48090         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
48091         return ret_conv;
48092 }
48093
48094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48095         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
48096         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48097         *ret_copy = EffectiveCapacity_clone(orig_conv);
48098         int64_t ret_ref = tag_ptr(ret_copy, true);
48099         return ret_ref;
48100 }
48101
48102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
48103         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48104         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
48105         int64_t ret_ref = tag_ptr(ret_copy, true);
48106         return ret_ref;
48107 }
48108
48109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
48110         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48111         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
48112         int64_t ret_ref = tag_ptr(ret_copy, true);
48113         return ret_ref;
48114 }
48115
48116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
48117         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48118         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
48119         int64_t ret_ref = tag_ptr(ret_copy, true);
48120         return ret_ref;
48121 }
48122
48123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
48124         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48125         *ret_copy = EffectiveCapacity_infinite();
48126         int64_t ret_ref = tag_ptr(ret_copy, true);
48127         return ret_ref;
48128 }
48129
48130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
48131         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
48132         *ret_copy = EffectiveCapacity_unknown();
48133         int64_t ret_ref = tag_ptr(ret_copy, true);
48134         return ret_ref;
48135 }
48136
48137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
48138         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
48139         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
48140         return ret_conv;
48141 }
48142
48143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48144         LDKRoutingFees this_obj_conv;
48145         this_obj_conv.inner = untag_ptr(this_obj);
48146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48148         RoutingFees_free(this_obj_conv);
48149 }
48150
48151 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48152         LDKRoutingFees this_ptr_conv;
48153         this_ptr_conv.inner = untag_ptr(this_ptr);
48154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48156         this_ptr_conv.is_owned = false;
48157         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
48158         return ret_conv;
48159 }
48160
48161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48162         LDKRoutingFees this_ptr_conv;
48163         this_ptr_conv.inner = untag_ptr(this_ptr);
48164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48166         this_ptr_conv.is_owned = false;
48167         RoutingFees_set_base_msat(&this_ptr_conv, val);
48168 }
48169
48170 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
48171         LDKRoutingFees this_ptr_conv;
48172         this_ptr_conv.inner = untag_ptr(this_ptr);
48173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48175         this_ptr_conv.is_owned = false;
48176         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
48177         return ret_conv;
48178 }
48179
48180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48181         LDKRoutingFees this_ptr_conv;
48182         this_ptr_conv.inner = untag_ptr(this_ptr);
48183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48185         this_ptr_conv.is_owned = false;
48186         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
48187 }
48188
48189 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) {
48190         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
48191         int64_t ret_ref = 0;
48192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48194         return ret_ref;
48195 }
48196
48197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48198         LDKRoutingFees a_conv;
48199         a_conv.inner = untag_ptr(a);
48200         a_conv.is_owned = ptr_is_owned(a);
48201         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48202         a_conv.is_owned = false;
48203         LDKRoutingFees b_conv;
48204         b_conv.inner = untag_ptr(b);
48205         b_conv.is_owned = ptr_is_owned(b);
48206         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48207         b_conv.is_owned = false;
48208         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
48209         return ret_conv;
48210 }
48211
48212 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
48213         LDKRoutingFees ret_var = RoutingFees_clone(arg);
48214         int64_t ret_ref = 0;
48215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48217         return ret_ref;
48218 }
48219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48220         LDKRoutingFees arg_conv;
48221         arg_conv.inner = untag_ptr(arg);
48222         arg_conv.is_owned = ptr_is_owned(arg);
48223         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48224         arg_conv.is_owned = false;
48225         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
48226         return ret_conv;
48227 }
48228
48229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48230         LDKRoutingFees orig_conv;
48231         orig_conv.inner = untag_ptr(orig);
48232         orig_conv.is_owned = ptr_is_owned(orig);
48233         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48234         orig_conv.is_owned = false;
48235         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
48236         int64_t ret_ref = 0;
48237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48239         return ret_ref;
48240 }
48241
48242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
48243         LDKRoutingFees o_conv;
48244         o_conv.inner = untag_ptr(o);
48245         o_conv.is_owned = ptr_is_owned(o);
48246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48247         o_conv.is_owned = false;
48248         int64_t ret_conv = RoutingFees_hash(&o_conv);
48249         return ret_conv;
48250 }
48251
48252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
48253         LDKRoutingFees obj_conv;
48254         obj_conv.inner = untag_ptr(obj);
48255         obj_conv.is_owned = ptr_is_owned(obj);
48256         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48257         obj_conv.is_owned = false;
48258         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
48259         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48260         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48261         CVec_u8Z_free(ret_var);
48262         return ret_arr;
48263 }
48264
48265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48266         LDKu8slice ser_ref;
48267         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48268         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48269         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
48270         *ret_conv = RoutingFees_read(ser_ref);
48271         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48272         return tag_ptr(ret_conv, true);
48273 }
48274
48275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48276         LDKNodeAnnouncementInfo this_obj_conv;
48277         this_obj_conv.inner = untag_ptr(this_obj);
48278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48280         NodeAnnouncementInfo_free(this_obj_conv);
48281 }
48282
48283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
48284         LDKNodeAnnouncementInfo this_ptr_conv;
48285         this_ptr_conv.inner = untag_ptr(this_ptr);
48286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48288         this_ptr_conv.is_owned = false;
48289         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
48290         int64_t ret_ref = 0;
48291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48293         return ret_ref;
48294 }
48295
48296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48297         LDKNodeAnnouncementInfo this_ptr_conv;
48298         this_ptr_conv.inner = untag_ptr(this_ptr);
48299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48301         this_ptr_conv.is_owned = false;
48302         LDKNodeFeatures val_conv;
48303         val_conv.inner = untag_ptr(val);
48304         val_conv.is_owned = ptr_is_owned(val);
48305         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48306         val_conv = NodeFeatures_clone(&val_conv);
48307         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
48308 }
48309
48310 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
48311         LDKNodeAnnouncementInfo this_ptr_conv;
48312         this_ptr_conv.inner = untag_ptr(this_ptr);
48313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48315         this_ptr_conv.is_owned = false;
48316         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
48317         return ret_conv;
48318 }
48319
48320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48321         LDKNodeAnnouncementInfo this_ptr_conv;
48322         this_ptr_conv.inner = untag_ptr(this_ptr);
48323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48325         this_ptr_conv.is_owned = false;
48326         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
48327 }
48328
48329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
48330         LDKNodeAnnouncementInfo this_ptr_conv;
48331         this_ptr_conv.inner = untag_ptr(this_ptr);
48332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48334         this_ptr_conv.is_owned = false;
48335         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
48336         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
48337         return ret_arr;
48338 }
48339
48340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48341         LDKNodeAnnouncementInfo this_ptr_conv;
48342         this_ptr_conv.inner = untag_ptr(this_ptr);
48343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48345         this_ptr_conv.is_owned = false;
48346         LDKThreeBytes val_ref;
48347         CHECK((*env)->GetArrayLength(env, val) == 3);
48348         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
48349         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
48350 }
48351
48352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
48353         LDKNodeAnnouncementInfo this_ptr_conv;
48354         this_ptr_conv.inner = untag_ptr(this_ptr);
48355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48357         this_ptr_conv.is_owned = false;
48358         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
48359         int64_t ret_ref = 0;
48360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48362         return ret_ref;
48363 }
48364
48365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48366         LDKNodeAnnouncementInfo this_ptr_conv;
48367         this_ptr_conv.inner = untag_ptr(this_ptr);
48368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48370         this_ptr_conv.is_owned = false;
48371         LDKNodeAlias val_conv;
48372         val_conv.inner = untag_ptr(val);
48373         val_conv.is_owned = ptr_is_owned(val);
48374         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48375         val_conv = NodeAlias_clone(&val_conv);
48376         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
48377 }
48378
48379 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
48380         LDKNodeAnnouncementInfo this_ptr_conv;
48381         this_ptr_conv.inner = untag_ptr(this_ptr);
48382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48384         this_ptr_conv.is_owned = false;
48385         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
48386         int64_tArray ret_arr = NULL;
48387         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48388         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48389         for (size_t m = 0; m < ret_var.datalen; m++) {
48390                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
48391                 *ret_conv_12_copy = ret_var.data[m];
48392                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
48393                 ret_arr_ptr[m] = ret_conv_12_ref;
48394         }
48395         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48396         FREE(ret_var.data);
48397         return ret_arr;
48398 }
48399
48400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
48401         LDKNodeAnnouncementInfo this_ptr_conv;
48402         this_ptr_conv.inner = untag_ptr(this_ptr);
48403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48405         this_ptr_conv.is_owned = false;
48406         LDKCVec_NetAddressZ val_constr;
48407         val_constr.datalen = (*env)->GetArrayLength(env, val);
48408         if (val_constr.datalen > 0)
48409                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
48410         else
48411                 val_constr.data = NULL;
48412         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
48413         for (size_t m = 0; m < val_constr.datalen; m++) {
48414                 int64_t val_conv_12 = val_vals[m];
48415                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
48416                 CHECK_ACCESS(val_conv_12_ptr);
48417                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
48418                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
48419                 val_constr.data[m] = val_conv_12_conv;
48420         }
48421         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
48422         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
48423 }
48424
48425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
48426         LDKNodeAnnouncementInfo this_ptr_conv;
48427         this_ptr_conv.inner = untag_ptr(this_ptr);
48428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48430         this_ptr_conv.is_owned = false;
48431         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
48432         int64_t ret_ref = 0;
48433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48435         return ret_ref;
48436 }
48437
48438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48439         LDKNodeAnnouncementInfo this_ptr_conv;
48440         this_ptr_conv.inner = untag_ptr(this_ptr);
48441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48443         this_ptr_conv.is_owned = false;
48444         LDKNodeAnnouncement val_conv;
48445         val_conv.inner = untag_ptr(val);
48446         val_conv.is_owned = ptr_is_owned(val);
48447         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48448         val_conv = NodeAnnouncement_clone(&val_conv);
48449         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
48450 }
48451
48452 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_tArray addresses_arg, int64_t announcement_message_arg) {
48453         LDKNodeFeatures features_arg_conv;
48454         features_arg_conv.inner = untag_ptr(features_arg);
48455         features_arg_conv.is_owned = ptr_is_owned(features_arg);
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
48457         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
48458         LDKThreeBytes rgb_arg_ref;
48459         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
48460         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
48461         LDKNodeAlias alias_arg_conv;
48462         alias_arg_conv.inner = untag_ptr(alias_arg);
48463         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
48464         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
48465         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
48466         LDKCVec_NetAddressZ addresses_arg_constr;
48467         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
48468         if (addresses_arg_constr.datalen > 0)
48469                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
48470         else
48471                 addresses_arg_constr.data = NULL;
48472         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
48473         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
48474                 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
48475                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
48476                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
48477                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
48478                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
48479         }
48480         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
48481         LDKNodeAnnouncement announcement_message_arg_conv;
48482         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
48483         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
48484         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
48485         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
48486         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
48487         int64_t ret_ref = 0;
48488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48490         return ret_ref;
48491 }
48492
48493 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
48494         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
48495         int64_t ret_ref = 0;
48496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48498         return ret_ref;
48499 }
48500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48501         LDKNodeAnnouncementInfo arg_conv;
48502         arg_conv.inner = untag_ptr(arg);
48503         arg_conv.is_owned = ptr_is_owned(arg);
48504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48505         arg_conv.is_owned = false;
48506         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
48507         return ret_conv;
48508 }
48509
48510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48511         LDKNodeAnnouncementInfo orig_conv;
48512         orig_conv.inner = untag_ptr(orig);
48513         orig_conv.is_owned = ptr_is_owned(orig);
48514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48515         orig_conv.is_owned = false;
48516         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
48517         int64_t ret_ref = 0;
48518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48520         return ret_ref;
48521 }
48522
48523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48524         LDKNodeAnnouncementInfo a_conv;
48525         a_conv.inner = untag_ptr(a);
48526         a_conv.is_owned = ptr_is_owned(a);
48527         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48528         a_conv.is_owned = false;
48529         LDKNodeAnnouncementInfo b_conv;
48530         b_conv.inner = untag_ptr(b);
48531         b_conv.is_owned = ptr_is_owned(b);
48532         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48533         b_conv.is_owned = false;
48534         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
48535         return ret_conv;
48536 }
48537
48538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
48539         LDKNodeAnnouncementInfo obj_conv;
48540         obj_conv.inner = untag_ptr(obj);
48541         obj_conv.is_owned = ptr_is_owned(obj);
48542         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48543         obj_conv.is_owned = false;
48544         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
48545         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48546         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48547         CVec_u8Z_free(ret_var);
48548         return ret_arr;
48549 }
48550
48551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48552         LDKu8slice ser_ref;
48553         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48554         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48555         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
48556         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
48557         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48558         return tag_ptr(ret_conv, true);
48559 }
48560
48561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48562         LDKNodeAlias this_obj_conv;
48563         this_obj_conv.inner = untag_ptr(this_obj);
48564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48566         NodeAlias_free(this_obj_conv);
48567 }
48568
48569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
48570         LDKNodeAlias this_ptr_conv;
48571         this_ptr_conv.inner = untag_ptr(this_ptr);
48572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48574         this_ptr_conv.is_owned = false;
48575         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48576         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
48577         return ret_arr;
48578 }
48579
48580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48581         LDKNodeAlias this_ptr_conv;
48582         this_ptr_conv.inner = untag_ptr(this_ptr);
48583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48585         this_ptr_conv.is_owned = false;
48586         LDKThirtyTwoBytes val_ref;
48587         CHECK((*env)->GetArrayLength(env, val) == 32);
48588         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48589         NodeAlias_set_a(&this_ptr_conv, val_ref);
48590 }
48591
48592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
48593         LDKThirtyTwoBytes a_arg_ref;
48594         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
48595         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
48596         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
48597         int64_t ret_ref = 0;
48598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48600         return ret_ref;
48601 }
48602
48603 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
48604         LDKNodeAlias ret_var = NodeAlias_clone(arg);
48605         int64_t ret_ref = 0;
48606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48608         return ret_ref;
48609 }
48610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48611         LDKNodeAlias arg_conv;
48612         arg_conv.inner = untag_ptr(arg);
48613         arg_conv.is_owned = ptr_is_owned(arg);
48614         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48615         arg_conv.is_owned = false;
48616         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
48617         return ret_conv;
48618 }
48619
48620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48621         LDKNodeAlias orig_conv;
48622         orig_conv.inner = untag_ptr(orig);
48623         orig_conv.is_owned = ptr_is_owned(orig);
48624         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48625         orig_conv.is_owned = false;
48626         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
48627         int64_t ret_ref = 0;
48628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48630         return ret_ref;
48631 }
48632
48633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48634         LDKNodeAlias a_conv;
48635         a_conv.inner = untag_ptr(a);
48636         a_conv.is_owned = ptr_is_owned(a);
48637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48638         a_conv.is_owned = false;
48639         LDKNodeAlias b_conv;
48640         b_conv.inner = untag_ptr(b);
48641         b_conv.is_owned = ptr_is_owned(b);
48642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48643         b_conv.is_owned = false;
48644         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
48645         return ret_conv;
48646 }
48647
48648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
48649         LDKNodeAlias obj_conv;
48650         obj_conv.inner = untag_ptr(obj);
48651         obj_conv.is_owned = ptr_is_owned(obj);
48652         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48653         obj_conv.is_owned = false;
48654         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
48655         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48656         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48657         CVec_u8Z_free(ret_var);
48658         return ret_arr;
48659 }
48660
48661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48662         LDKu8slice ser_ref;
48663         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48664         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48665         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
48666         *ret_conv = NodeAlias_read(ser_ref);
48667         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48668         return tag_ptr(ret_conv, true);
48669 }
48670
48671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48672         LDKNodeInfo this_obj_conv;
48673         this_obj_conv.inner = untag_ptr(this_obj);
48674         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48676         NodeInfo_free(this_obj_conv);
48677 }
48678
48679 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
48680         LDKNodeInfo this_ptr_conv;
48681         this_ptr_conv.inner = untag_ptr(this_ptr);
48682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48684         this_ptr_conv.is_owned = false;
48685         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
48686         int64_tArray ret_arr = NULL;
48687         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48688         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48689         for (size_t g = 0; g < ret_var.datalen; g++) {
48690                 int64_t ret_conv_6_conv = ret_var.data[g];
48691                 ret_arr_ptr[g] = ret_conv_6_conv;
48692         }
48693         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48694         FREE(ret_var.data);
48695         return ret_arr;
48696 }
48697
48698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
48699         LDKNodeInfo this_ptr_conv;
48700         this_ptr_conv.inner = untag_ptr(this_ptr);
48701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48703         this_ptr_conv.is_owned = false;
48704         LDKCVec_u64Z val_constr;
48705         val_constr.datalen = (*env)->GetArrayLength(env, val);
48706         if (val_constr.datalen > 0)
48707                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
48708         else
48709                 val_constr.data = NULL;
48710         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
48711         for (size_t g = 0; g < val_constr.datalen; g++) {
48712                 int64_t val_conv_6 = val_vals[g];
48713                 val_constr.data[g] = val_conv_6;
48714         }
48715         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
48716         NodeInfo_set_channels(&this_ptr_conv, val_constr);
48717 }
48718
48719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
48720         LDKNodeInfo this_ptr_conv;
48721         this_ptr_conv.inner = untag_ptr(this_ptr);
48722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48724         this_ptr_conv.is_owned = false;
48725         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
48726         int64_t ret_ref = 0;
48727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48729         return ret_ref;
48730 }
48731
48732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48733         LDKNodeInfo this_ptr_conv;
48734         this_ptr_conv.inner = untag_ptr(this_ptr);
48735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48737         this_ptr_conv.is_owned = false;
48738         LDKNodeAnnouncementInfo val_conv;
48739         val_conv.inner = untag_ptr(val);
48740         val_conv.is_owned = ptr_is_owned(val);
48741         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48742         val_conv = NodeAnnouncementInfo_clone(&val_conv);
48743         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
48744 }
48745
48746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
48747         LDKCVec_u64Z channels_arg_constr;
48748         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
48749         if (channels_arg_constr.datalen > 0)
48750                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
48751         else
48752                 channels_arg_constr.data = NULL;
48753         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
48754         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
48755                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
48756                 channels_arg_constr.data[g] = channels_arg_conv_6;
48757         }
48758         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
48759         LDKNodeAnnouncementInfo announcement_info_arg_conv;
48760         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
48761         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
48762         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
48763         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
48764         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
48765         int64_t ret_ref = 0;
48766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48768         return ret_ref;
48769 }
48770
48771 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
48772         LDKNodeInfo ret_var = NodeInfo_clone(arg);
48773         int64_t ret_ref = 0;
48774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48776         return ret_ref;
48777 }
48778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48779         LDKNodeInfo arg_conv;
48780         arg_conv.inner = untag_ptr(arg);
48781         arg_conv.is_owned = ptr_is_owned(arg);
48782         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48783         arg_conv.is_owned = false;
48784         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
48785         return ret_conv;
48786 }
48787
48788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48789         LDKNodeInfo orig_conv;
48790         orig_conv.inner = untag_ptr(orig);
48791         orig_conv.is_owned = ptr_is_owned(orig);
48792         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48793         orig_conv.is_owned = false;
48794         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
48795         int64_t ret_ref = 0;
48796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48798         return ret_ref;
48799 }
48800
48801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48802         LDKNodeInfo a_conv;
48803         a_conv.inner = untag_ptr(a);
48804         a_conv.is_owned = ptr_is_owned(a);
48805         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48806         a_conv.is_owned = false;
48807         LDKNodeInfo b_conv;
48808         b_conv.inner = untag_ptr(b);
48809         b_conv.is_owned = ptr_is_owned(b);
48810         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48811         b_conv.is_owned = false;
48812         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
48813         return ret_conv;
48814 }
48815
48816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
48817         LDKNodeInfo 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 = NodeInfo_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_NodeInfo_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_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
48834         *ret_conv = NodeInfo_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_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
48840         LDKNetworkGraph 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 = NetworkGraph_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_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
48853         LDKu8slice ser_ref;
48854         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48855         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48856         void* arg_ptr = untag_ptr(arg);
48857         CHECK_ACCESS(arg_ptr);
48858         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
48859         if (arg_conv.free == LDKLogger_JCalls_free) {
48860                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48861                 LDKLogger_JCalls_cloned(&arg_conv);
48862         }
48863         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
48864         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
48865         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48866         return tag_ptr(ret_conv, true);
48867 }
48868
48869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
48870         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
48871         void* logger_ptr = untag_ptr(logger);
48872         CHECK_ACCESS(logger_ptr);
48873         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48874         if (logger_conv.free == LDKLogger_JCalls_free) {
48875                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48876                 LDKLogger_JCalls_cloned(&logger_conv);
48877         }
48878         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
48879         int64_t ret_ref = 0;
48880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48882         return ret_ref;
48883 }
48884
48885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
48886         LDKNetworkGraph this_arg_conv;
48887         this_arg_conv.inner = untag_ptr(this_arg);
48888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48890         this_arg_conv.is_owned = false;
48891         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
48892         int64_t ret_ref = 0;
48893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48895         return ret_ref;
48896 }
48897
48898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
48899         LDKNetworkGraph this_arg_conv;
48900         this_arg_conv.inner = untag_ptr(this_arg);
48901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48903         this_arg_conv.is_owned = false;
48904         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
48905         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
48906         int64_t ret_ref = tag_ptr(ret_copy, true);
48907         return ret_ref;
48908 }
48909
48910 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) {
48911         LDKNetworkGraph this_arg_conv;
48912         this_arg_conv.inner = untag_ptr(this_arg);
48913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48915         this_arg_conv.is_owned = false;
48916         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
48917 }
48918
48919 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) {
48920         LDKNetworkGraph this_arg_conv;
48921         this_arg_conv.inner = untag_ptr(this_arg);
48922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48924         this_arg_conv.is_owned = false;
48925         LDKNodeAnnouncement msg_conv;
48926         msg_conv.inner = untag_ptr(msg);
48927         msg_conv.is_owned = ptr_is_owned(msg);
48928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
48929         msg_conv.is_owned = false;
48930         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
48931         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
48932         return tag_ptr(ret_conv, true);
48933 }
48934
48935 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) {
48936         LDKNetworkGraph this_arg_conv;
48937         this_arg_conv.inner = untag_ptr(this_arg);
48938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48940         this_arg_conv.is_owned = false;
48941         LDKUnsignedNodeAnnouncement msg_conv;
48942         msg_conv.inner = untag_ptr(msg);
48943         msg_conv.is_owned = ptr_is_owned(msg);
48944         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
48945         msg_conv.is_owned = false;
48946         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
48947         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
48948         return tag_ptr(ret_conv, true);
48949 }
48950
48951 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) {
48952         LDKNetworkGraph this_arg_conv;
48953         this_arg_conv.inner = untag_ptr(this_arg);
48954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48956         this_arg_conv.is_owned = false;
48957         LDKChannelAnnouncement msg_conv;
48958         msg_conv.inner = untag_ptr(msg);
48959         msg_conv.is_owned = ptr_is_owned(msg);
48960         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
48961         msg_conv.is_owned = false;
48962         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
48963         CHECK_ACCESS(utxo_lookup_ptr);
48964         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
48965         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
48966         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
48967                 // Manually implement clone for Java trait instances
48968                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
48969                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48970                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
48971                 }
48972         }
48973         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
48974         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
48975         return tag_ptr(ret_conv, true);
48976 }
48977
48978 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) {
48979         LDKNetworkGraph this_arg_conv;
48980         this_arg_conv.inner = untag_ptr(this_arg);
48981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48983         this_arg_conv.is_owned = false;
48984         LDKUnsignedChannelAnnouncement msg_conv;
48985         msg_conv.inner = untag_ptr(msg);
48986         msg_conv.is_owned = ptr_is_owned(msg);
48987         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
48988         msg_conv.is_owned = false;
48989         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
48990         CHECK_ACCESS(utxo_lookup_ptr);
48991         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
48992         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
48993         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
48994                 // Manually implement clone for Java trait instances
48995                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
48996                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48997                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
48998                 }
48999         }
49000         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
49001         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
49002         return tag_ptr(ret_conv, true);
49003 }
49004
49005 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) {
49006         LDKNetworkGraph this_arg_conv;
49007         this_arg_conv.inner = untag_ptr(this_arg);
49008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49010         this_arg_conv.is_owned = false;
49011         LDKChannelFeatures features_conv;
49012         features_conv.inner = untag_ptr(features);
49013         features_conv.is_owned = ptr_is_owned(features);
49014         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
49015         features_conv = ChannelFeatures_clone(&features_conv);
49016         LDKPublicKey node_id_1_ref;
49017         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
49018         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
49019         LDKPublicKey node_id_2_ref;
49020         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
49021         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
49022         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
49023         *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);
49024         return tag_ptr(ret_conv, true);
49025 }
49026
49027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1channel_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
49028         LDKNetworkGraph this_arg_conv;
49029         this_arg_conv.inner = untag_ptr(this_arg);
49030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49032         this_arg_conv.is_owned = false;
49033         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
49034 }
49035
49036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
49037         LDKNetworkGraph this_arg_conv;
49038         this_arg_conv.inner = untag_ptr(this_arg);
49039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49041         this_arg_conv.is_owned = false;
49042         LDKPublicKey node_id_ref;
49043         CHECK((*env)->GetArrayLength(env, node_id) == 33);
49044         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
49045         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
49046 }
49047
49048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
49049         LDKNetworkGraph this_arg_conv;
49050         this_arg_conv.inner = untag_ptr(this_arg);
49051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49053         this_arg_conv.is_owned = false;
49054         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
49055 }
49056
49057 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) {
49058         LDKNetworkGraph this_arg_conv;
49059         this_arg_conv.inner = untag_ptr(this_arg);
49060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49062         this_arg_conv.is_owned = false;
49063         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
49064 }
49065
49066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
49067         LDKNetworkGraph this_arg_conv;
49068         this_arg_conv.inner = untag_ptr(this_arg);
49069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49071         this_arg_conv.is_owned = false;
49072         LDKChannelUpdate msg_conv;
49073         msg_conv.inner = untag_ptr(msg);
49074         msg_conv.is_owned = ptr_is_owned(msg);
49075         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49076         msg_conv.is_owned = false;
49077         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
49078         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
49079         return tag_ptr(ret_conv, true);
49080 }
49081
49082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
49083         LDKNetworkGraph this_arg_conv;
49084         this_arg_conv.inner = untag_ptr(this_arg);
49085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49087         this_arg_conv.is_owned = false;
49088         LDKUnsignedChannelUpdate msg_conv;
49089         msg_conv.inner = untag_ptr(msg);
49090         msg_conv.is_owned = ptr_is_owned(msg);
49091         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
49092         msg_conv.is_owned = false;
49093         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
49094         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
49095         return tag_ptr(ret_conv, true);
49096 }
49097
49098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
49099         LDKReadOnlyNetworkGraph this_arg_conv;
49100         this_arg_conv.inner = untag_ptr(this_arg);
49101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49103         this_arg_conv.is_owned = false;
49104         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
49105         int64_t ret_ref = 0;
49106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49108         return ret_ref;
49109 }
49110
49111 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
49112         LDKReadOnlyNetworkGraph this_arg_conv;
49113         this_arg_conv.inner = untag_ptr(this_arg);
49114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49116         this_arg_conv.is_owned = false;
49117         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
49118         int64_tArray ret_arr = NULL;
49119         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49120         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49121         for (size_t g = 0; g < ret_var.datalen; g++) {
49122                 int64_t ret_conv_6_conv = ret_var.data[g];
49123                 ret_arr_ptr[g] = ret_conv_6_conv;
49124         }
49125         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49126         FREE(ret_var.data);
49127         return ret_arr;
49128 }
49129
49130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
49131         LDKReadOnlyNetworkGraph this_arg_conv;
49132         this_arg_conv.inner = untag_ptr(this_arg);
49133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49135         this_arg_conv.is_owned = false;
49136         LDKNodeId node_id_conv;
49137         node_id_conv.inner = untag_ptr(node_id);
49138         node_id_conv.is_owned = ptr_is_owned(node_id);
49139         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
49140         node_id_conv.is_owned = false;
49141         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
49142         int64_t ret_ref = 0;
49143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49145         return ret_ref;
49146 }
49147
49148 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
49149         LDKReadOnlyNetworkGraph this_arg_conv;
49150         this_arg_conv.inner = untag_ptr(this_arg);
49151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49153         this_arg_conv.is_owned = false;
49154         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
49155         int64_tArray ret_arr = NULL;
49156         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49157         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49158         for (size_t i = 0; i < ret_var.datalen; i++) {
49159                 LDKNodeId ret_conv_8_var = ret_var.data[i];
49160                 int64_t ret_conv_8_ref = 0;
49161                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
49162                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
49163                 ret_arr_ptr[i] = ret_conv_8_ref;
49164         }
49165         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49166         FREE(ret_var.data);
49167         return ret_arr;
49168 }
49169
49170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
49171         LDKReadOnlyNetworkGraph this_arg_conv;
49172         this_arg_conv.inner = untag_ptr(this_arg);
49173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49175         this_arg_conv.is_owned = false;
49176         LDKPublicKey pubkey_ref;
49177         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
49178         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
49179         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
49180         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
49181         int64_t ret_ref = tag_ptr(ret_copy, true);
49182         return ret_ref;
49183 }
49184
49185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49186         LDKDefaultRouter this_obj_conv;
49187         this_obj_conv.inner = untag_ptr(this_obj);
49188         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49190         DefaultRouter_free(this_obj_conv);
49191 }
49192
49193 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) {
49194         LDKNetworkGraph network_graph_conv;
49195         network_graph_conv.inner = untag_ptr(network_graph);
49196         network_graph_conv.is_owned = ptr_is_owned(network_graph);
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
49198         network_graph_conv.is_owned = false;
49199         void* logger_ptr = untag_ptr(logger);
49200         CHECK_ACCESS(logger_ptr);
49201         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49202         if (logger_conv.free == LDKLogger_JCalls_free) {
49203                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49204                 LDKLogger_JCalls_cloned(&logger_conv);
49205         }
49206         LDKThirtyTwoBytes random_seed_bytes_ref;
49207         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
49208         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
49209         void* scorer_ptr = untag_ptr(scorer);
49210         CHECK_ACCESS(scorer_ptr);
49211         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
49212         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
49213                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49214                 LDKLockableScore_JCalls_cloned(&scorer_conv);
49215         }
49216         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
49217         int64_t ret_ref = 0;
49218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49220         return ret_ref;
49221 }
49222
49223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
49224         LDKDefaultRouter this_arg_conv;
49225         this_arg_conv.inner = untag_ptr(this_arg);
49226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49228         this_arg_conv.is_owned = false;
49229         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
49230         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
49231         return tag_ptr(ret_ret, true);
49232 }
49233
49234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49235         if (!ptr_is_owned(this_ptr)) return;
49236         void* this_ptr_ptr = untag_ptr(this_ptr);
49237         CHECK_ACCESS(this_ptr_ptr);
49238         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
49239         FREE(untag_ptr(this_ptr));
49240         Router_free(this_ptr_conv);
49241 }
49242
49243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49244         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
49245         this_obj_conv.inner = untag_ptr(this_obj);
49246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49248         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
49249 }
49250
49251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
49252         void* scorer_ptr = untag_ptr(scorer);
49253         CHECK_ACCESS(scorer_ptr);
49254         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
49255         if (scorer_conv.free == LDKScore_JCalls_free) {
49256                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49257                 LDKScore_JCalls_cloned(&scorer_conv);
49258         }
49259         LDKInFlightHtlcs inflight_htlcs_conv;
49260         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
49261         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
49263         inflight_htlcs_conv.is_owned = false;
49264         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
49265         int64_t ret_ref = 0;
49266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49268         return ret_ref;
49269 }
49270
49271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
49272         LDKScorerAccountingForInFlightHtlcs obj_conv;
49273         obj_conv.inner = untag_ptr(obj);
49274         obj_conv.is_owned = ptr_is_owned(obj);
49275         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49276         obj_conv.is_owned = false;
49277         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
49278         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49279         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49280         CVec_u8Z_free(ret_var);
49281         return ret_arr;
49282 }
49283
49284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
49285         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
49286         this_arg_conv.inner = untag_ptr(this_arg);
49287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49289         this_arg_conv.is_owned = false;
49290         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
49291         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
49292         return tag_ptr(ret_ret, true);
49293 }
49294
49295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49296         LDKInFlightHtlcs this_obj_conv;
49297         this_obj_conv.inner = untag_ptr(this_obj);
49298         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49300         InFlightHtlcs_free(this_obj_conv);
49301 }
49302
49303 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
49304         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
49305         int64_t ret_ref = 0;
49306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49308         return ret_ref;
49309 }
49310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49311         LDKInFlightHtlcs arg_conv;
49312         arg_conv.inner = untag_ptr(arg);
49313         arg_conv.is_owned = ptr_is_owned(arg);
49314         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49315         arg_conv.is_owned = false;
49316         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
49317         return ret_conv;
49318 }
49319
49320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49321         LDKInFlightHtlcs orig_conv;
49322         orig_conv.inner = untag_ptr(orig);
49323         orig_conv.is_owned = ptr_is_owned(orig);
49324         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49325         orig_conv.is_owned = false;
49326         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
49327         int64_t ret_ref = 0;
49328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49330         return ret_ref;
49331 }
49332
49333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
49334         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
49335         int64_t ret_ref = 0;
49336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49338         return ret_ref;
49339 }
49340
49341 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) {
49342         LDKInFlightHtlcs this_arg_conv;
49343         this_arg_conv.inner = untag_ptr(this_arg);
49344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49346         this_arg_conv.is_owned = false;
49347         LDKNodeId source_conv;
49348         source_conv.inner = untag_ptr(source);
49349         source_conv.is_owned = ptr_is_owned(source);
49350         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
49351         source_conv.is_owned = false;
49352         LDKNodeId target_conv;
49353         target_conv.inner = untag_ptr(target);
49354         target_conv.is_owned = ptr_is_owned(target);
49355         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
49356         target_conv.is_owned = false;
49357         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49358         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
49359         int64_t ret_ref = tag_ptr(ret_copy, true);
49360         return ret_ref;
49361 }
49362
49363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
49364         LDKInFlightHtlcs obj_conv;
49365         obj_conv.inner = untag_ptr(obj);
49366         obj_conv.is_owned = ptr_is_owned(obj);
49367         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49368         obj_conv.is_owned = false;
49369         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
49370         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49371         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49372         CVec_u8Z_free(ret_var);
49373         return ret_arr;
49374 }
49375
49376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49377         LDKu8slice ser_ref;
49378         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49379         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49380         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
49381         *ret_conv = InFlightHtlcs_read(ser_ref);
49382         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49383         return tag_ptr(ret_conv, true);
49384 }
49385
49386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49387         LDKRouteHop this_obj_conv;
49388         this_obj_conv.inner = untag_ptr(this_obj);
49389         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49391         RouteHop_free(this_obj_conv);
49392 }
49393
49394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
49395         LDKRouteHop this_ptr_conv;
49396         this_ptr_conv.inner = untag_ptr(this_ptr);
49397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49399         this_ptr_conv.is_owned = false;
49400         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49401         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
49402         return ret_arr;
49403 }
49404
49405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49406         LDKRouteHop this_ptr_conv;
49407         this_ptr_conv.inner = untag_ptr(this_ptr);
49408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49410         this_ptr_conv.is_owned = false;
49411         LDKPublicKey val_ref;
49412         CHECK((*env)->GetArrayLength(env, val) == 33);
49413         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49414         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
49415 }
49416
49417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
49418         LDKRouteHop this_ptr_conv;
49419         this_ptr_conv.inner = untag_ptr(this_ptr);
49420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49422         this_ptr_conv.is_owned = false;
49423         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
49424         int64_t ret_ref = 0;
49425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49427         return ret_ref;
49428 }
49429
49430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49431         LDKRouteHop this_ptr_conv;
49432         this_ptr_conv.inner = untag_ptr(this_ptr);
49433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49435         this_ptr_conv.is_owned = false;
49436         LDKNodeFeatures val_conv;
49437         val_conv.inner = untag_ptr(val);
49438         val_conv.is_owned = ptr_is_owned(val);
49439         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49440         val_conv = NodeFeatures_clone(&val_conv);
49441         RouteHop_set_node_features(&this_ptr_conv, val_conv);
49442 }
49443
49444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49445         LDKRouteHop this_ptr_conv;
49446         this_ptr_conv.inner = untag_ptr(this_ptr);
49447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49449         this_ptr_conv.is_owned = false;
49450         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
49451         return ret_conv;
49452 }
49453
49454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49455         LDKRouteHop this_ptr_conv;
49456         this_ptr_conv.inner = untag_ptr(this_ptr);
49457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49459         this_ptr_conv.is_owned = false;
49460         RouteHop_set_short_channel_id(&this_ptr_conv, val);
49461 }
49462
49463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
49464         LDKRouteHop this_ptr_conv;
49465         this_ptr_conv.inner = untag_ptr(this_ptr);
49466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49468         this_ptr_conv.is_owned = false;
49469         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
49470         int64_t ret_ref = 0;
49471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49473         return ret_ref;
49474 }
49475
49476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49477         LDKRouteHop this_ptr_conv;
49478         this_ptr_conv.inner = untag_ptr(this_ptr);
49479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49481         this_ptr_conv.is_owned = false;
49482         LDKChannelFeatures val_conv;
49483         val_conv.inner = untag_ptr(val);
49484         val_conv.is_owned = ptr_is_owned(val);
49485         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49486         val_conv = ChannelFeatures_clone(&val_conv);
49487         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
49488 }
49489
49490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49491         LDKRouteHop this_ptr_conv;
49492         this_ptr_conv.inner = untag_ptr(this_ptr);
49493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49495         this_ptr_conv.is_owned = false;
49496         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
49497         return ret_conv;
49498 }
49499
49500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49501         LDKRouteHop this_ptr_conv;
49502         this_ptr_conv.inner = untag_ptr(this_ptr);
49503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49505         this_ptr_conv.is_owned = false;
49506         RouteHop_set_fee_msat(&this_ptr_conv, val);
49507 }
49508
49509 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
49510         LDKRouteHop this_ptr_conv;
49511         this_ptr_conv.inner = untag_ptr(this_ptr);
49512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49514         this_ptr_conv.is_owned = false;
49515         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
49516         return ret_conv;
49517 }
49518
49519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49520         LDKRouteHop this_ptr_conv;
49521         this_ptr_conv.inner = untag_ptr(this_ptr);
49522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49524         this_ptr_conv.is_owned = false;
49525         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
49526 }
49527
49528 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) {
49529         LDKPublicKey pubkey_arg_ref;
49530         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
49531         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
49532         LDKNodeFeatures node_features_arg_conv;
49533         node_features_arg_conv.inner = untag_ptr(node_features_arg);
49534         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
49535         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
49536         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
49537         LDKChannelFeatures channel_features_arg_conv;
49538         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
49539         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
49540         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
49541         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
49542         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);
49543         int64_t ret_ref = 0;
49544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49546         return ret_ref;
49547 }
49548
49549 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
49550         LDKRouteHop ret_var = RouteHop_clone(arg);
49551         int64_t ret_ref = 0;
49552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49554         return ret_ref;
49555 }
49556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49557         LDKRouteHop arg_conv;
49558         arg_conv.inner = untag_ptr(arg);
49559         arg_conv.is_owned = ptr_is_owned(arg);
49560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49561         arg_conv.is_owned = false;
49562         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
49563         return ret_conv;
49564 }
49565
49566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49567         LDKRouteHop orig_conv;
49568         orig_conv.inner = untag_ptr(orig);
49569         orig_conv.is_owned = ptr_is_owned(orig);
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49571         orig_conv.is_owned = false;
49572         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
49573         int64_t ret_ref = 0;
49574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49576         return ret_ref;
49577 }
49578
49579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
49580         LDKRouteHop o_conv;
49581         o_conv.inner = untag_ptr(o);
49582         o_conv.is_owned = ptr_is_owned(o);
49583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49584         o_conv.is_owned = false;
49585         int64_t ret_conv = RouteHop_hash(&o_conv);
49586         return ret_conv;
49587 }
49588
49589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49590         LDKRouteHop a_conv;
49591         a_conv.inner = untag_ptr(a);
49592         a_conv.is_owned = ptr_is_owned(a);
49593         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49594         a_conv.is_owned = false;
49595         LDKRouteHop b_conv;
49596         b_conv.inner = untag_ptr(b);
49597         b_conv.is_owned = ptr_is_owned(b);
49598         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49599         b_conv.is_owned = false;
49600         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
49601         return ret_conv;
49602 }
49603
49604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
49605         LDKRouteHop obj_conv;
49606         obj_conv.inner = untag_ptr(obj);
49607         obj_conv.is_owned = ptr_is_owned(obj);
49608         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49609         obj_conv.is_owned = false;
49610         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
49611         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49612         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49613         CVec_u8Z_free(ret_var);
49614         return ret_arr;
49615 }
49616
49617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49618         LDKu8slice ser_ref;
49619         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49620         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49621         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
49622         *ret_conv = RouteHop_read(ser_ref);
49623         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49624         return tag_ptr(ret_conv, true);
49625 }
49626
49627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49628         LDKRoute this_obj_conv;
49629         this_obj_conv.inner = untag_ptr(this_obj);
49630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49632         Route_free(this_obj_conv);
49633 }
49634
49635 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
49636         LDKRoute this_ptr_conv;
49637         this_ptr_conv.inner = untag_ptr(this_ptr);
49638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49640         this_ptr_conv.is_owned = false;
49641         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
49642         jobjectArray ret_arr = NULL;
49643         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
49644         ;
49645         for (size_t m = 0; m < ret_var.datalen; m++) {
49646                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
49647                 int64_tArray ret_conv_12_arr = NULL;
49648                 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
49649                 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
49650                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
49651                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
49652                         int64_t ret_conv_12_conv_10_ref = 0;
49653                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
49654                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
49655                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
49656                 }
49657                 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
49658                 FREE(ret_conv_12_var.data);
49659                 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
49660         }
49661         
49662         FREE(ret_var.data);
49663         return ret_arr;
49664 }
49665
49666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
49667         LDKRoute this_ptr_conv;
49668         this_ptr_conv.inner = untag_ptr(this_ptr);
49669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49671         this_ptr_conv.is_owned = false;
49672         LDKCVec_CVec_RouteHopZZ val_constr;
49673         val_constr.datalen = (*env)->GetArrayLength(env, val);
49674         if (val_constr.datalen > 0)
49675                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
49676         else
49677                 val_constr.data = NULL;
49678         for (size_t m = 0; m < val_constr.datalen; m++) {
49679                 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
49680                 LDKCVec_RouteHopZ val_conv_12_constr;
49681                 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
49682                 if (val_conv_12_constr.datalen > 0)
49683                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
49684                 else
49685                         val_conv_12_constr.data = NULL;
49686                 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
49687                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
49688                         int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
49689                         LDKRouteHop val_conv_12_conv_10_conv;
49690                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
49691                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
49692                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
49693                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
49694                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
49695                 }
49696                 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
49697                 val_constr.data[m] = val_conv_12_constr;
49698         }
49699         Route_set_paths(&this_ptr_conv, val_constr);
49700 }
49701
49702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
49703         LDKRoute this_ptr_conv;
49704         this_ptr_conv.inner = untag_ptr(this_ptr);
49705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49707         this_ptr_conv.is_owned = false;
49708         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
49709         int64_t ret_ref = 0;
49710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49712         return ret_ref;
49713 }
49714
49715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49716         LDKRoute this_ptr_conv;
49717         this_ptr_conv.inner = untag_ptr(this_ptr);
49718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49720         this_ptr_conv.is_owned = false;
49721         LDKPaymentParameters val_conv;
49722         val_conv.inner = untag_ptr(val);
49723         val_conv.is_owned = ptr_is_owned(val);
49724         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49725         val_conv = PaymentParameters_clone(&val_conv);
49726         Route_set_payment_params(&this_ptr_conv, val_conv);
49727 }
49728
49729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
49730         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
49731         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
49732         if (paths_arg_constr.datalen > 0)
49733                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
49734         else
49735                 paths_arg_constr.data = NULL;
49736         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
49737                 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
49738                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
49739                 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
49740                 if (paths_arg_conv_12_constr.datalen > 0)
49741                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
49742                 else
49743                         paths_arg_conv_12_constr.data = NULL;
49744                 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
49745                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
49746                         int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
49747                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
49748                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
49749                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
49750                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
49751                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
49752                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
49753                 }
49754                 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
49755                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
49756         }
49757         LDKPaymentParameters payment_params_arg_conv;
49758         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
49759         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
49760         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
49761         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
49762         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
49763         int64_t ret_ref = 0;
49764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49766         return ret_ref;
49767 }
49768
49769 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
49770         LDKRoute ret_var = Route_clone(arg);
49771         int64_t ret_ref = 0;
49772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49774         return ret_ref;
49775 }
49776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49777         LDKRoute arg_conv;
49778         arg_conv.inner = untag_ptr(arg);
49779         arg_conv.is_owned = ptr_is_owned(arg);
49780         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49781         arg_conv.is_owned = false;
49782         int64_t ret_conv = Route_clone_ptr(&arg_conv);
49783         return ret_conv;
49784 }
49785
49786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49787         LDKRoute orig_conv;
49788         orig_conv.inner = untag_ptr(orig);
49789         orig_conv.is_owned = ptr_is_owned(orig);
49790         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49791         orig_conv.is_owned = false;
49792         LDKRoute ret_var = Route_clone(&orig_conv);
49793         int64_t ret_ref = 0;
49794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49796         return ret_ref;
49797 }
49798
49799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
49800         LDKRoute o_conv;
49801         o_conv.inner = untag_ptr(o);
49802         o_conv.is_owned = ptr_is_owned(o);
49803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49804         o_conv.is_owned = false;
49805         int64_t ret_conv = Route_hash(&o_conv);
49806         return ret_conv;
49807 }
49808
49809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49810         LDKRoute a_conv;
49811         a_conv.inner = untag_ptr(a);
49812         a_conv.is_owned = ptr_is_owned(a);
49813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49814         a_conv.is_owned = false;
49815         LDKRoute b_conv;
49816         b_conv.inner = untag_ptr(b);
49817         b_conv.is_owned = ptr_is_owned(b);
49818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49819         b_conv.is_owned = false;
49820         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
49821         return ret_conv;
49822 }
49823
49824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
49825         LDKRoute this_arg_conv;
49826         this_arg_conv.inner = untag_ptr(this_arg);
49827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49829         this_arg_conv.is_owned = false;
49830         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
49831         return ret_conv;
49832 }
49833
49834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
49835         LDKRoute this_arg_conv;
49836         this_arg_conv.inner = untag_ptr(this_arg);
49837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49839         this_arg_conv.is_owned = false;
49840         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
49841         return ret_conv;
49842 }
49843
49844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
49845         LDKRoute obj_conv;
49846         obj_conv.inner = untag_ptr(obj);
49847         obj_conv.is_owned = ptr_is_owned(obj);
49848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49849         obj_conv.is_owned = false;
49850         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
49851         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49852         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49853         CVec_u8Z_free(ret_var);
49854         return ret_arr;
49855 }
49856
49857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49858         LDKu8slice ser_ref;
49859         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49860         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49861         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
49862         *ret_conv = Route_read(ser_ref);
49863         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49864         return tag_ptr(ret_conv, true);
49865 }
49866
49867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49868         LDKRouteParameters this_obj_conv;
49869         this_obj_conv.inner = untag_ptr(this_obj);
49870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49872         RouteParameters_free(this_obj_conv);
49873 }
49874
49875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
49876         LDKRouteParameters this_ptr_conv;
49877         this_ptr_conv.inner = untag_ptr(this_ptr);
49878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49880         this_ptr_conv.is_owned = false;
49881         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
49882         int64_t ret_ref = 0;
49883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49885         return ret_ref;
49886 }
49887
49888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49889         LDKRouteParameters this_ptr_conv;
49890         this_ptr_conv.inner = untag_ptr(this_ptr);
49891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49893         this_ptr_conv.is_owned = false;
49894         LDKPaymentParameters val_conv;
49895         val_conv.inner = untag_ptr(val);
49896         val_conv.is_owned = ptr_is_owned(val);
49897         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49898         val_conv = PaymentParameters_clone(&val_conv);
49899         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
49900 }
49901
49902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49903         LDKRouteParameters this_ptr_conv;
49904         this_ptr_conv.inner = untag_ptr(this_ptr);
49905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49907         this_ptr_conv.is_owned = false;
49908         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
49909         return ret_conv;
49910 }
49911
49912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49913         LDKRouteParameters this_ptr_conv;
49914         this_ptr_conv.inner = untag_ptr(this_ptr);
49915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49917         this_ptr_conv.is_owned = false;
49918         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
49919 }
49920
49921 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) {
49922         LDKPaymentParameters payment_params_arg_conv;
49923         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
49924         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
49925         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
49926         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
49927         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
49928         int64_t ret_ref = 0;
49929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49931         return ret_ref;
49932 }
49933
49934 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
49935         LDKRouteParameters ret_var = RouteParameters_clone(arg);
49936         int64_t ret_ref = 0;
49937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49939         return ret_ref;
49940 }
49941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49942         LDKRouteParameters arg_conv;
49943         arg_conv.inner = untag_ptr(arg);
49944         arg_conv.is_owned = ptr_is_owned(arg);
49945         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49946         arg_conv.is_owned = false;
49947         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
49948         return ret_conv;
49949 }
49950
49951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49952         LDKRouteParameters orig_conv;
49953         orig_conv.inner = untag_ptr(orig);
49954         orig_conv.is_owned = ptr_is_owned(orig);
49955         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49956         orig_conv.is_owned = false;
49957         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
49958         int64_t ret_ref = 0;
49959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49961         return ret_ref;
49962 }
49963
49964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49965         LDKRouteParameters a_conv;
49966         a_conv.inner = untag_ptr(a);
49967         a_conv.is_owned = ptr_is_owned(a);
49968         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49969         a_conv.is_owned = false;
49970         LDKRouteParameters b_conv;
49971         b_conv.inner = untag_ptr(b);
49972         b_conv.is_owned = ptr_is_owned(b);
49973         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49974         b_conv.is_owned = false;
49975         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
49976         return ret_conv;
49977 }
49978
49979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
49980         LDKRouteParameters obj_conv;
49981         obj_conv.inner = untag_ptr(obj);
49982         obj_conv.is_owned = ptr_is_owned(obj);
49983         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49984         obj_conv.is_owned = false;
49985         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
49986         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49987         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49988         CVec_u8Z_free(ret_var);
49989         return ret_arr;
49990 }
49991
49992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49993         LDKu8slice ser_ref;
49994         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49995         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49996         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
49997         *ret_conv = RouteParameters_read(ser_ref);
49998         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49999         return tag_ptr(ret_conv, true);
50000 }
50001
50002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50003         LDKPaymentParameters this_obj_conv;
50004         this_obj_conv.inner = untag_ptr(this_obj);
50005         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50007         PaymentParameters_free(this_obj_conv);
50008 }
50009
50010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
50011         LDKPaymentParameters 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, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
50018         return ret_arr;
50019 }
50020
50021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50022         LDKPaymentParameters 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         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
50031 }
50032
50033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
50034         LDKPaymentParameters 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         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
50040         int64_t ret_ref = 0;
50041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50043         return ret_ref;
50044 }
50045
50046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50047         LDKPaymentParameters this_ptr_conv;
50048         this_ptr_conv.inner = untag_ptr(this_ptr);
50049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50051         this_ptr_conv.is_owned = false;
50052         LDKInvoiceFeatures val_conv;
50053         val_conv.inner = untag_ptr(val);
50054         val_conv.is_owned = ptr_is_owned(val);
50055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50056         val_conv = InvoiceFeatures_clone(&val_conv);
50057         PaymentParameters_set_features(&this_ptr_conv, val_conv);
50058 }
50059
50060 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
50061         LDKPaymentParameters this_ptr_conv;
50062         this_ptr_conv.inner = untag_ptr(this_ptr);
50063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50065         this_ptr_conv.is_owned = false;
50066         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
50067         int64_tArray ret_arr = NULL;
50068         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50069         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50070         for (size_t l = 0; l < ret_var.datalen; l++) {
50071                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
50072                 int64_t ret_conv_11_ref = 0;
50073                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
50074                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
50075                 ret_arr_ptr[l] = ret_conv_11_ref;
50076         }
50077         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50078         FREE(ret_var.data);
50079         return ret_arr;
50080 }
50081
50082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50083         LDKPaymentParameters this_ptr_conv;
50084         this_ptr_conv.inner = untag_ptr(this_ptr);
50085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50087         this_ptr_conv.is_owned = false;
50088         LDKCVec_RouteHintZ val_constr;
50089         val_constr.datalen = (*env)->GetArrayLength(env, val);
50090         if (val_constr.datalen > 0)
50091                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
50092         else
50093                 val_constr.data = NULL;
50094         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50095         for (size_t l = 0; l < val_constr.datalen; l++) {
50096                 int64_t val_conv_11 = val_vals[l];
50097                 LDKRouteHint val_conv_11_conv;
50098                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
50099                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
50100                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
50101                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
50102                 val_constr.data[l] = val_conv_11_conv;
50103         }
50104         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50105         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
50106 }
50107
50108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
50109         LDKPaymentParameters this_ptr_conv;
50110         this_ptr_conv.inner = untag_ptr(this_ptr);
50111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50113         this_ptr_conv.is_owned = false;
50114         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50115         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
50116         int64_t ret_ref = tag_ptr(ret_copy, true);
50117         return ret_ref;
50118 }
50119
50120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50121         LDKPaymentParameters this_ptr_conv;
50122         this_ptr_conv.inner = untag_ptr(this_ptr);
50123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50125         this_ptr_conv.is_owned = false;
50126         void* val_ptr = untag_ptr(val);
50127         CHECK_ACCESS(val_ptr);
50128         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50129         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50130         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
50131 }
50132
50133 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
50134         LDKPaymentParameters this_ptr_conv;
50135         this_ptr_conv.inner = untag_ptr(this_ptr);
50136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50138         this_ptr_conv.is_owned = false;
50139         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
50140         return ret_conv;
50141 }
50142
50143 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) {
50144         LDKPaymentParameters this_ptr_conv;
50145         this_ptr_conv.inner = untag_ptr(this_ptr);
50146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50148         this_ptr_conv.is_owned = false;
50149         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
50150 }
50151
50152 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
50153         LDKPaymentParameters this_ptr_conv;
50154         this_ptr_conv.inner = untag_ptr(this_ptr);
50155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50157         this_ptr_conv.is_owned = false;
50158         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
50159         return ret_conv;
50160 }
50161
50162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
50163         LDKPaymentParameters this_ptr_conv;
50164         this_ptr_conv.inner = untag_ptr(this_ptr);
50165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50167         this_ptr_conv.is_owned = false;
50168         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
50169 }
50170
50171 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) {
50172         LDKPaymentParameters this_ptr_conv;
50173         this_ptr_conv.inner = untag_ptr(this_ptr);
50174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50176         this_ptr_conv.is_owned = false;
50177         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
50178         return ret_conv;
50179 }
50180
50181 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) {
50182         LDKPaymentParameters this_ptr_conv;
50183         this_ptr_conv.inner = untag_ptr(this_ptr);
50184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50186         this_ptr_conv.is_owned = false;
50187         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
50188 }
50189
50190 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
50191         LDKPaymentParameters this_ptr_conv;
50192         this_ptr_conv.inner = untag_ptr(this_ptr);
50193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50195         this_ptr_conv.is_owned = false;
50196         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
50197         int64_tArray ret_arr = NULL;
50198         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50199         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50200         for (size_t g = 0; g < ret_var.datalen; g++) {
50201                 int64_t ret_conv_6_conv = ret_var.data[g];
50202                 ret_arr_ptr[g] = ret_conv_6_conv;
50203         }
50204         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50205         FREE(ret_var.data);
50206         return ret_arr;
50207 }
50208
50209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50210         LDKPaymentParameters this_ptr_conv;
50211         this_ptr_conv.inner = untag_ptr(this_ptr);
50212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50214         this_ptr_conv.is_owned = false;
50215         LDKCVec_u64Z val_constr;
50216         val_constr.datalen = (*env)->GetArrayLength(env, val);
50217         if (val_constr.datalen > 0)
50218                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
50219         else
50220                 val_constr.data = NULL;
50221         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50222         for (size_t g = 0; g < val_constr.datalen; g++) {
50223                 int64_t val_conv_6 = val_vals[g];
50224                 val_constr.data[g] = val_conv_6;
50225         }
50226         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50227         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
50228 }
50229
50230 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
50231         LDKPaymentParameters this_ptr_conv;
50232         this_ptr_conv.inner = untag_ptr(this_ptr);
50233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50235         this_ptr_conv.is_owned = false;
50236         int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
50237         return ret_conv;
50238 }
50239
50240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50241         LDKPaymentParameters this_ptr_conv;
50242         this_ptr_conv.inner = untag_ptr(this_ptr);
50243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50245         this_ptr_conv.is_owned = false;
50246         PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
50247 }
50248
50249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_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, int32_t final_cltv_expiry_delta_arg) {
50250         LDKPublicKey payee_pubkey_arg_ref;
50251         CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
50252         (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
50253         LDKInvoiceFeatures features_arg_conv;
50254         features_arg_conv.inner = untag_ptr(features_arg);
50255         features_arg_conv.is_owned = ptr_is_owned(features_arg);
50256         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
50257         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
50258         LDKCVec_RouteHintZ route_hints_arg_constr;
50259         route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
50260         if (route_hints_arg_constr.datalen > 0)
50261                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
50262         else
50263                 route_hints_arg_constr.data = NULL;
50264         int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
50265         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
50266                 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
50267                 LDKRouteHint route_hints_arg_conv_11_conv;
50268                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
50269                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
50270                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
50271                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
50272                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
50273         }
50274         (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
50275         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
50276         CHECK_ACCESS(expiry_time_arg_ptr);
50277         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
50278         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
50279         LDKCVec_u64Z previously_failed_channels_arg_constr;
50280         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
50281         if (previously_failed_channels_arg_constr.datalen > 0)
50282                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
50283         else
50284                 previously_failed_channels_arg_constr.data = NULL;
50285         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
50286         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
50287                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
50288                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
50289         }
50290         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
50291         LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, 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, final_cltv_expiry_delta_arg);
50292         int64_t ret_ref = 0;
50293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50295         return ret_ref;
50296 }
50297
50298 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
50299         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
50300         int64_t ret_ref = 0;
50301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50303         return ret_ref;
50304 }
50305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50306         LDKPaymentParameters arg_conv;
50307         arg_conv.inner = untag_ptr(arg);
50308         arg_conv.is_owned = ptr_is_owned(arg);
50309         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50310         arg_conv.is_owned = false;
50311         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
50312         return ret_conv;
50313 }
50314
50315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50316         LDKPaymentParameters orig_conv;
50317         orig_conv.inner = untag_ptr(orig);
50318         orig_conv.is_owned = ptr_is_owned(orig);
50319         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50320         orig_conv.is_owned = false;
50321         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
50322         int64_t ret_ref = 0;
50323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50325         return ret_ref;
50326 }
50327
50328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
50329         LDKPaymentParameters o_conv;
50330         o_conv.inner = untag_ptr(o);
50331         o_conv.is_owned = ptr_is_owned(o);
50332         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50333         o_conv.is_owned = false;
50334         int64_t ret_conv = PaymentParameters_hash(&o_conv);
50335         return ret_conv;
50336 }
50337
50338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50339         LDKPaymentParameters a_conv;
50340         a_conv.inner = untag_ptr(a);
50341         a_conv.is_owned = ptr_is_owned(a);
50342         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50343         a_conv.is_owned = false;
50344         LDKPaymentParameters b_conv;
50345         b_conv.inner = untag_ptr(b);
50346         b_conv.is_owned = ptr_is_owned(b);
50347         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50348         b_conv.is_owned = false;
50349         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
50350         return ret_conv;
50351 }
50352
50353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
50354         LDKPaymentParameters obj_conv;
50355         obj_conv.inner = untag_ptr(obj);
50356         obj_conv.is_owned = ptr_is_owned(obj);
50357         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50358         obj_conv.is_owned = false;
50359         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
50360         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50361         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50362         CVec_u8Z_free(ret_var);
50363         return ret_arr;
50364 }
50365
50366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
50367         LDKu8slice ser_ref;
50368         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50369         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50370         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
50371         *ret_conv = PaymentParameters_read(ser_ref, arg);
50372         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50373         return tag_ptr(ret_conv, true);
50374 }
50375
50376 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) {
50377         LDKPublicKey payee_pubkey_ref;
50378         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
50379         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
50380         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
50381         int64_t ret_ref = 0;
50382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50384         return ret_ref;
50385 }
50386
50387 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) {
50388         LDKPublicKey payee_pubkey_ref;
50389         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
50390         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
50391         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
50392         int64_t ret_ref = 0;
50393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50395         return ret_ref;
50396 }
50397
50398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50399         LDKRouteHint this_obj_conv;
50400         this_obj_conv.inner = untag_ptr(this_obj);
50401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50403         RouteHint_free(this_obj_conv);
50404 }
50405
50406 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
50407         LDKRouteHint this_ptr_conv;
50408         this_ptr_conv.inner = untag_ptr(this_ptr);
50409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50411         this_ptr_conv.is_owned = false;
50412         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
50413         int64_tArray ret_arr = NULL;
50414         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50415         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50416         for (size_t o = 0; o < ret_var.datalen; o++) {
50417                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
50418                 int64_t ret_conv_14_ref = 0;
50419                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
50420                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
50421                 ret_arr_ptr[o] = ret_conv_14_ref;
50422         }
50423         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50424         FREE(ret_var.data);
50425         return ret_arr;
50426 }
50427
50428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50429         LDKRouteHint this_ptr_conv;
50430         this_ptr_conv.inner = untag_ptr(this_ptr);
50431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50433         this_ptr_conv.is_owned = false;
50434         LDKCVec_RouteHintHopZ val_constr;
50435         val_constr.datalen = (*env)->GetArrayLength(env, val);
50436         if (val_constr.datalen > 0)
50437                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
50438         else
50439                 val_constr.data = NULL;
50440         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50441         for (size_t o = 0; o < val_constr.datalen; o++) {
50442                 int64_t val_conv_14 = val_vals[o];
50443                 LDKRouteHintHop val_conv_14_conv;
50444                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
50445                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
50446                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
50447                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
50448                 val_constr.data[o] = val_conv_14_conv;
50449         }
50450         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50451         RouteHint_set_a(&this_ptr_conv, val_constr);
50452 }
50453
50454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
50455         LDKCVec_RouteHintHopZ a_arg_constr;
50456         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
50457         if (a_arg_constr.datalen > 0)
50458                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
50459         else
50460                 a_arg_constr.data = NULL;
50461         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
50462         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
50463                 int64_t a_arg_conv_14 = a_arg_vals[o];
50464                 LDKRouteHintHop a_arg_conv_14_conv;
50465                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
50466                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
50467                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
50468                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
50469                 a_arg_constr.data[o] = a_arg_conv_14_conv;
50470         }
50471         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
50472         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
50473         int64_t ret_ref = 0;
50474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50476         return ret_ref;
50477 }
50478
50479 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
50480         LDKRouteHint ret_var = RouteHint_clone(arg);
50481         int64_t ret_ref = 0;
50482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50484         return ret_ref;
50485 }
50486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50487         LDKRouteHint arg_conv;
50488         arg_conv.inner = untag_ptr(arg);
50489         arg_conv.is_owned = ptr_is_owned(arg);
50490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50491         arg_conv.is_owned = false;
50492         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
50493         return ret_conv;
50494 }
50495
50496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50497         LDKRouteHint orig_conv;
50498         orig_conv.inner = untag_ptr(orig);
50499         orig_conv.is_owned = ptr_is_owned(orig);
50500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50501         orig_conv.is_owned = false;
50502         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
50503         int64_t ret_ref = 0;
50504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50506         return ret_ref;
50507 }
50508
50509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
50510         LDKRouteHint o_conv;
50511         o_conv.inner = untag_ptr(o);
50512         o_conv.is_owned = ptr_is_owned(o);
50513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50514         o_conv.is_owned = false;
50515         int64_t ret_conv = RouteHint_hash(&o_conv);
50516         return ret_conv;
50517 }
50518
50519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50520         LDKRouteHint a_conv;
50521         a_conv.inner = untag_ptr(a);
50522         a_conv.is_owned = ptr_is_owned(a);
50523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50524         a_conv.is_owned = false;
50525         LDKRouteHint b_conv;
50526         b_conv.inner = untag_ptr(b);
50527         b_conv.is_owned = ptr_is_owned(b);
50528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50529         b_conv.is_owned = false;
50530         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
50531         return ret_conv;
50532 }
50533
50534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
50535         LDKRouteHint obj_conv;
50536         obj_conv.inner = untag_ptr(obj);
50537         obj_conv.is_owned = ptr_is_owned(obj);
50538         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50539         obj_conv.is_owned = false;
50540         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
50541         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50542         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50543         CVec_u8Z_free(ret_var);
50544         return ret_arr;
50545 }
50546
50547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50548         LDKu8slice ser_ref;
50549         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50550         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50551         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
50552         *ret_conv = RouteHint_read(ser_ref);
50553         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50554         return tag_ptr(ret_conv, true);
50555 }
50556
50557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50558         LDKRouteHintHop this_obj_conv;
50559         this_obj_conv.inner = untag_ptr(this_obj);
50560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50562         RouteHintHop_free(this_obj_conv);
50563 }
50564
50565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50566         LDKRouteHintHop this_ptr_conv;
50567         this_ptr_conv.inner = untag_ptr(this_ptr);
50568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50570         this_ptr_conv.is_owned = false;
50571         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50572         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
50573         return ret_arr;
50574 }
50575
50576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50577         LDKRouteHintHop this_ptr_conv;
50578         this_ptr_conv.inner = untag_ptr(this_ptr);
50579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50581         this_ptr_conv.is_owned = false;
50582         LDKPublicKey val_ref;
50583         CHECK((*env)->GetArrayLength(env, val) == 33);
50584         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50585         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
50586 }
50587
50588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50589         LDKRouteHintHop this_ptr_conv;
50590         this_ptr_conv.inner = untag_ptr(this_ptr);
50591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50593         this_ptr_conv.is_owned = false;
50594         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
50595         return ret_conv;
50596 }
50597
50598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50599         LDKRouteHintHop this_ptr_conv;
50600         this_ptr_conv.inner = untag_ptr(this_ptr);
50601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50603         this_ptr_conv.is_owned = false;
50604         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
50605 }
50606
50607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
50608         LDKRouteHintHop this_ptr_conv;
50609         this_ptr_conv.inner = untag_ptr(this_ptr);
50610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50612         this_ptr_conv.is_owned = false;
50613         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
50614         int64_t ret_ref = 0;
50615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50617         return ret_ref;
50618 }
50619
50620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50621         LDKRouteHintHop this_ptr_conv;
50622         this_ptr_conv.inner = untag_ptr(this_ptr);
50623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50625         this_ptr_conv.is_owned = false;
50626         LDKRoutingFees val_conv;
50627         val_conv.inner = untag_ptr(val);
50628         val_conv.is_owned = ptr_is_owned(val);
50629         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50630         val_conv = RoutingFees_clone(&val_conv);
50631         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
50632 }
50633
50634 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
50635         LDKRouteHintHop this_ptr_conv;
50636         this_ptr_conv.inner = untag_ptr(this_ptr);
50637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50639         this_ptr_conv.is_owned = false;
50640         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
50641         return ret_conv;
50642 }
50643
50644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
50645         LDKRouteHintHop this_ptr_conv;
50646         this_ptr_conv.inner = untag_ptr(this_ptr);
50647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50649         this_ptr_conv.is_owned = false;
50650         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
50651 }
50652
50653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50654         LDKRouteHintHop this_ptr_conv;
50655         this_ptr_conv.inner = untag_ptr(this_ptr);
50656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50658         this_ptr_conv.is_owned = false;
50659         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50660         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
50661         int64_t ret_ref = tag_ptr(ret_copy, true);
50662         return ret_ref;
50663 }
50664
50665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50666         LDKRouteHintHop this_ptr_conv;
50667         this_ptr_conv.inner = untag_ptr(this_ptr);
50668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50670         this_ptr_conv.is_owned = false;
50671         void* val_ptr = untag_ptr(val);
50672         CHECK_ACCESS(val_ptr);
50673         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50674         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50675         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
50676 }
50677
50678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50679         LDKRouteHintHop this_ptr_conv;
50680         this_ptr_conv.inner = untag_ptr(this_ptr);
50681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50683         this_ptr_conv.is_owned = false;
50684         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50685         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
50686         int64_t ret_ref = tag_ptr(ret_copy, true);
50687         return ret_ref;
50688 }
50689
50690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50691         LDKRouteHintHop this_ptr_conv;
50692         this_ptr_conv.inner = untag_ptr(this_ptr);
50693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50695         this_ptr_conv.is_owned = false;
50696         void* val_ptr = untag_ptr(val);
50697         CHECK_ACCESS(val_ptr);
50698         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50699         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50700         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
50701 }
50702
50703 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) {
50704         LDKPublicKey src_node_id_arg_ref;
50705         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
50706         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
50707         LDKRoutingFees fees_arg_conv;
50708         fees_arg_conv.inner = untag_ptr(fees_arg);
50709         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
50710         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
50711         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
50712         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
50713         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
50714         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
50715         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
50716         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
50717         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
50718         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
50719         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
50720         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);
50721         int64_t ret_ref = 0;
50722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50724         return ret_ref;
50725 }
50726
50727 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
50728         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
50729         int64_t ret_ref = 0;
50730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50732         return ret_ref;
50733 }
50734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50735         LDKRouteHintHop arg_conv;
50736         arg_conv.inner = untag_ptr(arg);
50737         arg_conv.is_owned = ptr_is_owned(arg);
50738         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50739         arg_conv.is_owned = false;
50740         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
50741         return ret_conv;
50742 }
50743
50744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50745         LDKRouteHintHop orig_conv;
50746         orig_conv.inner = untag_ptr(orig);
50747         orig_conv.is_owned = ptr_is_owned(orig);
50748         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50749         orig_conv.is_owned = false;
50750         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
50751         int64_t ret_ref = 0;
50752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50754         return ret_ref;
50755 }
50756
50757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
50758         LDKRouteHintHop o_conv;
50759         o_conv.inner = untag_ptr(o);
50760         o_conv.is_owned = ptr_is_owned(o);
50761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50762         o_conv.is_owned = false;
50763         int64_t ret_conv = RouteHintHop_hash(&o_conv);
50764         return ret_conv;
50765 }
50766
50767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50768         LDKRouteHintHop a_conv;
50769         a_conv.inner = untag_ptr(a);
50770         a_conv.is_owned = ptr_is_owned(a);
50771         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50772         a_conv.is_owned = false;
50773         LDKRouteHintHop b_conv;
50774         b_conv.inner = untag_ptr(b);
50775         b_conv.is_owned = ptr_is_owned(b);
50776         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50777         b_conv.is_owned = false;
50778         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
50779         return ret_conv;
50780 }
50781
50782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
50783         LDKRouteHintHop obj_conv;
50784         obj_conv.inner = untag_ptr(obj);
50785         obj_conv.is_owned = ptr_is_owned(obj);
50786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50787         obj_conv.is_owned = false;
50788         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
50789         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50790         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50791         CVec_u8Z_free(ret_var);
50792         return ret_arr;
50793 }
50794
50795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50796         LDKu8slice ser_ref;
50797         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50798         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50799         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
50800         *ret_conv = RouteHintHop_read(ser_ref);
50801         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50802         return tag_ptr(ret_conv, true);
50803 }
50804
50805 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, int8_tArray random_seed_bytes) {
50806         LDKPublicKey our_node_pubkey_ref;
50807         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
50808         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
50809         LDKRouteParameters route_params_conv;
50810         route_params_conv.inner = untag_ptr(route_params);
50811         route_params_conv.is_owned = ptr_is_owned(route_params);
50812         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
50813         route_params_conv.is_owned = false;
50814         LDKNetworkGraph network_graph_conv;
50815         network_graph_conv.inner = untag_ptr(network_graph);
50816         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50817         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50818         network_graph_conv.is_owned = false;
50819         LDKCVec_ChannelDetailsZ first_hops_constr;
50820         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
50821         if (first_hops != NULL) {
50822                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
50823                 if (first_hops_constr.datalen > 0)
50824                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
50825                 else
50826                         first_hops_constr.data = NULL;
50827                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
50828                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
50829                         int64_t first_hops_conv_16 = first_hops_vals[q];
50830                         LDKChannelDetails first_hops_conv_16_conv;
50831                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
50832                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
50833                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
50834                         first_hops_conv_16_conv.is_owned = false;
50835                         first_hops_constr.data[q] = first_hops_conv_16_conv;
50836                 }
50837                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
50838                 first_hops_ptr = &first_hops_constr;
50839         }
50840         void* logger_ptr = untag_ptr(logger);
50841         CHECK_ACCESS(logger_ptr);
50842         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50843         if (logger_conv.free == LDKLogger_JCalls_free) {
50844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50845                 LDKLogger_JCalls_cloned(&logger_conv);
50846         }
50847         void* scorer_ptr = untag_ptr(scorer);
50848         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
50849         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
50850         uint8_t random_seed_bytes_arr[32];
50851         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
50852         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
50853         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
50854         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
50855         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
50856         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
50857         return tag_ptr(ret_conv, true);
50858 }
50859
50860 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) {
50861         LDKPublicKey our_node_pubkey_ref;
50862         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
50863         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
50864         LDKCVec_PublicKeyZ hops_constr;
50865         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
50866         if (hops_constr.datalen > 0)
50867                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
50868         else
50869                 hops_constr.data = NULL;
50870         for (size_t i = 0; i < hops_constr.datalen; i++) {
50871                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
50872                 LDKPublicKey hops_conv_8_ref;
50873                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
50874                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
50875                 hops_constr.data[i] = hops_conv_8_ref;
50876         }
50877         LDKRouteParameters route_params_conv;
50878         route_params_conv.inner = untag_ptr(route_params);
50879         route_params_conv.is_owned = ptr_is_owned(route_params);
50880         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
50881         route_params_conv.is_owned = false;
50882         LDKNetworkGraph network_graph_conv;
50883         network_graph_conv.inner = untag_ptr(network_graph);
50884         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50885         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50886         network_graph_conv.is_owned = false;
50887         void* logger_ptr = untag_ptr(logger);
50888         CHECK_ACCESS(logger_ptr);
50889         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50890         if (logger_conv.free == LDKLogger_JCalls_free) {
50891                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50892                 LDKLogger_JCalls_cloned(&logger_conv);
50893         }
50894         uint8_t random_seed_bytes_arr[32];
50895         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
50896         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
50897         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
50898         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
50899         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
50900         return tag_ptr(ret_conv, true);
50901 }
50902
50903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50904         if (!ptr_is_owned(this_ptr)) return;
50905         void* this_ptr_ptr = untag_ptr(this_ptr);
50906         CHECK_ACCESS(this_ptr_ptr);
50907         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
50908         FREE(untag_ptr(this_ptr));
50909         Score_free(this_ptr_conv);
50910 }
50911
50912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50913         if (!ptr_is_owned(this_ptr)) return;
50914         void* this_ptr_ptr = untag_ptr(this_ptr);
50915         CHECK_ACCESS(this_ptr_ptr);
50916         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
50917         FREE(untag_ptr(this_ptr));
50918         LockableScore_free(this_ptr_conv);
50919 }
50920
50921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50922         if (!ptr_is_owned(this_ptr)) return;
50923         void* this_ptr_ptr = untag_ptr(this_ptr);
50924         CHECK_ACCESS(this_ptr_ptr);
50925         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
50926         FREE(untag_ptr(this_ptr));
50927         WriteableScore_free(this_ptr_conv);
50928 }
50929
50930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50931         LDKMultiThreadedLockableScore this_obj_conv;
50932         this_obj_conv.inner = untag_ptr(this_obj);
50933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50935         MultiThreadedLockableScore_free(this_obj_conv);
50936 }
50937
50938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50939         LDKMultiThreadedScoreLock this_obj_conv;
50940         this_obj_conv.inner = untag_ptr(this_obj);
50941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50943         MultiThreadedScoreLock_free(this_obj_conv);
50944 }
50945
50946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
50947         LDKMultiThreadedScoreLock this_arg_conv;
50948         this_arg_conv.inner = untag_ptr(this_arg);
50949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50951         this_arg_conv.is_owned = false;
50952         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
50953         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
50954         return tag_ptr(ret_ret, true);
50955 }
50956
50957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1write(JNIEnv *env, jclass clz, int64_t obj) {
50958         LDKMultiThreadedScoreLock obj_conv;
50959         obj_conv.inner = untag_ptr(obj);
50960         obj_conv.is_owned = ptr_is_owned(obj);
50961         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50962         obj_conv.is_owned = false;
50963         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
50964         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50965         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50966         CVec_u8Z_free(ret_var);
50967         return ret_arr;
50968 }
50969
50970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
50971         LDKMultiThreadedLockableScore this_arg_conv;
50972         this_arg_conv.inner = untag_ptr(this_arg);
50973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50975         this_arg_conv.is_owned = false;
50976         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
50977         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
50978         return tag_ptr(ret_ret, true);
50979 }
50980
50981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
50982         LDKMultiThreadedLockableScore obj_conv;
50983         obj_conv.inner = untag_ptr(obj);
50984         obj_conv.is_owned = ptr_is_owned(obj);
50985         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50986         obj_conv.is_owned = false;
50987         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
50988         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50989         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50990         CVec_u8Z_free(ret_var);
50991         return ret_arr;
50992 }
50993
50994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
50995         LDKMultiThreadedLockableScore this_arg_conv;
50996         this_arg_conv.inner = untag_ptr(this_arg);
50997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50999         this_arg_conv.is_owned = false;
51000         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
51001         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
51002         return tag_ptr(ret_ret, true);
51003 }
51004
51005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
51006         void* score_ptr = untag_ptr(score);
51007         CHECK_ACCESS(score_ptr);
51008         LDKScore score_conv = *(LDKScore*)(score_ptr);
51009         if (score_conv.free == LDKScore_JCalls_free) {
51010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51011                 LDKScore_JCalls_cloned(&score_conv);
51012         }
51013         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
51014         int64_t ret_ref = 0;
51015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51017         return ret_ref;
51018 }
51019
51020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51021         LDKChannelUsage this_obj_conv;
51022         this_obj_conv.inner = untag_ptr(this_obj);
51023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51025         ChannelUsage_free(this_obj_conv);
51026 }
51027
51028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51029         LDKChannelUsage 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         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
51035         return ret_conv;
51036 }
51037
51038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51039         LDKChannelUsage 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         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
51045 }
51046
51047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51048         LDKChannelUsage this_ptr_conv;
51049         this_ptr_conv.inner = untag_ptr(this_ptr);
51050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51052         this_ptr_conv.is_owned = false;
51053         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
51054         return ret_conv;
51055 }
51056
51057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51058         LDKChannelUsage this_ptr_conv;
51059         this_ptr_conv.inner = untag_ptr(this_ptr);
51060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51062         this_ptr_conv.is_owned = false;
51063         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
51064 }
51065
51066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
51067         LDKChannelUsage this_ptr_conv;
51068         this_ptr_conv.inner = untag_ptr(this_ptr);
51069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51071         this_ptr_conv.is_owned = false;
51072         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
51073         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
51074         int64_t ret_ref = tag_ptr(ret_copy, true);
51075         return ret_ref;
51076 }
51077
51078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51079         LDKChannelUsage this_ptr_conv;
51080         this_ptr_conv.inner = untag_ptr(this_ptr);
51081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51083         this_ptr_conv.is_owned = false;
51084         void* val_ptr = untag_ptr(val);
51085         CHECK_ACCESS(val_ptr);
51086         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
51087         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
51088         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
51089 }
51090
51091 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) {
51092         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
51093         CHECK_ACCESS(effective_capacity_arg_ptr);
51094         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
51095         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
51096         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
51097         int64_t ret_ref = 0;
51098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51100         return ret_ref;
51101 }
51102
51103 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
51104         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
51105         int64_t ret_ref = 0;
51106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51108         return ret_ref;
51109 }
51110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51111         LDKChannelUsage arg_conv;
51112         arg_conv.inner = untag_ptr(arg);
51113         arg_conv.is_owned = ptr_is_owned(arg);
51114         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51115         arg_conv.is_owned = false;
51116         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
51117         return ret_conv;
51118 }
51119
51120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51121         LDKChannelUsage orig_conv;
51122         orig_conv.inner = untag_ptr(orig);
51123         orig_conv.is_owned = ptr_is_owned(orig);
51124         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51125         orig_conv.is_owned = false;
51126         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
51127         int64_t ret_ref = 0;
51128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51130         return ret_ref;
51131 }
51132
51133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51134         LDKFixedPenaltyScorer this_obj_conv;
51135         this_obj_conv.inner = untag_ptr(this_obj);
51136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51138         FixedPenaltyScorer_free(this_obj_conv);
51139 }
51140
51141 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
51142         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
51143         int64_t ret_ref = 0;
51144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51146         return ret_ref;
51147 }
51148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51149         LDKFixedPenaltyScorer arg_conv;
51150         arg_conv.inner = untag_ptr(arg);
51151         arg_conv.is_owned = ptr_is_owned(arg);
51152         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51153         arg_conv.is_owned = false;
51154         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
51155         return ret_conv;
51156 }
51157
51158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51159         LDKFixedPenaltyScorer orig_conv;
51160         orig_conv.inner = untag_ptr(orig);
51161         orig_conv.is_owned = ptr_is_owned(orig);
51162         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51163         orig_conv.is_owned = false;
51164         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
51165         int64_t ret_ref = 0;
51166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51168         return ret_ref;
51169 }
51170
51171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
51172         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
51173         int64_t ret_ref = 0;
51174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51176         return ret_ref;
51177 }
51178
51179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
51180         LDKFixedPenaltyScorer this_arg_conv;
51181         this_arg_conv.inner = untag_ptr(this_arg);
51182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51184         this_arg_conv.is_owned = false;
51185         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
51186         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
51187         return tag_ptr(ret_ret, true);
51188 }
51189
51190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
51191         LDKFixedPenaltyScorer obj_conv;
51192         obj_conv.inner = untag_ptr(obj);
51193         obj_conv.is_owned = ptr_is_owned(obj);
51194         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51195         obj_conv.is_owned = false;
51196         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
51197         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51198         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51199         CVec_u8Z_free(ret_var);
51200         return ret_arr;
51201 }
51202
51203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
51204         LDKu8slice ser_ref;
51205         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51206         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51207         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
51208         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
51209         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51210         return tag_ptr(ret_conv, true);
51211 }
51212
51213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51214         LDKProbabilisticScorer this_obj_conv;
51215         this_obj_conv.inner = untag_ptr(this_obj);
51216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51218         ProbabilisticScorer_free(this_obj_conv);
51219 }
51220
51221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51222         LDKProbabilisticScoringParameters this_obj_conv;
51223         this_obj_conv.inner = untag_ptr(this_obj);
51224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51226         ProbabilisticScoringParameters_free(this_obj_conv);
51227 }
51228
51229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51230         LDKProbabilisticScoringParameters this_ptr_conv;
51231         this_ptr_conv.inner = untag_ptr(this_ptr);
51232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51234         this_ptr_conv.is_owned = false;
51235         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
51236         return ret_conv;
51237 }
51238
51239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51240         LDKProbabilisticScoringParameters this_ptr_conv;
51241         this_ptr_conv.inner = untag_ptr(this_ptr);
51242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51244         this_ptr_conv.is_owned = false;
51245         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
51246 }
51247
51248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51249         LDKProbabilisticScoringParameters this_ptr_conv;
51250         this_ptr_conv.inner = untag_ptr(this_ptr);
51251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51253         this_ptr_conv.is_owned = false;
51254         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
51255         return ret_conv;
51256 }
51257
51258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51259         LDKProbabilisticScoringParameters this_ptr_conv;
51260         this_ptr_conv.inner = untag_ptr(this_ptr);
51261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51263         this_ptr_conv.is_owned = false;
51264         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
51265 }
51266
51267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51268         LDKProbabilisticScoringParameters this_ptr_conv;
51269         this_ptr_conv.inner = untag_ptr(this_ptr);
51270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51272         this_ptr_conv.is_owned = false;
51273         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
51274         return ret_conv;
51275 }
51276
51277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51278         LDKProbabilisticScoringParameters this_ptr_conv;
51279         this_ptr_conv.inner = untag_ptr(this_ptr);
51280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51282         this_ptr_conv.is_owned = false;
51283         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
51284 }
51285
51286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
51287         LDKProbabilisticScoringParameters 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         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
51293         return ret_conv;
51294 }
51295
51296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51297         LDKProbabilisticScoringParameters this_ptr_conv;
51298         this_ptr_conv.inner = untag_ptr(this_ptr);
51299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51301         this_ptr_conv.is_owned = false;
51302         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
51303 }
51304
51305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51306         LDKProbabilisticScoringParameters this_ptr_conv;
51307         this_ptr_conv.inner = untag_ptr(this_ptr);
51308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51310         this_ptr_conv.is_owned = false;
51311         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
51312         return ret_conv;
51313 }
51314
51315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51316         LDKProbabilisticScoringParameters this_ptr_conv;
51317         this_ptr_conv.inner = untag_ptr(this_ptr);
51318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51320         this_ptr_conv.is_owned = false;
51321         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
51322 }
51323
51324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51325         LDKProbabilisticScoringParameters this_ptr_conv;
51326         this_ptr_conv.inner = untag_ptr(this_ptr);
51327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51329         this_ptr_conv.is_owned = false;
51330         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
51331         return ret_conv;
51332 }
51333
51334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51335         LDKProbabilisticScoringParameters this_ptr_conv;
51336         this_ptr_conv.inner = untag_ptr(this_ptr);
51337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51339         this_ptr_conv.is_owned = false;
51340         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
51341 }
51342
51343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51344         LDKProbabilisticScoringParameters this_ptr_conv;
51345         this_ptr_conv.inner = untag_ptr(this_ptr);
51346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51348         this_ptr_conv.is_owned = false;
51349         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
51350         return ret_conv;
51351 }
51352
51353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51354         LDKProbabilisticScoringParameters this_ptr_conv;
51355         this_ptr_conv.inner = untag_ptr(this_ptr);
51356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51358         this_ptr_conv.is_owned = false;
51359         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
51360 }
51361
51362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
51363         LDKProbabilisticScoringParameters this_ptr_conv;
51364         this_ptr_conv.inner = untag_ptr(this_ptr);
51365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51367         this_ptr_conv.is_owned = false;
51368         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
51369         return ret_conv;
51370 }
51371
51372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51373         LDKProbabilisticScoringParameters this_ptr_conv;
51374         this_ptr_conv.inner = untag_ptr(this_ptr);
51375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51377         this_ptr_conv.is_owned = false;
51378         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
51379 }
51380
51381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51382         LDKProbabilisticScoringParameters this_ptr_conv;
51383         this_ptr_conv.inner = untag_ptr(this_ptr);
51384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51386         this_ptr_conv.is_owned = false;
51387         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
51388         return ret_conv;
51389 }
51390
51391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51392         LDKProbabilisticScoringParameters this_ptr_conv;
51393         this_ptr_conv.inner = untag_ptr(this_ptr);
51394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51396         this_ptr_conv.is_owned = false;
51397         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
51398 }
51399
51400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51401         LDKProbabilisticScoringParameters this_ptr_conv;
51402         this_ptr_conv.inner = untag_ptr(this_ptr);
51403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51405         this_ptr_conv.is_owned = false;
51406         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
51407         return ret_conv;
51408 }
51409
51410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51411         LDKProbabilisticScoringParameters this_ptr_conv;
51412         this_ptr_conv.inner = untag_ptr(this_ptr);
51413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51415         this_ptr_conv.is_owned = false;
51416         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
51417 }
51418
51419 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
51420         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
51421         int64_t ret_ref = 0;
51422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51424         return ret_ref;
51425 }
51426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51427         LDKProbabilisticScoringParameters arg_conv;
51428         arg_conv.inner = untag_ptr(arg);
51429         arg_conv.is_owned = ptr_is_owned(arg);
51430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51431         arg_conv.is_owned = false;
51432         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
51433         return ret_conv;
51434 }
51435
51436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51437         LDKProbabilisticScoringParameters orig_conv;
51438         orig_conv.inner = untag_ptr(orig);
51439         orig_conv.is_owned = ptr_is_owned(orig);
51440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51441         orig_conv.is_owned = false;
51442         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
51443         int64_t ret_ref = 0;
51444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51446         return ret_ref;
51447 }
51448
51449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph, int64_t logger) {
51450         LDKProbabilisticScoringParameters params_conv;
51451         params_conv.inner = untag_ptr(params);
51452         params_conv.is_owned = ptr_is_owned(params);
51453         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
51454         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
51455         LDKNetworkGraph network_graph_conv;
51456         network_graph_conv.inner = untag_ptr(network_graph);
51457         network_graph_conv.is_owned = ptr_is_owned(network_graph);
51458         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
51459         network_graph_conv.is_owned = false;
51460         void* logger_ptr = untag_ptr(logger);
51461         CHECK_ACCESS(logger_ptr);
51462         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
51463         if (logger_conv.free == LDKLogger_JCalls_free) {
51464                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51465                 LDKLogger_JCalls_cloned(&logger_conv);
51466         }
51467         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
51468         int64_t ret_ref = 0;
51469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51471         return ret_ref;
51472 }
51473
51474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
51475         LDKProbabilisticScorer this_arg_conv;
51476         this_arg_conv.inner = untag_ptr(this_arg);
51477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51479         this_arg_conv.is_owned = false;
51480         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
51481 }
51482
51483 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) {
51484         LDKProbabilisticScorer this_arg_conv;
51485         this_arg_conv.inner = untag_ptr(this_arg);
51486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51488         this_arg_conv.is_owned = false;
51489         LDKNodeId target_conv;
51490         target_conv.inner = untag_ptr(target);
51491         target_conv.is_owned = ptr_is_owned(target);
51492         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
51493         target_conv.is_owned = false;
51494         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
51495         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
51496         int64_t ret_ref = tag_ptr(ret_copy, true);
51497         return ret_ref;
51498 }
51499
51500 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) {
51501         LDKProbabilisticScorer this_arg_conv;
51502         this_arg_conv.inner = untag_ptr(this_arg);
51503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51505         this_arg_conv.is_owned = false;
51506         LDKNodeId target_conv;
51507         target_conv.inner = untag_ptr(target);
51508         target_conv.is_owned = ptr_is_owned(target);
51509         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
51510         target_conv.is_owned = false;
51511         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
51512         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
51513         int64_t ret_ref = tag_ptr(ret_copy, true);
51514         return ret_ref;
51515 }
51516
51517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
51518         LDKProbabilisticScorer this_arg_conv;
51519         this_arg_conv.inner = untag_ptr(this_arg);
51520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51522         this_arg_conv.is_owned = false;
51523         LDKNodeId node_id_conv;
51524         node_id_conv.inner = untag_ptr(node_id);
51525         node_id_conv.is_owned = ptr_is_owned(node_id);
51526         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
51527         node_id_conv.is_owned = false;
51528         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
51529 }
51530
51531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
51532         LDKProbabilisticScorer this_arg_conv;
51533         this_arg_conv.inner = untag_ptr(this_arg);
51534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51536         this_arg_conv.is_owned = false;
51537         LDKNodeId node_id_conv;
51538         node_id_conv.inner = untag_ptr(node_id);
51539         node_id_conv.is_owned = ptr_is_owned(node_id);
51540         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
51541         node_id_conv.is_owned = false;
51542         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
51543 }
51544
51545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) {
51546         LDKProbabilisticScorer this_arg_conv;
51547         this_arg_conv.inner = untag_ptr(this_arg);
51548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51550         this_arg_conv.is_owned = false;
51551         LDKNodeId node_id_conv;
51552         node_id_conv.inner = untag_ptr(node_id);
51553         node_id_conv.is_owned = ptr_is_owned(node_id);
51554         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
51555         node_id_conv.is_owned = false;
51556         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
51557 }
51558
51559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
51560         LDKProbabilisticScorer this_arg_conv;
51561         this_arg_conv.inner = untag_ptr(this_arg);
51562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51564         this_arg_conv.is_owned = false;
51565         LDKNodeId node_id_conv;
51566         node_id_conv.inner = untag_ptr(node_id);
51567         node_id_conv.is_owned = ptr_is_owned(node_id);
51568         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
51569         node_id_conv.is_owned = false;
51570         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
51571 }
51572
51573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
51574         LDKProbabilisticScorer this_arg_conv;
51575         this_arg_conv.inner = untag_ptr(this_arg);
51576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51578         this_arg_conv.is_owned = false;
51579         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
51580 }
51581
51582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) {
51583         LDKProbabilisticScoringParameters this_arg_conv;
51584         this_arg_conv.inner = untag_ptr(this_arg);
51585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51587         this_arg_conv.is_owned = false;
51588         LDKCVec_NodeIdZ node_ids_constr;
51589         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
51590         if (node_ids_constr.datalen > 0)
51591                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
51592         else
51593                 node_ids_constr.data = NULL;
51594         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
51595         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
51596                 int64_t node_ids_conv_8 = node_ids_vals[i];
51597                 LDKNodeId node_ids_conv_8_conv;
51598                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
51599                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
51600                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
51601                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
51602                 node_ids_constr.data[i] = node_ids_conv_8_conv;
51603         }
51604         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
51605         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
51606 }
51607
51608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
51609         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
51610         int64_t ret_ref = 0;
51611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51613         return ret_ref;
51614 }
51615
51616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
51617         LDKProbabilisticScorer this_arg_conv;
51618         this_arg_conv.inner = untag_ptr(this_arg);
51619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51621         this_arg_conv.is_owned = false;
51622         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
51623         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
51624         return tag_ptr(ret_ret, true);
51625 }
51626
51627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
51628         LDKProbabilisticScorer obj_conv;
51629         obj_conv.inner = untag_ptr(obj);
51630         obj_conv.is_owned = ptr_is_owned(obj);
51631         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51632         obj_conv.is_owned = false;
51633         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
51634         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51635         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51636         CVec_u8Z_free(ret_var);
51637         return ret_arr;
51638 }
51639
51640 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) {
51641         LDKu8slice ser_ref;
51642         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51643         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51644         LDKProbabilisticScoringParameters arg_a_conv;
51645         arg_a_conv.inner = untag_ptr(arg_a);
51646         arg_a_conv.is_owned = ptr_is_owned(arg_a);
51647         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
51648         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
51649         LDKNetworkGraph arg_b_conv;
51650         arg_b_conv.inner = untag_ptr(arg_b);
51651         arg_b_conv.is_owned = ptr_is_owned(arg_b);
51652         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
51653         arg_b_conv.is_owned = false;
51654         void* arg_c_ptr = untag_ptr(arg_c);
51655         CHECK_ACCESS(arg_c_ptr);
51656         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
51657         if (arg_c_conv.free == LDKLogger_JCalls_free) {
51658                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51659                 LDKLogger_JCalls_cloned(&arg_c_conv);
51660         }
51661         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
51662         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
51663         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51664         return tag_ptr(ret_conv, true);
51665 }
51666
51667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51668         LDKBlindedPath this_obj_conv;
51669         this_obj_conv.inner = untag_ptr(this_obj);
51670         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51672         BlindedPath_free(this_obj_conv);
51673 }
51674
51675 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
51676         LDKBlindedPath ret_var = BlindedPath_clone(arg);
51677         int64_t ret_ref = 0;
51678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51680         return ret_ref;
51681 }
51682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51683         LDKBlindedPath arg_conv;
51684         arg_conv.inner = untag_ptr(arg);
51685         arg_conv.is_owned = ptr_is_owned(arg);
51686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51687         arg_conv.is_owned = false;
51688         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
51689         return ret_conv;
51690 }
51691
51692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51693         LDKBlindedPath orig_conv;
51694         orig_conv.inner = untag_ptr(orig);
51695         orig_conv.is_owned = ptr_is_owned(orig);
51696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51697         orig_conv.is_owned = false;
51698         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
51699         int64_t ret_ref = 0;
51700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51702         return ret_ref;
51703 }
51704
51705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51706         LDKBlindedHop this_obj_conv;
51707         this_obj_conv.inner = untag_ptr(this_obj);
51708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51710         BlindedHop_free(this_obj_conv);
51711 }
51712
51713 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
51714         LDKBlindedHop ret_var = BlindedHop_clone(arg);
51715         int64_t ret_ref = 0;
51716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51718         return ret_ref;
51719 }
51720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51721         LDKBlindedHop arg_conv;
51722         arg_conv.inner = untag_ptr(arg);
51723         arg_conv.is_owned = ptr_is_owned(arg);
51724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51725         arg_conv.is_owned = false;
51726         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
51727         return ret_conv;
51728 }
51729
51730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51731         LDKBlindedHop orig_conv;
51732         orig_conv.inner = untag_ptr(orig);
51733         orig_conv.is_owned = ptr_is_owned(orig);
51734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51735         orig_conv.is_owned = false;
51736         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
51737         int64_t ret_ref = 0;
51738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51740         return ret_ref;
51741 }
51742
51743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
51744         LDKCVec_PublicKeyZ node_pks_constr;
51745         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
51746         if (node_pks_constr.datalen > 0)
51747                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
51748         else
51749                 node_pks_constr.data = NULL;
51750         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
51751                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
51752                 LDKPublicKey node_pks_conv_8_ref;
51753                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
51754                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
51755                 node_pks_constr.data[i] = node_pks_conv_8_ref;
51756         }
51757         void* entropy_source_ptr = untag_ptr(entropy_source);
51758         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
51759         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
51760         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
51761         *ret_conv = BlindedPath_new(node_pks_constr, entropy_source_conv);
51762         return tag_ptr(ret_conv, true);
51763 }
51764
51765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
51766         LDKBlindedPath obj_conv;
51767         obj_conv.inner = untag_ptr(obj);
51768         obj_conv.is_owned = ptr_is_owned(obj);
51769         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51770         obj_conv.is_owned = false;
51771         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
51772         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51773         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51774         CVec_u8Z_free(ret_var);
51775         return ret_arr;
51776 }
51777
51778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51779         LDKu8slice ser_ref;
51780         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51781         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51782         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
51783         *ret_conv = BlindedPath_read(ser_ref);
51784         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51785         return tag_ptr(ret_conv, true);
51786 }
51787
51788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
51789         LDKBlindedHop obj_conv;
51790         obj_conv.inner = untag_ptr(obj);
51791         obj_conv.is_owned = ptr_is_owned(obj);
51792         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51793         obj_conv.is_owned = false;
51794         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
51795         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51796         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51797         CVec_u8Z_free(ret_var);
51798         return ret_arr;
51799 }
51800
51801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51802         LDKu8slice ser_ref;
51803         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51804         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51805         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
51806         *ret_conv = BlindedHop_read(ser_ref);
51807         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51808         return tag_ptr(ret_conv, true);
51809 }
51810
51811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51812         LDKOnionMessenger this_obj_conv;
51813         this_obj_conv.inner = untag_ptr(this_obj);
51814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51816         OnionMessenger_free(this_obj_conv);
51817 }
51818
51819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51820         if (!ptr_is_owned(this_ptr)) return;
51821         void* this_ptr_ptr = untag_ptr(this_ptr);
51822         CHECK_ACCESS(this_ptr_ptr);
51823         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
51824         FREE(untag_ptr(this_ptr));
51825         Destination_free(this_ptr_conv);
51826 }
51827
51828 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
51829         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
51830         *ret_copy = Destination_clone(arg);
51831         int64_t ret_ref = tag_ptr(ret_copy, true);
51832         return ret_ref;
51833 }
51834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51835         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
51836         int64_t ret_conv = Destination_clone_ptr(arg_conv);
51837         return ret_conv;
51838 }
51839
51840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51841         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
51842         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
51843         *ret_copy = Destination_clone(orig_conv);
51844         int64_t ret_ref = tag_ptr(ret_copy, true);
51845         return ret_ref;
51846 }
51847
51848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
51849         LDKPublicKey a_ref;
51850         CHECK((*env)->GetArrayLength(env, a) == 33);
51851         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
51852         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
51853         *ret_copy = Destination_node(a_ref);
51854         int64_t ret_ref = tag_ptr(ret_copy, true);
51855         return ret_ref;
51856 }
51857
51858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
51859         LDKBlindedPath a_conv;
51860         a_conv.inner = untag_ptr(a);
51861         a_conv.is_owned = ptr_is_owned(a);
51862         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51863         a_conv = BlindedPath_clone(&a_conv);
51864         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
51865         *ret_copy = Destination_blinded_path(a_conv);
51866         int64_t ret_ref = tag_ptr(ret_copy, true);
51867         return ret_ref;
51868 }
51869
51870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51871         if (!ptr_is_owned(this_ptr)) return;
51872         void* this_ptr_ptr = untag_ptr(this_ptr);
51873         CHECK_ACCESS(this_ptr_ptr);
51874         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
51875         FREE(untag_ptr(this_ptr));
51876         SendError_free(this_ptr_conv);
51877 }
51878
51879 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
51880         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51881         *ret_copy = SendError_clone(arg);
51882         int64_t ret_ref = tag_ptr(ret_copy, true);
51883         return ret_ref;
51884 }
51885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51886         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
51887         int64_t ret_conv = SendError_clone_ptr(arg_conv);
51888         return ret_conv;
51889 }
51890
51891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51892         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
51893         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51894         *ret_copy = SendError_clone(orig_conv);
51895         int64_t ret_ref = tag_ptr(ret_copy, true);
51896         return ret_ref;
51897 }
51898
51899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
51900         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
51901         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51902         *ret_copy = SendError_secp256k1(a_conv);
51903         int64_t ret_ref = tag_ptr(ret_copy, true);
51904         return ret_ref;
51905 }
51906
51907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
51908         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51909         *ret_copy = SendError_too_big_packet();
51910         int64_t ret_ref = tag_ptr(ret_copy, true);
51911         return ret_ref;
51912 }
51913
51914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
51915         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51916         *ret_copy = SendError_too_few_blinded_hops();
51917         int64_t ret_ref = tag_ptr(ret_copy, true);
51918         return ret_ref;
51919 }
51920
51921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
51922         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51923         *ret_copy = SendError_invalid_first_hop();
51924         int64_t ret_ref = tag_ptr(ret_copy, true);
51925         return ret_ref;
51926 }
51927
51928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
51929         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51930         *ret_copy = SendError_invalid_message();
51931         int64_t ret_ref = tag_ptr(ret_copy, true);
51932         return ret_ref;
51933 }
51934
51935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
51936         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51937         *ret_copy = SendError_buffer_full();
51938         int64_t ret_ref = tag_ptr(ret_copy, true);
51939         return ret_ref;
51940 }
51941
51942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
51943         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51944         *ret_copy = SendError_get_node_id_failed();
51945         int64_t ret_ref = tag_ptr(ret_copy, true);
51946         return ret_ref;
51947 }
51948
51949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
51950         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
51951         *ret_copy = SendError_blinded_path_advance_failed();
51952         int64_t ret_ref = tag_ptr(ret_copy, true);
51953         return ret_ref;
51954 }
51955
51956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51957         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
51958         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
51959         jboolean ret_conv = SendError_eq(a_conv, b_conv);
51960         return ret_conv;
51961 }
51962
51963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51964         if (!ptr_is_owned(this_ptr)) return;
51965         void* this_ptr_ptr = untag_ptr(this_ptr);
51966         CHECK_ACCESS(this_ptr_ptr);
51967         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
51968         FREE(untag_ptr(this_ptr));
51969         CustomOnionMessageHandler_free(this_ptr_conv);
51970 }
51971
51972 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 custom_handler) {
51973         void* entropy_source_ptr = untag_ptr(entropy_source);
51974         CHECK_ACCESS(entropy_source_ptr);
51975         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
51976         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
51977                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51978                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
51979         }
51980         void* node_signer_ptr = untag_ptr(node_signer);
51981         CHECK_ACCESS(node_signer_ptr);
51982         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
51983         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
51984                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51985                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
51986         }
51987         void* logger_ptr = untag_ptr(logger);
51988         CHECK_ACCESS(logger_ptr);
51989         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
51990         if (logger_conv.free == LDKLogger_JCalls_free) {
51991                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51992                 LDKLogger_JCalls_cloned(&logger_conv);
51993         }
51994         void* custom_handler_ptr = untag_ptr(custom_handler);
51995         CHECK_ACCESS(custom_handler_ptr);
51996         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
51997         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
51998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
51999                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
52000         }
52001         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_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_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray intermediate_nodes, int64_t destination, int64_t message, int64_t reply_path) {
52009         LDKOnionMessenger 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         LDKCVec_PublicKeyZ intermediate_nodes_constr;
52015         intermediate_nodes_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes);
52016         if (intermediate_nodes_constr.datalen > 0)
52017                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
52018         else
52019                 intermediate_nodes_constr.data = NULL;
52020         for (size_t i = 0; i < intermediate_nodes_constr.datalen; i++) {
52021                 int8_tArray intermediate_nodes_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes, i);
52022                 LDKPublicKey intermediate_nodes_conv_8_ref;
52023                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_conv_8) == 33);
52024                 (*env)->GetByteArrayRegion(env, intermediate_nodes_conv_8, 0, 33, intermediate_nodes_conv_8_ref.compressed_form);
52025                 intermediate_nodes_constr.data[i] = intermediate_nodes_conv_8_ref;
52026         }
52027         void* destination_ptr = untag_ptr(destination);
52028         CHECK_ACCESS(destination_ptr);
52029         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
52030         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
52031         void* message_ptr = untag_ptr(message);
52032         CHECK_ACCESS(message_ptr);
52033         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
52034         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
52035         LDKBlindedPath reply_path_conv;
52036         reply_path_conv.inner = untag_ptr(reply_path);
52037         reply_path_conv.is_owned = ptr_is_owned(reply_path);
52038         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
52039         reply_path_conv = BlindedPath_clone(&reply_path_conv);
52040         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
52041         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
52042         return tag_ptr(ret_conv, true);
52043 }
52044
52045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52046         LDKOnionMessenger this_arg_conv;
52047         this_arg_conv.inner = untag_ptr(this_arg);
52048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52050         this_arg_conv.is_owned = false;
52051         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
52052         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
52053         return tag_ptr(ret_ret, true);
52054 }
52055
52056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
52057         LDKOnionMessenger this_arg_conv;
52058         this_arg_conv.inner = untag_ptr(this_arg);
52059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52061         this_arg_conv.is_owned = false;
52062         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
52063         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
52064         return tag_ptr(ret_ret, true);
52065 }
52066
52067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52068         if (!ptr_is_owned(this_ptr)) return;
52069         void* this_ptr_ptr = untag_ptr(this_ptr);
52070         CHECK_ACCESS(this_ptr_ptr);
52071         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
52072         FREE(untag_ptr(this_ptr));
52073         OnionMessageContents_free(this_ptr_conv);
52074 }
52075
52076 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
52077         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
52078         *ret_copy = OnionMessageContents_clone(arg);
52079         int64_t ret_ref = tag_ptr(ret_copy, true);
52080         return ret_ref;
52081 }
52082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52083         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
52084         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
52085         return ret_conv;
52086 }
52087
52088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52089         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
52090         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
52091         *ret_copy = OnionMessageContents_clone(orig_conv);
52092         int64_t ret_ref = tag_ptr(ret_copy, true);
52093         return ret_ref;
52094 }
52095
52096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
52097         void* a_ptr = untag_ptr(a);
52098         CHECK_ACCESS(a_ptr);
52099         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
52100         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
52101                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52102                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
52103         }
52104         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
52105         *ret_copy = OnionMessageContents_custom(a_conv);
52106         int64_t ret_ref = tag_ptr(ret_copy, true);
52107         return ret_ref;
52108 }
52109
52110 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
52111         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
52112         *ret_ret = CustomOnionMessageContents_clone(arg);
52113         return tag_ptr(ret_ret, true);
52114 }
52115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52116         void* arg_ptr = untag_ptr(arg);
52117         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52118         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
52119         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
52120         return ret_conv;
52121 }
52122
52123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52124         void* orig_ptr = untag_ptr(orig);
52125         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52126         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
52127         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
52128         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
52129         return tag_ptr(ret_ret, true);
52130 }
52131
52132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52133         if (!ptr_is_owned(this_ptr)) return;
52134         void* this_ptr_ptr = untag_ptr(this_ptr);
52135         CHECK_ACCESS(this_ptr_ptr);
52136         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
52137         FREE(untag_ptr(this_ptr));
52138         CustomOnionMessageContents_free(this_ptr_conv);
52139 }
52140
52141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52142         LDKFilesystemPersister this_obj_conv;
52143         this_obj_conv.inner = untag_ptr(this_obj);
52144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52146         FilesystemPersister_free(this_obj_conv);
52147 }
52148
52149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
52150         LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
52151         LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
52152         int64_t ret_ref = 0;
52153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52155         return ret_ref;
52156 }
52157
52158 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
52159         LDKFilesystemPersister this_arg_conv;
52160         this_arg_conv.inner = untag_ptr(this_arg);
52161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52163         this_arg_conv.is_owned = false;
52164         LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
52165         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
52166         Str_free(ret_str);
52167         return ret_conv;
52168 }
52169
52170 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) {
52171         LDKFilesystemPersister this_arg_conv;
52172         this_arg_conv.inner = untag_ptr(this_arg);
52173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52175         this_arg_conv.is_owned = false;
52176         void* entropy_source_ptr = untag_ptr(entropy_source);
52177         CHECK_ACCESS(entropy_source_ptr);
52178         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
52179         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
52180                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52181                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
52182         }
52183         void* signer_provider_ptr = untag_ptr(signer_provider);
52184         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
52185         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
52186         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
52187         *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, entropy_source_conv, signer_provider_conv);
52188         return tag_ptr(ret_conv, true);
52189 }
52190
52191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52192         LDKBackgroundProcessor this_obj_conv;
52193         this_obj_conv.inner = untag_ptr(this_obj);
52194         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52196         BackgroundProcessor_free(this_obj_conv);
52197 }
52198
52199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52200         if (!ptr_is_owned(this_ptr)) return;
52201         void* this_ptr_ptr = untag_ptr(this_ptr);
52202         CHECK_ACCESS(this_ptr_ptr);
52203         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
52204         FREE(untag_ptr(this_ptr));
52205         GossipSync_free(this_ptr_conv);
52206 }
52207
52208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
52209         LDKP2PGossipSync a_conv;
52210         a_conv.inner = untag_ptr(a);
52211         a_conv.is_owned = ptr_is_owned(a);
52212         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52213         a_conv.is_owned = false;
52214         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
52215         *ret_copy = GossipSync_p2_p(&a_conv);
52216         int64_t ret_ref = tag_ptr(ret_copy, true);
52217         return ret_ref;
52218 }
52219
52220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
52221         LDKRapidGossipSync a_conv;
52222         a_conv.inner = untag_ptr(a);
52223         a_conv.is_owned = ptr_is_owned(a);
52224         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52225         a_conv.is_owned = false;
52226         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
52227         *ret_copy = GossipSync_rapid(&a_conv);
52228         int64_t ret_ref = tag_ptr(ret_copy, true);
52229         return ret_ref;
52230 }
52231
52232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
52233         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
52234         *ret_copy = GossipSync_none();
52235         int64_t ret_ref = tag_ptr(ret_copy, true);
52236         return ret_ref;
52237 }
52238
52239 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) {
52240         void* persister_ptr = untag_ptr(persister);
52241         CHECK_ACCESS(persister_ptr);
52242         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
52243         if (persister_conv.free == LDKPersister_JCalls_free) {
52244                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52245                 LDKPersister_JCalls_cloned(&persister_conv);
52246         }
52247         void* event_handler_ptr = untag_ptr(event_handler);
52248         CHECK_ACCESS(event_handler_ptr);
52249         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
52250         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
52251                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52252                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
52253         }
52254         LDKChainMonitor chain_monitor_conv;
52255         chain_monitor_conv.inner = untag_ptr(chain_monitor);
52256         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
52257         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
52258         chain_monitor_conv.is_owned = false;
52259         LDKChannelManager channel_manager_conv;
52260         channel_manager_conv.inner = untag_ptr(channel_manager);
52261         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
52262         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
52263         channel_manager_conv.is_owned = false;
52264         void* gossip_sync_ptr = untag_ptr(gossip_sync);
52265         CHECK_ACCESS(gossip_sync_ptr);
52266         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
52267         // WARNING: we may need a move here but no clone is available for LDKGossipSync
52268         LDKPeerManager peer_manager_conv;
52269         peer_manager_conv.inner = untag_ptr(peer_manager);
52270         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
52271         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
52272         peer_manager_conv.is_owned = false;
52273         void* logger_ptr = untag_ptr(logger);
52274         CHECK_ACCESS(logger_ptr);
52275         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52276         if (logger_conv.free == LDKLogger_JCalls_free) {
52277                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52278                 LDKLogger_JCalls_cloned(&logger_conv);
52279         }
52280         void* scorer_ptr = untag_ptr(scorer);
52281         CHECK_ACCESS(scorer_ptr);
52282         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
52283         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
52284         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
52285                 // Manually implement clone for Java trait instances
52286                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
52287                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52288                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
52289                 }
52290         }
52291         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);
52292         int64_t ret_ref = 0;
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52295         return ret_ref;
52296 }
52297
52298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
52299         LDKBackgroundProcessor this_arg_conv;
52300         this_arg_conv.inner = untag_ptr(this_arg);
52301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52303         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
52304         
52305         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
52306         *ret_conv = BackgroundProcessor_join(this_arg_conv);
52307         return tag_ptr(ret_conv, true);
52308 }
52309
52310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
52311         LDKBackgroundProcessor this_arg_conv;
52312         this_arg_conv.inner = untag_ptr(this_arg);
52313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52315         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
52316         
52317         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
52318         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
52319         return tag_ptr(ret_conv, true);
52320 }
52321
52322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52323         if (!ptr_is_owned(this_ptr)) return;
52324         void* this_ptr_ptr = untag_ptr(this_ptr);
52325         CHECK_ACCESS(this_ptr_ptr);
52326         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
52327         FREE(untag_ptr(this_ptr));
52328         ParseError_free(this_ptr_conv);
52329 }
52330
52331 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
52332         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52333         *ret_copy = ParseError_clone(arg);
52334         int64_t ret_ref = tag_ptr(ret_copy, true);
52335         return ret_ref;
52336 }
52337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52338         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
52339         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
52340         return ret_conv;
52341 }
52342
52343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52344         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
52345         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52346         *ret_copy = ParseError_clone(orig_conv);
52347         int64_t ret_ref = tag_ptr(ret_copy, true);
52348         return ret_ref;
52349 }
52350
52351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
52352         void* a_ptr = untag_ptr(a);
52353         CHECK_ACCESS(a_ptr);
52354         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
52355         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
52356         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52357         *ret_copy = ParseError_bech32_error(a_conv);
52358         int64_t ret_ref = tag_ptr(ret_copy, true);
52359         return ret_ref;
52360 }
52361
52362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
52363         
52364         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52365         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
52366         int64_t ret_ref = tag_ptr(ret_copy, true);
52367         return ret_ref;
52368 }
52369
52370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
52371         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
52372         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52373         *ret_copy = ParseError_malformed_signature(a_conv);
52374         int64_t ret_ref = tag_ptr(ret_copy, true);
52375         return ret_ref;
52376 }
52377
52378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
52379         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52380         *ret_copy = ParseError_bad_prefix();
52381         int64_t ret_ref = tag_ptr(ret_copy, true);
52382         return ret_ref;
52383 }
52384
52385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
52386         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52387         *ret_copy = ParseError_unknown_currency();
52388         int64_t ret_ref = tag_ptr(ret_copy, true);
52389         return ret_ref;
52390 }
52391
52392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
52393         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52394         *ret_copy = ParseError_unknown_si_prefix();
52395         int64_t ret_ref = tag_ptr(ret_copy, true);
52396         return ret_ref;
52397 }
52398
52399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
52400         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52401         *ret_copy = ParseError_malformed_hrp();
52402         int64_t ret_ref = tag_ptr(ret_copy, true);
52403         return ret_ref;
52404 }
52405
52406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
52407         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52408         *ret_copy = ParseError_too_short_data_part();
52409         int64_t ret_ref = tag_ptr(ret_copy, true);
52410         return ret_ref;
52411 }
52412
52413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
52414         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52415         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
52416         int64_t ret_ref = tag_ptr(ret_copy, true);
52417         return ret_ref;
52418 }
52419
52420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
52421         
52422         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52423         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
52424         int64_t ret_ref = tag_ptr(ret_copy, true);
52425         return ret_ref;
52426 }
52427
52428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
52429         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52430         *ret_copy = ParseError_padding_error();
52431         int64_t ret_ref = tag_ptr(ret_copy, true);
52432         return ret_ref;
52433 }
52434
52435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
52436         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52437         *ret_copy = ParseError_integer_overflow_error();
52438         int64_t ret_ref = tag_ptr(ret_copy, true);
52439         return ret_ref;
52440 }
52441
52442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
52443         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52444         *ret_copy = ParseError_invalid_seg_wit_program_length();
52445         int64_t ret_ref = tag_ptr(ret_copy, true);
52446         return ret_ref;
52447 }
52448
52449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
52450         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52451         *ret_copy = ParseError_invalid_pub_key_hash_length();
52452         int64_t ret_ref = tag_ptr(ret_copy, true);
52453         return ret_ref;
52454 }
52455
52456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
52457         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52458         *ret_copy = ParseError_invalid_script_hash_length();
52459         int64_t ret_ref = tag_ptr(ret_copy, true);
52460         return ret_ref;
52461 }
52462
52463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
52464         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52465         *ret_copy = ParseError_invalid_recovery_id();
52466         int64_t ret_ref = tag_ptr(ret_copy, true);
52467         return ret_ref;
52468 }
52469
52470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
52471         LDKStr a_conv = java_to_owned_str(env, a);
52472         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52473         *ret_copy = ParseError_invalid_slice_length(a_conv);
52474         int64_t ret_ref = tag_ptr(ret_copy, true);
52475         return ret_ref;
52476 }
52477
52478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
52479         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
52480         *ret_copy = ParseError_skip();
52481         int64_t ret_ref = tag_ptr(ret_copy, true);
52482         return ret_ref;
52483 }
52484
52485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52486         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
52487         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
52488         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
52489         return ret_conv;
52490 }
52491
52492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52493         if (!ptr_is_owned(this_ptr)) return;
52494         void* this_ptr_ptr = untag_ptr(this_ptr);
52495         CHECK_ACCESS(this_ptr_ptr);
52496         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
52497         FREE(untag_ptr(this_ptr));
52498         ParseOrSemanticError_free(this_ptr_conv);
52499 }
52500
52501 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
52502         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
52503         *ret_copy = ParseOrSemanticError_clone(arg);
52504         int64_t ret_ref = tag_ptr(ret_copy, true);
52505         return ret_ref;
52506 }
52507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52508         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
52509         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
52510         return ret_conv;
52511 }
52512
52513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52514         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
52515         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
52516         *ret_copy = ParseOrSemanticError_clone(orig_conv);
52517         int64_t ret_ref = tag_ptr(ret_copy, true);
52518         return ret_ref;
52519 }
52520
52521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
52522         void* a_ptr = untag_ptr(a);
52523         CHECK_ACCESS(a_ptr);
52524         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
52525         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
52526         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
52527         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
52528         int64_t ret_ref = tag_ptr(ret_copy, true);
52529         return ret_ref;
52530 }
52531
52532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
52533         LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
52534         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
52535         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
52536         int64_t ret_ref = tag_ptr(ret_copy, true);
52537         return ret_ref;
52538 }
52539
52540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52541         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
52542         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
52543         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
52544         return ret_conv;
52545 }
52546
52547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52548         LDKInvoice this_obj_conv;
52549         this_obj_conv.inner = untag_ptr(this_obj);
52550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52552         Invoice_free(this_obj_conv);
52553 }
52554
52555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52556         LDKInvoice a_conv;
52557         a_conv.inner = untag_ptr(a);
52558         a_conv.is_owned = ptr_is_owned(a);
52559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52560         a_conv.is_owned = false;
52561         LDKInvoice b_conv;
52562         b_conv.inner = untag_ptr(b);
52563         b_conv.is_owned = ptr_is_owned(b);
52564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52565         b_conv.is_owned = false;
52566         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
52567         return ret_conv;
52568 }
52569
52570 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
52571         LDKInvoice ret_var = Invoice_clone(arg);
52572         int64_t ret_ref = 0;
52573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52575         return ret_ref;
52576 }
52577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52578         LDKInvoice arg_conv;
52579         arg_conv.inner = untag_ptr(arg);
52580         arg_conv.is_owned = ptr_is_owned(arg);
52581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52582         arg_conv.is_owned = false;
52583         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
52584         return ret_conv;
52585 }
52586
52587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52588         LDKInvoice orig_conv;
52589         orig_conv.inner = untag_ptr(orig);
52590         orig_conv.is_owned = ptr_is_owned(orig);
52591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52592         orig_conv.is_owned = false;
52593         LDKInvoice ret_var = Invoice_clone(&orig_conv);
52594         int64_t ret_ref = 0;
52595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52597         return ret_ref;
52598 }
52599
52600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
52601         LDKInvoice o_conv;
52602         o_conv.inner = untag_ptr(o);
52603         o_conv.is_owned = ptr_is_owned(o);
52604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52605         o_conv.is_owned = false;
52606         int64_t ret_conv = Invoice_hash(&o_conv);
52607         return ret_conv;
52608 }
52609
52610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52611         LDKSignedRawInvoice this_obj_conv;
52612         this_obj_conv.inner = untag_ptr(this_obj);
52613         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52615         SignedRawInvoice_free(this_obj_conv);
52616 }
52617
52618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52619         LDKSignedRawInvoice a_conv;
52620         a_conv.inner = untag_ptr(a);
52621         a_conv.is_owned = ptr_is_owned(a);
52622         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52623         a_conv.is_owned = false;
52624         LDKSignedRawInvoice b_conv;
52625         b_conv.inner = untag_ptr(b);
52626         b_conv.is_owned = ptr_is_owned(b);
52627         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52628         b_conv.is_owned = false;
52629         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
52630         return ret_conv;
52631 }
52632
52633 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
52634         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
52635         int64_t ret_ref = 0;
52636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52638         return ret_ref;
52639 }
52640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52641         LDKSignedRawInvoice arg_conv;
52642         arg_conv.inner = untag_ptr(arg);
52643         arg_conv.is_owned = ptr_is_owned(arg);
52644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52645         arg_conv.is_owned = false;
52646         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
52647         return ret_conv;
52648 }
52649
52650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52651         LDKSignedRawInvoice orig_conv;
52652         orig_conv.inner = untag_ptr(orig);
52653         orig_conv.is_owned = ptr_is_owned(orig);
52654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52655         orig_conv.is_owned = false;
52656         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
52657         int64_t ret_ref = 0;
52658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52660         return ret_ref;
52661 }
52662
52663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
52664         LDKSignedRawInvoice o_conv;
52665         o_conv.inner = untag_ptr(o);
52666         o_conv.is_owned = ptr_is_owned(o);
52667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52668         o_conv.is_owned = false;
52669         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
52670         return ret_conv;
52671 }
52672
52673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52674         LDKRawInvoice this_obj_conv;
52675         this_obj_conv.inner = untag_ptr(this_obj);
52676         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52678         RawInvoice_free(this_obj_conv);
52679 }
52680
52681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
52682         LDKRawInvoice this_ptr_conv;
52683         this_ptr_conv.inner = untag_ptr(this_ptr);
52684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52686         this_ptr_conv.is_owned = false;
52687         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
52688         int64_t ret_ref = 0;
52689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52691         return ret_ref;
52692 }
52693
52694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52695         LDKRawInvoice this_ptr_conv;
52696         this_ptr_conv.inner = untag_ptr(this_ptr);
52697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52699         this_ptr_conv.is_owned = false;
52700         LDKRawDataPart val_conv;
52701         val_conv.inner = untag_ptr(val);
52702         val_conv.is_owned = ptr_is_owned(val);
52703         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52704         val_conv = RawDataPart_clone(&val_conv);
52705         RawInvoice_set_data(&this_ptr_conv, val_conv);
52706 }
52707
52708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52709         LDKRawInvoice a_conv;
52710         a_conv.inner = untag_ptr(a);
52711         a_conv.is_owned = ptr_is_owned(a);
52712         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52713         a_conv.is_owned = false;
52714         LDKRawInvoice b_conv;
52715         b_conv.inner = untag_ptr(b);
52716         b_conv.is_owned = ptr_is_owned(b);
52717         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52718         b_conv.is_owned = false;
52719         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
52720         return ret_conv;
52721 }
52722
52723 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
52724         LDKRawInvoice ret_var = RawInvoice_clone(arg);
52725         int64_t ret_ref = 0;
52726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52728         return ret_ref;
52729 }
52730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52731         LDKRawInvoice arg_conv;
52732         arg_conv.inner = untag_ptr(arg);
52733         arg_conv.is_owned = ptr_is_owned(arg);
52734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52735         arg_conv.is_owned = false;
52736         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
52737         return ret_conv;
52738 }
52739
52740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52741         LDKRawInvoice orig_conv;
52742         orig_conv.inner = untag_ptr(orig);
52743         orig_conv.is_owned = ptr_is_owned(orig);
52744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52745         orig_conv.is_owned = false;
52746         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
52747         int64_t ret_ref = 0;
52748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52750         return ret_ref;
52751 }
52752
52753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
52754         LDKRawInvoice o_conv;
52755         o_conv.inner = untag_ptr(o);
52756         o_conv.is_owned = ptr_is_owned(o);
52757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52758         o_conv.is_owned = false;
52759         int64_t ret_conv = RawInvoice_hash(&o_conv);
52760         return ret_conv;
52761 }
52762
52763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52764         LDKRawDataPart this_obj_conv;
52765         this_obj_conv.inner = untag_ptr(this_obj);
52766         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52768         RawDataPart_free(this_obj_conv);
52769 }
52770
52771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
52772         LDKRawDataPart this_ptr_conv;
52773         this_ptr_conv.inner = untag_ptr(this_ptr);
52774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52776         this_ptr_conv.is_owned = false;
52777         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
52778         int64_t ret_ref = 0;
52779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52781         return ret_ref;
52782 }
52783
52784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52785         LDKRawDataPart this_ptr_conv;
52786         this_ptr_conv.inner = untag_ptr(this_ptr);
52787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52789         this_ptr_conv.is_owned = false;
52790         LDKPositiveTimestamp val_conv;
52791         val_conv.inner = untag_ptr(val);
52792         val_conv.is_owned = ptr_is_owned(val);
52793         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52794         val_conv = PositiveTimestamp_clone(&val_conv);
52795         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
52796 }
52797
52798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52799         LDKRawDataPart a_conv;
52800         a_conv.inner = untag_ptr(a);
52801         a_conv.is_owned = ptr_is_owned(a);
52802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52803         a_conv.is_owned = false;
52804         LDKRawDataPart b_conv;
52805         b_conv.inner = untag_ptr(b);
52806         b_conv.is_owned = ptr_is_owned(b);
52807         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52808         b_conv.is_owned = false;
52809         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
52810         return ret_conv;
52811 }
52812
52813 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
52814         LDKRawDataPart ret_var = RawDataPart_clone(arg);
52815         int64_t ret_ref = 0;
52816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52818         return ret_ref;
52819 }
52820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52821         LDKRawDataPart arg_conv;
52822         arg_conv.inner = untag_ptr(arg);
52823         arg_conv.is_owned = ptr_is_owned(arg);
52824         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52825         arg_conv.is_owned = false;
52826         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
52827         return ret_conv;
52828 }
52829
52830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52831         LDKRawDataPart orig_conv;
52832         orig_conv.inner = untag_ptr(orig);
52833         orig_conv.is_owned = ptr_is_owned(orig);
52834         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52835         orig_conv.is_owned = false;
52836         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
52837         int64_t ret_ref = 0;
52838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52840         return ret_ref;
52841 }
52842
52843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
52844         LDKRawDataPart o_conv;
52845         o_conv.inner = untag_ptr(o);
52846         o_conv.is_owned = ptr_is_owned(o);
52847         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52848         o_conv.is_owned = false;
52849         int64_t ret_conv = RawDataPart_hash(&o_conv);
52850         return ret_conv;
52851 }
52852
52853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52854         LDKPositiveTimestamp this_obj_conv;
52855         this_obj_conv.inner = untag_ptr(this_obj);
52856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52858         PositiveTimestamp_free(this_obj_conv);
52859 }
52860
52861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52862         LDKPositiveTimestamp a_conv;
52863         a_conv.inner = untag_ptr(a);
52864         a_conv.is_owned = ptr_is_owned(a);
52865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52866         a_conv.is_owned = false;
52867         LDKPositiveTimestamp b_conv;
52868         b_conv.inner = untag_ptr(b);
52869         b_conv.is_owned = ptr_is_owned(b);
52870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52871         b_conv.is_owned = false;
52872         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
52873         return ret_conv;
52874 }
52875
52876 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
52877         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
52878         int64_t ret_ref = 0;
52879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52881         return ret_ref;
52882 }
52883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52884         LDKPositiveTimestamp arg_conv;
52885         arg_conv.inner = untag_ptr(arg);
52886         arg_conv.is_owned = ptr_is_owned(arg);
52887         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52888         arg_conv.is_owned = false;
52889         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
52890         return ret_conv;
52891 }
52892
52893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52894         LDKPositiveTimestamp orig_conv;
52895         orig_conv.inner = untag_ptr(orig);
52896         orig_conv.is_owned = ptr_is_owned(orig);
52897         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52898         orig_conv.is_owned = false;
52899         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
52900         int64_t ret_ref = 0;
52901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52903         return ret_ref;
52904 }
52905
52906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
52907         LDKPositiveTimestamp o_conv;
52908         o_conv.inner = untag_ptr(o);
52909         o_conv.is_owned = ptr_is_owned(o);
52910         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52911         o_conv.is_owned = false;
52912         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
52913         return ret_conv;
52914 }
52915
52916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52917         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
52918         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
52919         return ret_conv;
52920 }
52921
52922 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
52923         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
52924         return ret_conv;
52925 }
52926
52927 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
52928         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
52929         return ret_conv;
52930 }
52931
52932 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
52933         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
52934         return ret_conv;
52935 }
52936
52937 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
52938         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
52939         return ret_conv;
52940 }
52941
52942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52943         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
52944         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
52945         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
52946         return ret_conv;
52947 }
52948
52949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
52950         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
52951         int64_t ret_conv = SiPrefix_hash(o_conv);
52952         return ret_conv;
52953 }
52954
52955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
52956         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
52957         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
52958         return ret_conv;
52959 }
52960
52961 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52962         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
52963         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
52964         return ret_conv;
52965 }
52966
52967 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
52968         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
52969         return ret_conv;
52970 }
52971
52972 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
52973         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
52974         return ret_conv;
52975 }
52976
52977 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
52978         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
52979         return ret_conv;
52980 }
52981
52982 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
52983         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
52984         return ret_conv;
52985 }
52986
52987 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
52988         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
52989         return ret_conv;
52990 }
52991
52992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
52993         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
52994         int64_t ret_conv = Currency_hash(o_conv);
52995         return ret_conv;
52996 }
52997
52998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52999         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
53000         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
53001         jboolean ret_conv = Currency_eq(a_conv, b_conv);
53002         return ret_conv;
53003 }
53004
53005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53006         LDKSha256 this_obj_conv;
53007         this_obj_conv.inner = untag_ptr(this_obj);
53008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53010         Sha256_free(this_obj_conv);
53011 }
53012
53013 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
53014         LDKSha256 ret_var = Sha256_clone(arg);
53015         int64_t ret_ref = 0;
53016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53018         return ret_ref;
53019 }
53020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53021         LDKSha256 arg_conv;
53022         arg_conv.inner = untag_ptr(arg);
53023         arg_conv.is_owned = ptr_is_owned(arg);
53024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53025         arg_conv.is_owned = false;
53026         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
53027         return ret_conv;
53028 }
53029
53030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53031         LDKSha256 orig_conv;
53032         orig_conv.inner = untag_ptr(orig);
53033         orig_conv.is_owned = ptr_is_owned(orig);
53034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53035         orig_conv.is_owned = false;
53036         LDKSha256 ret_var = Sha256_clone(&orig_conv);
53037         int64_t ret_ref = 0;
53038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53040         return ret_ref;
53041 }
53042
53043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
53044         LDKSha256 o_conv;
53045         o_conv.inner = untag_ptr(o);
53046         o_conv.is_owned = ptr_is_owned(o);
53047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53048         o_conv.is_owned = false;
53049         int64_t ret_conv = Sha256_hash(&o_conv);
53050         return ret_conv;
53051 }
53052
53053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53054         LDKSha256 a_conv;
53055         a_conv.inner = untag_ptr(a);
53056         a_conv.is_owned = ptr_is_owned(a);
53057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53058         a_conv.is_owned = false;
53059         LDKSha256 b_conv;
53060         b_conv.inner = untag_ptr(b);
53061         b_conv.is_owned = ptr_is_owned(b);
53062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53063         b_conv.is_owned = false;
53064         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
53065         return ret_conv;
53066 }
53067
53068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53069         LDKDescription this_obj_conv;
53070         this_obj_conv.inner = untag_ptr(this_obj);
53071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53073         Description_free(this_obj_conv);
53074 }
53075
53076 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
53077         LDKDescription ret_var = Description_clone(arg);
53078         int64_t ret_ref = 0;
53079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53081         return ret_ref;
53082 }
53083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53084         LDKDescription arg_conv;
53085         arg_conv.inner = untag_ptr(arg);
53086         arg_conv.is_owned = ptr_is_owned(arg);
53087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53088         arg_conv.is_owned = false;
53089         int64_t ret_conv = Description_clone_ptr(&arg_conv);
53090         return ret_conv;
53091 }
53092
53093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53094         LDKDescription orig_conv;
53095         orig_conv.inner = untag_ptr(orig);
53096         orig_conv.is_owned = ptr_is_owned(orig);
53097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53098         orig_conv.is_owned = false;
53099         LDKDescription ret_var = Description_clone(&orig_conv);
53100         int64_t ret_ref = 0;
53101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53103         return ret_ref;
53104 }
53105
53106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
53107         LDKDescription o_conv;
53108         o_conv.inner = untag_ptr(o);
53109         o_conv.is_owned = ptr_is_owned(o);
53110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53111         o_conv.is_owned = false;
53112         int64_t ret_conv = Description_hash(&o_conv);
53113         return ret_conv;
53114 }
53115
53116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53117         LDKDescription a_conv;
53118         a_conv.inner = untag_ptr(a);
53119         a_conv.is_owned = ptr_is_owned(a);
53120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53121         a_conv.is_owned = false;
53122         LDKDescription b_conv;
53123         b_conv.inner = untag_ptr(b);
53124         b_conv.is_owned = ptr_is_owned(b);
53125         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53126         b_conv.is_owned = false;
53127         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
53128         return ret_conv;
53129 }
53130
53131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53132         LDKPayeePubKey this_obj_conv;
53133         this_obj_conv.inner = untag_ptr(this_obj);
53134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53136         PayeePubKey_free(this_obj_conv);
53137 }
53138
53139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
53140         LDKPayeePubKey this_ptr_conv;
53141         this_ptr_conv.inner = untag_ptr(this_ptr);
53142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53144         this_ptr_conv.is_owned = false;
53145         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53146         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
53147         return ret_arr;
53148 }
53149
53150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53151         LDKPayeePubKey this_ptr_conv;
53152         this_ptr_conv.inner = untag_ptr(this_ptr);
53153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53155         this_ptr_conv.is_owned = false;
53156         LDKPublicKey val_ref;
53157         CHECK((*env)->GetArrayLength(env, val) == 33);
53158         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53159         PayeePubKey_set_a(&this_ptr_conv, val_ref);
53160 }
53161
53162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
53163         LDKPublicKey a_arg_ref;
53164         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
53165         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
53166         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
53167         int64_t ret_ref = 0;
53168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53170         return ret_ref;
53171 }
53172
53173 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
53174         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
53175         int64_t ret_ref = 0;
53176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53178         return ret_ref;
53179 }
53180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53181         LDKPayeePubKey arg_conv;
53182         arg_conv.inner = untag_ptr(arg);
53183         arg_conv.is_owned = ptr_is_owned(arg);
53184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53185         arg_conv.is_owned = false;
53186         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
53187         return ret_conv;
53188 }
53189
53190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53191         LDKPayeePubKey orig_conv;
53192         orig_conv.inner = untag_ptr(orig);
53193         orig_conv.is_owned = ptr_is_owned(orig);
53194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53195         orig_conv.is_owned = false;
53196         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
53197         int64_t ret_ref = 0;
53198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53200         return ret_ref;
53201 }
53202
53203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
53204         LDKPayeePubKey o_conv;
53205         o_conv.inner = untag_ptr(o);
53206         o_conv.is_owned = ptr_is_owned(o);
53207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53208         o_conv.is_owned = false;
53209         int64_t ret_conv = PayeePubKey_hash(&o_conv);
53210         return ret_conv;
53211 }
53212
53213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53214         LDKPayeePubKey a_conv;
53215         a_conv.inner = untag_ptr(a);
53216         a_conv.is_owned = ptr_is_owned(a);
53217         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53218         a_conv.is_owned = false;
53219         LDKPayeePubKey b_conv;
53220         b_conv.inner = untag_ptr(b);
53221         b_conv.is_owned = ptr_is_owned(b);
53222         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53223         b_conv.is_owned = false;
53224         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
53225         return ret_conv;
53226 }
53227
53228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53229         LDKExpiryTime this_obj_conv;
53230         this_obj_conv.inner = untag_ptr(this_obj);
53231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53233         ExpiryTime_free(this_obj_conv);
53234 }
53235
53236 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
53237         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
53238         int64_t ret_ref = 0;
53239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53241         return ret_ref;
53242 }
53243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53244         LDKExpiryTime arg_conv;
53245         arg_conv.inner = untag_ptr(arg);
53246         arg_conv.is_owned = ptr_is_owned(arg);
53247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53248         arg_conv.is_owned = false;
53249         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
53250         return ret_conv;
53251 }
53252
53253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53254         LDKExpiryTime orig_conv;
53255         orig_conv.inner = untag_ptr(orig);
53256         orig_conv.is_owned = ptr_is_owned(orig);
53257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53258         orig_conv.is_owned = false;
53259         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
53260         int64_t ret_ref = 0;
53261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53263         return ret_ref;
53264 }
53265
53266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
53267         LDKExpiryTime o_conv;
53268         o_conv.inner = untag_ptr(o);
53269         o_conv.is_owned = ptr_is_owned(o);
53270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53271         o_conv.is_owned = false;
53272         int64_t ret_conv = ExpiryTime_hash(&o_conv);
53273         return ret_conv;
53274 }
53275
53276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53277         LDKExpiryTime a_conv;
53278         a_conv.inner = untag_ptr(a);
53279         a_conv.is_owned = ptr_is_owned(a);
53280         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53281         a_conv.is_owned = false;
53282         LDKExpiryTime b_conv;
53283         b_conv.inner = untag_ptr(b);
53284         b_conv.is_owned = ptr_is_owned(b);
53285         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53286         b_conv.is_owned = false;
53287         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
53288         return ret_conv;
53289 }
53290
53291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53292         LDKMinFinalCltvExpiryDelta this_obj_conv;
53293         this_obj_conv.inner = untag_ptr(this_obj);
53294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53296         MinFinalCltvExpiryDelta_free(this_obj_conv);
53297 }
53298
53299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
53300         LDKMinFinalCltvExpiryDelta this_ptr_conv;
53301         this_ptr_conv.inner = untag_ptr(this_ptr);
53302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53304         this_ptr_conv.is_owned = false;
53305         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
53306         return ret_conv;
53307 }
53308
53309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53310         LDKMinFinalCltvExpiryDelta this_ptr_conv;
53311         this_ptr_conv.inner = untag_ptr(this_ptr);
53312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53314         this_ptr_conv.is_owned = false;
53315         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
53316 }
53317
53318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
53319         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
53320         int64_t ret_ref = 0;
53321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53323         return ret_ref;
53324 }
53325
53326 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
53327         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
53328         int64_t ret_ref = 0;
53329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53331         return ret_ref;
53332 }
53333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53334         LDKMinFinalCltvExpiryDelta arg_conv;
53335         arg_conv.inner = untag_ptr(arg);
53336         arg_conv.is_owned = ptr_is_owned(arg);
53337         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53338         arg_conv.is_owned = false;
53339         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
53340         return ret_conv;
53341 }
53342
53343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53344         LDKMinFinalCltvExpiryDelta orig_conv;
53345         orig_conv.inner = untag_ptr(orig);
53346         orig_conv.is_owned = ptr_is_owned(orig);
53347         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53348         orig_conv.is_owned = false;
53349         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
53350         int64_t ret_ref = 0;
53351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53353         return ret_ref;
53354 }
53355
53356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
53357         LDKMinFinalCltvExpiryDelta o_conv;
53358         o_conv.inner = untag_ptr(o);
53359         o_conv.is_owned = ptr_is_owned(o);
53360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53361         o_conv.is_owned = false;
53362         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
53363         return ret_conv;
53364 }
53365
53366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53367         LDKMinFinalCltvExpiryDelta a_conv;
53368         a_conv.inner = untag_ptr(a);
53369         a_conv.is_owned = ptr_is_owned(a);
53370         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53371         a_conv.is_owned = false;
53372         LDKMinFinalCltvExpiryDelta b_conv;
53373         b_conv.inner = untag_ptr(b);
53374         b_conv.is_owned = ptr_is_owned(b);
53375         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53376         b_conv.is_owned = false;
53377         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
53378         return ret_conv;
53379 }
53380
53381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
53382         if (!ptr_is_owned(this_ptr)) return;
53383         void* this_ptr_ptr = untag_ptr(this_ptr);
53384         CHECK_ACCESS(this_ptr_ptr);
53385         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
53386         FREE(untag_ptr(this_ptr));
53387         Fallback_free(this_ptr_conv);
53388 }
53389
53390 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
53391         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
53392         *ret_copy = Fallback_clone(arg);
53393         int64_t ret_ref = tag_ptr(ret_copy, true);
53394         return ret_ref;
53395 }
53396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53397         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
53398         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
53399         return ret_conv;
53400 }
53401
53402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53403         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
53404         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
53405         *ret_copy = Fallback_clone(orig_conv);
53406         int64_t ret_ref = tag_ptr(ret_copy, true);
53407         return ret_ref;
53408 }
53409
53410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
53411         
53412         LDKCVec_u8Z program_ref;
53413         program_ref.datalen = (*env)->GetArrayLength(env, program);
53414         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
53415         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
53416         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
53417         *ret_copy = Fallback_seg_wit_program((LDKU5){ ._0 = version }, program_ref);
53418         int64_t ret_ref = tag_ptr(ret_copy, true);
53419         return ret_ref;
53420 }
53421
53422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
53423         LDKTwentyBytes a_ref;
53424         CHECK((*env)->GetArrayLength(env, a) == 20);
53425         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
53426         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
53427         *ret_copy = Fallback_pub_key_hash(a_ref);
53428         int64_t ret_ref = tag_ptr(ret_copy, true);
53429         return ret_ref;
53430 }
53431
53432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
53433         LDKTwentyBytes a_ref;
53434         CHECK((*env)->GetArrayLength(env, a) == 20);
53435         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
53436         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
53437         *ret_copy = Fallback_script_hash(a_ref);
53438         int64_t ret_ref = tag_ptr(ret_copy, true);
53439         return ret_ref;
53440 }
53441
53442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
53443         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
53444         int64_t ret_conv = Fallback_hash(o_conv);
53445         return ret_conv;
53446 }
53447
53448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53449         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
53450         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
53451         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
53452         return ret_conv;
53453 }
53454
53455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53456         LDKInvoiceSignature this_obj_conv;
53457         this_obj_conv.inner = untag_ptr(this_obj);
53458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53460         InvoiceSignature_free(this_obj_conv);
53461 }
53462
53463 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
53464         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
53465         int64_t ret_ref = 0;
53466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53468         return ret_ref;
53469 }
53470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53471         LDKInvoiceSignature arg_conv;
53472         arg_conv.inner = untag_ptr(arg);
53473         arg_conv.is_owned = ptr_is_owned(arg);
53474         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53475         arg_conv.is_owned = false;
53476         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
53477         return ret_conv;
53478 }
53479
53480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53481         LDKInvoiceSignature orig_conv;
53482         orig_conv.inner = untag_ptr(orig);
53483         orig_conv.is_owned = ptr_is_owned(orig);
53484         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53485         orig_conv.is_owned = false;
53486         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
53487         int64_t ret_ref = 0;
53488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53490         return ret_ref;
53491 }
53492
53493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
53494         LDKInvoiceSignature o_conv;
53495         o_conv.inner = untag_ptr(o);
53496         o_conv.is_owned = ptr_is_owned(o);
53497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53498         o_conv.is_owned = false;
53499         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
53500         return ret_conv;
53501 }
53502
53503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53504         LDKInvoiceSignature a_conv;
53505         a_conv.inner = untag_ptr(a);
53506         a_conv.is_owned = ptr_is_owned(a);
53507         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53508         a_conv.is_owned = false;
53509         LDKInvoiceSignature b_conv;
53510         b_conv.inner = untag_ptr(b);
53511         b_conv.is_owned = ptr_is_owned(b);
53512         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53513         b_conv.is_owned = false;
53514         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
53515         return ret_conv;
53516 }
53517
53518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53519         LDKPrivateRoute this_obj_conv;
53520         this_obj_conv.inner = untag_ptr(this_obj);
53521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53523         PrivateRoute_free(this_obj_conv);
53524 }
53525
53526 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
53527         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
53528         int64_t ret_ref = 0;
53529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53531         return ret_ref;
53532 }
53533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53534         LDKPrivateRoute arg_conv;
53535         arg_conv.inner = untag_ptr(arg);
53536         arg_conv.is_owned = ptr_is_owned(arg);
53537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53538         arg_conv.is_owned = false;
53539         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
53540         return ret_conv;
53541 }
53542
53543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53544         LDKPrivateRoute orig_conv;
53545         orig_conv.inner = untag_ptr(orig);
53546         orig_conv.is_owned = ptr_is_owned(orig);
53547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53548         orig_conv.is_owned = false;
53549         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
53550         int64_t ret_ref = 0;
53551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53553         return ret_ref;
53554 }
53555
53556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
53557         LDKPrivateRoute o_conv;
53558         o_conv.inner = untag_ptr(o);
53559         o_conv.is_owned = ptr_is_owned(o);
53560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53561         o_conv.is_owned = false;
53562         int64_t ret_conv = PrivateRoute_hash(&o_conv);
53563         return ret_conv;
53564 }
53565
53566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53567         LDKPrivateRoute a_conv;
53568         a_conv.inner = untag_ptr(a);
53569         a_conv.is_owned = ptr_is_owned(a);
53570         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53571         a_conv.is_owned = false;
53572         LDKPrivateRoute b_conv;
53573         b_conv.inner = untag_ptr(b);
53574         b_conv.is_owned = ptr_is_owned(b);
53575         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53576         b_conv.is_owned = false;
53577         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
53578         return ret_conv;
53579 }
53580
53581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
53582         LDKSignedRawInvoice this_arg_conv;
53583         this_arg_conv.inner = untag_ptr(this_arg);
53584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53586         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
53587         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
53588         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
53589         return tag_ptr(ret_conv, true);
53590 }
53591
53592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
53593         LDKSignedRawInvoice this_arg_conv;
53594         this_arg_conv.inner = untag_ptr(this_arg);
53595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53597         this_arg_conv.is_owned = false;
53598         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
53599         int64_t ret_ref = 0;
53600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53602         return ret_ref;
53603 }
53604
53605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
53606         LDKSignedRawInvoice this_arg_conv;
53607         this_arg_conv.inner = untag_ptr(this_arg);
53608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53610         this_arg_conv.is_owned = false;
53611         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53612         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_signable_hash(&this_arg_conv));
53613         return ret_arr;
53614 }
53615
53616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
53617         LDKSignedRawInvoice this_arg_conv;
53618         this_arg_conv.inner = untag_ptr(this_arg);
53619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53621         this_arg_conv.is_owned = false;
53622         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
53623         int64_t ret_ref = 0;
53624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53626         return ret_ref;
53627 }
53628
53629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53630         LDKSignedRawInvoice this_arg_conv;
53631         this_arg_conv.inner = untag_ptr(this_arg);
53632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53634         this_arg_conv.is_owned = false;
53635         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
53636         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
53637         return tag_ptr(ret_conv, true);
53638 }
53639
53640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
53641         LDKSignedRawInvoice this_arg_conv;
53642         this_arg_conv.inner = untag_ptr(this_arg);
53643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53645         this_arg_conv.is_owned = false;
53646         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
53647         return ret_conv;
53648 }
53649
53650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
53651         LDKRawInvoice this_arg_conv;
53652         this_arg_conv.inner = untag_ptr(this_arg);
53653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53655         this_arg_conv.is_owned = false;
53656         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53657         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_signable_hash(&this_arg_conv).data);
53658         return ret_arr;
53659 }
53660
53661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
53662         LDKRawInvoice this_arg_conv;
53663         this_arg_conv.inner = untag_ptr(this_arg);
53664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53666         this_arg_conv.is_owned = false;
53667         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
53668         int64_t ret_ref = 0;
53669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53671         return ret_ref;
53672 }
53673
53674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
53675         LDKRawInvoice this_arg_conv;
53676         this_arg_conv.inner = untag_ptr(this_arg);
53677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53679         this_arg_conv.is_owned = false;
53680         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
53681         int64_t ret_ref = 0;
53682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53684         return ret_ref;
53685 }
53686
53687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53688         LDKRawInvoice this_arg_conv;
53689         this_arg_conv.inner = untag_ptr(this_arg);
53690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53692         this_arg_conv.is_owned = false;
53693         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
53694         int64_t ret_ref = 0;
53695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53697         return ret_ref;
53698 }
53699
53700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
53701         LDKRawInvoice 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         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
53707         int64_t ret_ref = 0;
53708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53710         return ret_ref;
53711 }
53712
53713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
53714         LDKRawInvoice this_arg_conv;
53715         this_arg_conv.inner = untag_ptr(this_arg);
53716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53718         this_arg_conv.is_owned = false;
53719         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
53720         int64_t ret_ref = 0;
53721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53723         return ret_ref;
53724 }
53725
53726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
53727         LDKRawInvoice this_arg_conv;
53728         this_arg_conv.inner = untag_ptr(this_arg);
53729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53731         this_arg_conv.is_owned = false;
53732         LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv);
53733         int64_t ret_ref = 0;
53734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53736         return ret_ref;
53737 }
53738
53739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53740         LDKRawInvoice this_arg_conv;
53741         this_arg_conv.inner = untag_ptr(this_arg);
53742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53744         this_arg_conv.is_owned = false;
53745         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53746         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
53747         return ret_arr;
53748 }
53749
53750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
53751         LDKRawInvoice this_arg_conv;
53752         this_arg_conv.inner = untag_ptr(this_arg);
53753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53755         this_arg_conv.is_owned = false;
53756         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
53757         int64_t ret_ref = 0;
53758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53760         return ret_ref;
53761 }
53762
53763 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
53764         LDKRawInvoice this_arg_conv;
53765         this_arg_conv.inner = untag_ptr(this_arg);
53766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53768         this_arg_conv.is_owned = false;
53769         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
53770         int64_tArray ret_arr = NULL;
53771         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
53772         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
53773         for (size_t o = 0; o < ret_var.datalen; o++) {
53774                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
53775                 int64_t ret_conv_14_ref = 0;
53776                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
53777                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
53778                 ret_arr_ptr[o] = ret_conv_14_ref;
53779         }
53780         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
53781         FREE(ret_var.data);
53782         return ret_arr;
53783 }
53784
53785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
53786         LDKRawInvoice this_arg_conv;
53787         this_arg_conv.inner = untag_ptr(this_arg);
53788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53790         this_arg_conv.is_owned = false;
53791         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53792         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
53793         int64_t ret_ref = tag_ptr(ret_copy, true);
53794         return ret_ref;
53795 }
53796
53797 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
53798         LDKRawInvoice this_arg_conv;
53799         this_arg_conv.inner = untag_ptr(this_arg);
53800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53802         this_arg_conv.is_owned = false;
53803         jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
53804         return ret_conv;
53805 }
53806
53807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
53808         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
53809         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
53810         return tag_ptr(ret_conv, true);
53811 }
53812
53813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
53814         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
53815         *ret_conv = PositiveTimestamp_from_system_time(time);
53816         return tag_ptr(ret_conv, true);
53817 }
53818
53819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
53820         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
53821         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
53822         return tag_ptr(ret_conv, true);
53823 }
53824
53825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
53826         LDKPositiveTimestamp this_arg_conv;
53827         this_arg_conv.inner = untag_ptr(this_arg);
53828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53830         this_arg_conv.is_owned = false;
53831         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
53832         return ret_conv;
53833 }
53834
53835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
53836         LDKPositiveTimestamp this_arg_conv;
53837         this_arg_conv.inner = untag_ptr(this_arg);
53838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53840         this_arg_conv.is_owned = false;
53841         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
53842         return ret_conv;
53843 }
53844
53845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
53846         LDKPositiveTimestamp this_arg_conv;
53847         this_arg_conv.inner = untag_ptr(this_arg);
53848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53850         this_arg_conv.is_owned = false;
53851         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
53852         return ret_conv;
53853 }
53854
53855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
53856         LDKInvoice this_arg_conv;
53857         this_arg_conv.inner = untag_ptr(this_arg);
53858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53860         this_arg_conv = Invoice_clone(&this_arg_conv);
53861         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
53862         int64_t ret_ref = 0;
53863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53865         return ret_ref;
53866 }
53867
53868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
53869         LDKInvoice this_arg_conv;
53870         this_arg_conv.inner = untag_ptr(this_arg);
53871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53873         this_arg_conv.is_owned = false;
53874         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
53875         *ret_conv = Invoice_check_signature(&this_arg_conv);
53876         return tag_ptr(ret_conv, true);
53877 }
53878
53879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
53880         LDKSignedRawInvoice signed_invoice_conv;
53881         signed_invoice_conv.inner = untag_ptr(signed_invoice);
53882         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
53883         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
53884         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
53885         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
53886         *ret_conv = Invoice_from_signed(signed_invoice_conv);
53887         return tag_ptr(ret_conv, true);
53888 }
53889
53890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
53891         LDKInvoice this_arg_conv;
53892         this_arg_conv.inner = untag_ptr(this_arg);
53893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53895         this_arg_conv.is_owned = false;
53896         int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
53897         return ret_conv;
53898 }
53899
53900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
53901         LDKInvoice this_arg_conv;
53902         this_arg_conv.inner = untag_ptr(this_arg);
53903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53905         this_arg_conv.is_owned = false;
53906         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
53907         return ret_conv;
53908 }
53909
53910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
53911         LDKInvoice this_arg_conv;
53912         this_arg_conv.inner = untag_ptr(this_arg);
53913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53915         this_arg_conv.is_owned = false;
53916         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53917         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
53918         return ret_arr;
53919 }
53920
53921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53922         LDKInvoice this_arg_conv;
53923         this_arg_conv.inner = untag_ptr(this_arg);
53924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53926         this_arg_conv.is_owned = false;
53927         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53928         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
53929         return ret_arr;
53930 }
53931
53932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53933         LDKInvoice this_arg_conv;
53934         this_arg_conv.inner = untag_ptr(this_arg);
53935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53937         this_arg_conv.is_owned = false;
53938         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53939         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
53940         return ret_arr;
53941 }
53942
53943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
53944         LDKInvoice this_arg_conv;
53945         this_arg_conv.inner = untag_ptr(this_arg);
53946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53948         this_arg_conv.is_owned = false;
53949         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
53950         int64_t ret_ref = 0;
53951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53953         return ret_ref;
53954 }
53955
53956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53957         LDKInvoice 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53963         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
53964         return ret_arr;
53965 }
53966
53967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
53968         LDKInvoice this_arg_conv;
53969         this_arg_conv.inner = untag_ptr(this_arg);
53970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53972         this_arg_conv.is_owned = false;
53973         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
53974         return ret_conv;
53975 }
53976
53977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
53978         LDKInvoice this_arg_conv;
53979         this_arg_conv.inner = untag_ptr(this_arg);
53980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53982         this_arg_conv.is_owned = false;
53983         jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
53984         return ret_conv;
53985 }
53986
53987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
53988         LDKInvoice this_arg_conv;
53989         this_arg_conv.inner = untag_ptr(this_arg);
53990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53992         this_arg_conv.is_owned = false;
53993         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
53994         return ret_conv;
53995 }
53996
53997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
53998         LDKInvoice this_arg_conv;
53999         this_arg_conv.inner = untag_ptr(this_arg);
54000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54002         this_arg_conv.is_owned = false;
54003         int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
54004         return ret_conv;
54005 }
54006
54007 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
54008         LDKInvoice this_arg_conv;
54009         this_arg_conv.inner = untag_ptr(this_arg);
54010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54012         this_arg_conv.is_owned = false;
54013         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
54014         int64_tArray ret_arr = NULL;
54015         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
54016         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
54017         for (size_t o = 0; o < ret_var.datalen; o++) {
54018                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
54019                 int64_t ret_conv_14_ref = 0;
54020                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
54021                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
54022                 ret_arr_ptr[o] = ret_conv_14_ref;
54023         }
54024         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
54025         FREE(ret_var.data);
54026         return ret_arr;
54027 }
54028
54029 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
54030         LDKInvoice this_arg_conv;
54031         this_arg_conv.inner = untag_ptr(this_arg);
54032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54034         this_arg_conv.is_owned = false;
54035         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
54036         int64_tArray ret_arr = NULL;
54037         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
54038         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
54039         for (size_t l = 0; l < ret_var.datalen; l++) {
54040                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
54041                 int64_t ret_conv_11_ref = 0;
54042                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
54043                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
54044                 ret_arr_ptr[l] = ret_conv_11_ref;
54045         }
54046         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
54047         FREE(ret_var.data);
54048         return ret_arr;
54049 }
54050
54051 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
54052         LDKInvoice 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         jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
54058         return ret_conv;
54059 }
54060
54061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
54062         LDKInvoice this_arg_conv;
54063         this_arg_conv.inner = untag_ptr(this_arg);
54064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54066         this_arg_conv.is_owned = false;
54067         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54068         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
54069         int64_t ret_ref = tag_ptr(ret_copy, true);
54070         return ret_ref;
54071 }
54072
54073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
54074         LDKStr description_conv = java_to_owned_str(env, description);
54075         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
54076         *ret_conv = Description_new(description_conv);
54077         return tag_ptr(ret_conv, true);
54078 }
54079
54080 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
54081         LDKDescription this_arg_conv;
54082         this_arg_conv.inner = untag_ptr(this_arg);
54083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54085         this_arg_conv = Description_clone(&this_arg_conv);
54086         LDKStr ret_str = Description_into_inner(this_arg_conv);
54087         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54088         Str_free(ret_str);
54089         return ret_conv;
54090 }
54091
54092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
54093         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
54094         int64_t ret_ref = 0;
54095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54097         return ret_ref;
54098 }
54099
54100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
54101         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
54102         int64_t ret_ref = 0;
54103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54105         return ret_ref;
54106 }
54107
54108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
54109         LDKExpiryTime 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         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
54115         return ret_conv;
54116 }
54117
54118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
54119         LDKExpiryTime 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         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
54125         return ret_conv;
54126 }
54127
54128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
54129         LDKRouteHint hops_conv;
54130         hops_conv.inner = untag_ptr(hops);
54131         hops_conv.is_owned = ptr_is_owned(hops);
54132         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
54133         hops_conv = RouteHint_clone(&hops_conv);
54134         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
54135         *ret_conv = PrivateRoute_new(hops_conv);
54136         return tag_ptr(ret_conv, true);
54137 }
54138
54139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
54140         LDKPrivateRoute this_arg_conv;
54141         this_arg_conv.inner = untag_ptr(this_arg);
54142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54144         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
54145         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
54146         int64_t ret_ref = 0;
54147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54149         return ret_ref;
54150 }
54151
54152 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54153         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
54154         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
54155         return ret_conv;
54156 }
54157
54158 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
54159         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
54160         return ret_conv;
54161 }
54162
54163 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
54164         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
54165         return ret_conv;
54166 }
54167
54168 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
54169         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
54170         return ret_conv;
54171 }
54172
54173 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
54174         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
54175         return ret_conv;
54176 }
54177
54178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
54179         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
54180         return ret_conv;
54181 }
54182
54183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
54184         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
54185         return ret_conv;
54186 }
54187
54188 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54189         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
54190         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
54191         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
54192         return ret_conv;
54193 }
54194
54195 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54196         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
54197         LDKStr ret_str = CreationError_to_str(o_conv);
54198         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54199         Str_free(ret_str);
54200         return ret_conv;
54201 }
54202
54203 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54204         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
54205         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
54206         return ret_conv;
54207 }
54208
54209 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
54210         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
54211         return ret_conv;
54212 }
54213
54214 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
54215         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
54216         return ret_conv;
54217 }
54218
54219 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
54220         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
54221         return ret_conv;
54222 }
54223
54224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
54225         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
54226         return ret_conv;
54227 }
54228
54229 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
54230         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
54231         return ret_conv;
54232 }
54233
54234 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
54235         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
54236         return ret_conv;
54237 }
54238
54239 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
54240         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
54241         return ret_conv;
54242 }
54243
54244 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
54245         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
54246         return ret_conv;
54247 }
54248
54249 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
54250         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
54251         return ret_conv;
54252 }
54253
54254 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
54255         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
54256         return ret_conv;
54257 }
54258
54259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54260         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
54261         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
54262         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
54263         return ret_conv;
54264 }
54265
54266 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54267         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
54268         LDKStr ret_str = SemanticError_to_str(o_conv);
54269         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54270         Str_free(ret_str);
54271         return ret_conv;
54272 }
54273
54274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
54275         if (!ptr_is_owned(this_ptr)) return;
54276         void* this_ptr_ptr = untag_ptr(this_ptr);
54277         CHECK_ACCESS(this_ptr_ptr);
54278         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
54279         FREE(untag_ptr(this_ptr));
54280         SignOrCreationError_free(this_ptr_conv);
54281 }
54282
54283 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
54284         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
54285         *ret_copy = SignOrCreationError_clone(arg);
54286         int64_t ret_ref = tag_ptr(ret_copy, true);
54287         return ret_ref;
54288 }
54289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54290         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
54291         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
54292         return ret_conv;
54293 }
54294
54295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54296         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
54297         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
54298         *ret_copy = SignOrCreationError_clone(orig_conv);
54299         int64_t ret_ref = tag_ptr(ret_copy, true);
54300         return ret_ref;
54301 }
54302
54303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
54304         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
54305         *ret_copy = SignOrCreationError_sign_error();
54306         int64_t ret_ref = tag_ptr(ret_copy, true);
54307         return ret_ref;
54308 }
54309
54310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
54311         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
54312         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
54313         *ret_copy = SignOrCreationError_creation_error(a_conv);
54314         int64_t ret_ref = tag_ptr(ret_copy, true);
54315         return ret_ref;
54316 }
54317
54318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54319         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
54320         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
54321         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
54322         return ret_conv;
54323 }
54324
54325 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54326         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
54327         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
54328         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54329         Str_free(ret_str);
54330         return ret_conv;
54331 }
54332
54333 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) {
54334         LDKInvoice invoice_conv;
54335         invoice_conv.inner = untag_ptr(invoice);
54336         invoice_conv.is_owned = ptr_is_owned(invoice);
54337         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
54338         invoice_conv.is_owned = false;
54339         void* retry_strategy_ptr = untag_ptr(retry_strategy);
54340         CHECK_ACCESS(retry_strategy_ptr);
54341         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
54342         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
54343         LDKChannelManager channelmanager_conv;
54344         channelmanager_conv.inner = untag_ptr(channelmanager);
54345         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54346         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54347         channelmanager_conv.is_owned = false;
54348         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
54349         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
54350         return tag_ptr(ret_conv, true);
54351 }
54352
54353 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) {
54354         LDKInvoice invoice_conv;
54355         invoice_conv.inner = untag_ptr(invoice);
54356         invoice_conv.is_owned = ptr_is_owned(invoice);
54357         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
54358         invoice_conv.is_owned = false;
54359         LDKThirtyTwoBytes payment_id_ref;
54360         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
54361         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
54362         void* retry_strategy_ptr = untag_ptr(retry_strategy);
54363         CHECK_ACCESS(retry_strategy_ptr);
54364         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
54365         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
54366         LDKChannelManager channelmanager_conv;
54367         channelmanager_conv.inner = untag_ptr(channelmanager);
54368         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54369         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54370         channelmanager_conv.is_owned = false;
54371         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
54372         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
54373         return tag_ptr(ret_conv, true);
54374 }
54375
54376 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) {
54377         LDKInvoice invoice_conv;
54378         invoice_conv.inner = untag_ptr(invoice);
54379         invoice_conv.is_owned = ptr_is_owned(invoice);
54380         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
54381         invoice_conv.is_owned = false;
54382         void* retry_strategy_ptr = untag_ptr(retry_strategy);
54383         CHECK_ACCESS(retry_strategy_ptr);
54384         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
54385         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
54386         LDKChannelManager channelmanager_conv;
54387         channelmanager_conv.inner = untag_ptr(channelmanager);
54388         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54389         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54390         channelmanager_conv.is_owned = false;
54391         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
54392         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
54393         return tag_ptr(ret_conv, true);
54394 }
54395
54396 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) {
54397         LDKInvoice invoice_conv;
54398         invoice_conv.inner = untag_ptr(invoice);
54399         invoice_conv.is_owned = ptr_is_owned(invoice);
54400         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
54401         invoice_conv.is_owned = false;
54402         LDKThirtyTwoBytes payment_id_ref;
54403         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
54404         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
54405         void* retry_strategy_ptr = untag_ptr(retry_strategy);
54406         CHECK_ACCESS(retry_strategy_ptr);
54407         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
54408         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
54409         LDKChannelManager channelmanager_conv;
54410         channelmanager_conv.inner = untag_ptr(channelmanager);
54411         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54412         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54413         channelmanager_conv.is_owned = false;
54414         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
54415         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
54416         return tag_ptr(ret_conv, true);
54417 }
54418
54419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
54420         if (!ptr_is_owned(this_ptr)) return;
54421         void* this_ptr_ptr = untag_ptr(this_ptr);
54422         CHECK_ACCESS(this_ptr_ptr);
54423         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
54424         FREE(untag_ptr(this_ptr));
54425         PaymentError_free(this_ptr_conv);
54426 }
54427
54428 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
54429         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
54430         *ret_copy = PaymentError_clone(arg);
54431         int64_t ret_ref = tag_ptr(ret_copy, true);
54432         return ret_ref;
54433 }
54434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54435         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
54436         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
54437         return ret_conv;
54438 }
54439
54440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54441         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
54442         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
54443         *ret_copy = PaymentError_clone(orig_conv);
54444         int64_t ret_ref = tag_ptr(ret_copy, true);
54445         return ret_ref;
54446 }
54447
54448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
54449         LDKStr a_conv = java_to_owned_str(env, a);
54450         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
54451         *ret_copy = PaymentError_invoice(a_conv);
54452         int64_t ret_ref = tag_ptr(ret_copy, true);
54453         return ret_ref;
54454 }
54455
54456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) {
54457         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a);
54458         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
54459         *ret_copy = PaymentError_sending(a_conv);
54460         int64_t ret_ref = tag_ptr(ret_copy, true);
54461         return ret_ref;
54462 }
54463
54464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray 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) {
54465         void* amt_msat_ptr = untag_ptr(amt_msat);
54466         CHECK_ACCESS(amt_msat_ptr);
54467         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
54468         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
54469         LDKThirtyTwoBytes payment_hash_ref;
54470         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
54471         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
54472         LDKStr description_conv = java_to_owned_str(env, description);
54473         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
54474         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
54475         if (phantom_route_hints_constr.datalen > 0)
54476                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
54477         else
54478                 phantom_route_hints_constr.data = NULL;
54479         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
54480         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
54481                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
54482                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
54483                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
54484                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
54485                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
54486                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
54487                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
54488         }
54489         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
54490         void* entropy_source_ptr = untag_ptr(entropy_source);
54491         CHECK_ACCESS(entropy_source_ptr);
54492         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
54493         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
54494                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54495                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
54496         }
54497         void* node_signer_ptr = untag_ptr(node_signer);
54498         CHECK_ACCESS(node_signer_ptr);
54499         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
54500         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
54501                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54502                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
54503         }
54504         void* logger_ptr = untag_ptr(logger);
54505         CHECK_ACCESS(logger_ptr);
54506         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54507         if (logger_conv.free == LDKLogger_JCalls_free) {
54508                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54509                 LDKLogger_JCalls_cloned(&logger_conv);
54510         }
54511         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
54512         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
54513         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
54514         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
54515         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
54516         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
54517         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, 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);
54518         return tag_ptr(ret_conv, true);
54519 }
54520
54521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray 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) {
54522         void* amt_msat_ptr = untag_ptr(amt_msat);
54523         CHECK_ACCESS(amt_msat_ptr);
54524         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
54525         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
54526         LDKThirtyTwoBytes payment_hash_ref;
54527         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
54528         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
54529         LDKSha256 description_hash_conv;
54530         description_hash_conv.inner = untag_ptr(description_hash);
54531         description_hash_conv.is_owned = ptr_is_owned(description_hash);
54532         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
54533         description_hash_conv = Sha256_clone(&description_hash_conv);
54534         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
54535         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
54536         if (phantom_route_hints_constr.datalen > 0)
54537                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
54538         else
54539                 phantom_route_hints_constr.data = NULL;
54540         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
54541         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
54542                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
54543                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
54544                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
54545                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
54546                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
54547                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
54548                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
54549         }
54550         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
54551         void* entropy_source_ptr = untag_ptr(entropy_source);
54552         CHECK_ACCESS(entropy_source_ptr);
54553         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
54554         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
54555                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54556                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
54557         }
54558         void* node_signer_ptr = untag_ptr(node_signer);
54559         CHECK_ACCESS(node_signer_ptr);
54560         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
54561         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
54562                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54563                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
54564         }
54565         void* logger_ptr = untag_ptr(logger);
54566         CHECK_ACCESS(logger_ptr);
54567         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54568         if (logger_conv.free == LDKLogger_JCalls_free) {
54569                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54570                 LDKLogger_JCalls_cloned(&logger_conv);
54571         }
54572         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
54573         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
54574         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
54575         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
54576         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
54577         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
54578         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, 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);
54579         return tag_ptr(ret_conv, true);
54580 }
54581
54582 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) {
54583         LDKChannelManager channelmanager_conv;
54584         channelmanager_conv.inner = untag_ptr(channelmanager);
54585         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54586         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54587         channelmanager_conv.is_owned = false;
54588         void* node_signer_ptr = untag_ptr(node_signer);
54589         CHECK_ACCESS(node_signer_ptr);
54590         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
54591         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
54592                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54593                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
54594         }
54595         void* logger_ptr = untag_ptr(logger);
54596         CHECK_ACCESS(logger_ptr);
54597         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54598         if (logger_conv.free == LDKLogger_JCalls_free) {
54599                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54600                 LDKLogger_JCalls_cloned(&logger_conv);
54601         }
54602         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
54603         void* amt_msat_ptr = untag_ptr(amt_msat);
54604         CHECK_ACCESS(amt_msat_ptr);
54605         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
54606         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
54607         LDKStr description_conv = java_to_owned_str(env, description);
54608         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
54609         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
54610         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
54611         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
54612         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
54613         *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);
54614         return tag_ptr(ret_conv, true);
54615 }
54616
54617 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) {
54618         LDKChannelManager channelmanager_conv;
54619         channelmanager_conv.inner = untag_ptr(channelmanager);
54620         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54621         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54622         channelmanager_conv.is_owned = false;
54623         void* node_signer_ptr = untag_ptr(node_signer);
54624         CHECK_ACCESS(node_signer_ptr);
54625         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
54626         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
54627                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54628                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
54629         }
54630         void* logger_ptr = untag_ptr(logger);
54631         CHECK_ACCESS(logger_ptr);
54632         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54633         if (logger_conv.free == LDKLogger_JCalls_free) {
54634                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54635                 LDKLogger_JCalls_cloned(&logger_conv);
54636         }
54637         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
54638         void* amt_msat_ptr = untag_ptr(amt_msat);
54639         CHECK_ACCESS(amt_msat_ptr);
54640         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
54641         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
54642         LDKSha256 description_hash_conv;
54643         description_hash_conv.inner = untag_ptr(description_hash);
54644         description_hash_conv.is_owned = ptr_is_owned(description_hash);
54645         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
54646         description_hash_conv = Sha256_clone(&description_hash_conv);
54647         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
54648         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
54649         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
54650         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
54651         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
54652         *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);
54653         return tag_ptr(ret_conv, true);
54654 }
54655
54656 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) {
54657         LDKChannelManager channelmanager_conv;
54658         channelmanager_conv.inner = untag_ptr(channelmanager);
54659         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54660         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54661         channelmanager_conv.is_owned = false;
54662         void* node_signer_ptr = untag_ptr(node_signer);
54663         CHECK_ACCESS(node_signer_ptr);
54664         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
54665         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
54666                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54667                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
54668         }
54669         void* logger_ptr = untag_ptr(logger);
54670         CHECK_ACCESS(logger_ptr);
54671         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54672         if (logger_conv.free == LDKLogger_JCalls_free) {
54673                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54674                 LDKLogger_JCalls_cloned(&logger_conv);
54675         }
54676         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
54677         void* amt_msat_ptr = untag_ptr(amt_msat);
54678         CHECK_ACCESS(amt_msat_ptr);
54679         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
54680         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
54681         LDKSha256 description_hash_conv;
54682         description_hash_conv.inner = untag_ptr(description_hash);
54683         description_hash_conv.is_owned = ptr_is_owned(description_hash);
54684         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
54685         description_hash_conv = Sha256_clone(&description_hash_conv);
54686         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
54687         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
54688         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
54689         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
54690         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
54691         *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);
54692         return tag_ptr(ret_conv, true);
54693 }
54694
54695 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) {
54696         LDKChannelManager channelmanager_conv;
54697         channelmanager_conv.inner = untag_ptr(channelmanager);
54698         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54700         channelmanager_conv.is_owned = false;
54701         void* node_signer_ptr = untag_ptr(node_signer);
54702         CHECK_ACCESS(node_signer_ptr);
54703         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
54704         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
54705                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54706                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
54707         }
54708         void* logger_ptr = untag_ptr(logger);
54709         CHECK_ACCESS(logger_ptr);
54710         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54711         if (logger_conv.free == LDKLogger_JCalls_free) {
54712                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54713                 LDKLogger_JCalls_cloned(&logger_conv);
54714         }
54715         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
54716         void* amt_msat_ptr = untag_ptr(amt_msat);
54717         CHECK_ACCESS(amt_msat_ptr);
54718         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
54719         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
54720         LDKStr description_conv = java_to_owned_str(env, description);
54721         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
54722         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
54723         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
54724         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
54725         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
54726         *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);
54727         return tag_ptr(ret_conv, true);
54728 }
54729
54730 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) {
54731         LDKChannelManager channelmanager_conv;
54732         channelmanager_conv.inner = untag_ptr(channelmanager);
54733         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
54734         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
54735         channelmanager_conv.is_owned = false;
54736         void* node_signer_ptr = untag_ptr(node_signer);
54737         CHECK_ACCESS(node_signer_ptr);
54738         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
54739         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
54740                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54741                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
54742         }
54743         void* logger_ptr = untag_ptr(logger);
54744         CHECK_ACCESS(logger_ptr);
54745         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54746         if (logger_conv.free == LDKLogger_JCalls_free) {
54747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54748                 LDKLogger_JCalls_cloned(&logger_conv);
54749         }
54750         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
54751         void* amt_msat_ptr = untag_ptr(amt_msat);
54752         CHECK_ACCESS(amt_msat_ptr);
54753         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
54754         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
54755         LDKStr description_conv = java_to_owned_str(env, description);
54756         LDKThirtyTwoBytes payment_hash_ref;
54757         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
54758         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
54759         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
54760         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
54761         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
54762         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
54763         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
54764         *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);
54765         return tag_ptr(ret_conv, true);
54766 }
54767
54768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
54769         LDKStr s_conv = java_to_owned_str(env, s);
54770         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
54771         *ret_conv = SiPrefix_from_str(s_conv);
54772         return tag_ptr(ret_conv, true);
54773 }
54774
54775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
54776         LDKStr s_conv = java_to_owned_str(env, s);
54777         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
54778         *ret_conv = Invoice_from_str(s_conv);
54779         return tag_ptr(ret_conv, true);
54780 }
54781
54782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
54783         LDKStr s_conv = java_to_owned_str(env, s);
54784         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
54785         *ret_conv = SignedRawInvoice_from_str(s_conv);
54786         return tag_ptr(ret_conv, true);
54787 }
54788
54789 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54790         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
54791         LDKStr ret_str = ParseError_to_str(o_conv);
54792         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54793         Str_free(ret_str);
54794         return ret_conv;
54795 }
54796
54797 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54798         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
54799         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
54800         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54801         Str_free(ret_str);
54802         return ret_conv;
54803 }
54804
54805 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54806         LDKInvoice o_conv;
54807         o_conv.inner = untag_ptr(o);
54808         o_conv.is_owned = ptr_is_owned(o);
54809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54810         o_conv.is_owned = false;
54811         LDKStr ret_str = Invoice_to_str(&o_conv);
54812         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54813         Str_free(ret_str);
54814         return ret_conv;
54815 }
54816
54817 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54818         LDKSignedRawInvoice o_conv;
54819         o_conv.inner = untag_ptr(o);
54820         o_conv.is_owned = ptr_is_owned(o);
54821         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54822         o_conv.is_owned = false;
54823         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
54824         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54825         Str_free(ret_str);
54826         return ret_conv;
54827 }
54828
54829 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54830         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
54831         LDKStr ret_str = Currency_to_str(o_conv);
54832         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54833         Str_free(ret_str);
54834         return ret_conv;
54835 }
54836
54837 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
54838         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
54839         LDKStr ret_str = SiPrefix_to_str(o_conv);
54840         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
54841         Str_free(ret_str);
54842         return ret_conv;
54843 }
54844
54845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54846         LDKRapidGossipSync this_obj_conv;
54847         this_obj_conv.inner = untag_ptr(this_obj);
54848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54850         RapidGossipSync_free(this_obj_conv);
54851 }
54852
54853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
54854         LDKNetworkGraph network_graph_conv;
54855         network_graph_conv.inner = untag_ptr(network_graph);
54856         network_graph_conv.is_owned = ptr_is_owned(network_graph);
54857         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
54858         network_graph_conv.is_owned = false;
54859         void* logger_ptr = untag_ptr(logger);
54860         CHECK_ACCESS(logger_ptr);
54861         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
54862         if (logger_conv.free == LDKLogger_JCalls_free) {
54863                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
54864                 LDKLogger_JCalls_cloned(&logger_conv);
54865         }
54866         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
54867         int64_t ret_ref = 0;
54868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54870         return ret_ref;
54871 }
54872
54873 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) {
54874         LDKRapidGossipSync this_arg_conv;
54875         this_arg_conv.inner = untag_ptr(this_arg);
54876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54878         this_arg_conv.is_owned = false;
54879         LDKu8slice update_data_ref;
54880         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
54881         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
54882         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
54883         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
54884         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
54885         return tag_ptr(ret_conv, true);
54886 }
54887
54888 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) {
54889         LDKRapidGossipSync this_arg_conv;
54890         this_arg_conv.inner = untag_ptr(this_arg);
54891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54893         this_arg_conv.is_owned = false;
54894         LDKu8slice update_data_ref;
54895         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
54896         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
54897         void* current_time_unix_ptr = untag_ptr(current_time_unix);
54898         CHECK_ACCESS(current_time_unix_ptr);
54899         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
54900         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
54901         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
54902         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
54903         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
54904         return tag_ptr(ret_conv, true);
54905 }
54906
54907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
54908         LDKRapidGossipSync this_arg_conv;
54909         this_arg_conv.inner = untag_ptr(this_arg);
54910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54912         this_arg_conv.is_owned = false;
54913         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
54914         return ret_conv;
54915 }
54916
54917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
54918         if (!ptr_is_owned(this_ptr)) return;
54919         void* this_ptr_ptr = untag_ptr(this_ptr);
54920         CHECK_ACCESS(this_ptr_ptr);
54921         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
54922         FREE(untag_ptr(this_ptr));
54923         GraphSyncError_free(this_ptr_conv);
54924 }
54925
54926 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
54927         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
54928         *ret_copy = GraphSyncError_clone(arg);
54929         int64_t ret_ref = tag_ptr(ret_copy, true);
54930         return ret_ref;
54931 }
54932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54933         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
54934         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
54935         return ret_conv;
54936 }
54937
54938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54939         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
54940         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
54941         *ret_copy = GraphSyncError_clone(orig_conv);
54942         int64_t ret_ref = tag_ptr(ret_copy, true);
54943         return ret_ref;
54944 }
54945
54946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
54947         void* a_ptr = untag_ptr(a);
54948         CHECK_ACCESS(a_ptr);
54949         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
54950         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
54951         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
54952         *ret_copy = GraphSyncError_decode_error(a_conv);
54953         int64_t ret_ref = tag_ptr(ret_copy, true);
54954         return ret_ref;
54955 }
54956
54957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
54958         LDKLightningError a_conv;
54959         a_conv.inner = untag_ptr(a);
54960         a_conv.is_owned = ptr_is_owned(a);
54961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54962         a_conv = LightningError_clone(&a_conv);
54963         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
54964         *ret_copy = GraphSyncError_lightning_error(a_conv);
54965         int64_t ret_ref = tag_ptr(ret_copy, true);
54966         return ret_ref;
54967 }
54968