Update CI references to 0.0.122
[ldk-java] / c_sharp / bindings.c
1 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
4 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
5
6 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
7 #define int64_t jlong
8 #include <lightning.h>
9 #include <string.h>
10 #include <stdatomic.h>
11 #include <stdlib.h>
12
13 #define LIKELY(v) __builtin_expect(!!(v), 1)
14 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
15
16 #include <stdio.h>
17 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
18 #define do_MALLOC(a, _b, _c) malloc(a)
19 #define MALLOC(a, _) malloc(a)
20 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
21 #define CHECK_ACCESS(p)
22 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
23 #define DO_ASSERT(a) (void)(a)
24 #define CHECK(a)
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(void*) <= 8, "Pointers must fit into 64 bits");
33
34 // Int types across Windows/Linux are different, so make sure we're using the right headers.
35 _Static_assert(sizeof(void*) == sizeof(uintptr_t), "stdints must be correct");
36 _Static_assert(sizeof(void*) == sizeof(intptr_t), "stdints must be correct");
37 _Static_assert(sizeof(uint64_t) == 8, "stdints must be correct");
38 _Static_assert(sizeof(int64_t) == 8, "stdints must be correct");
39 _Static_assert(sizeof(uint32_t) == 4, "stdints must be correct");
40 _Static_assert(sizeof(int32_t) == 4, "stdints must be correct");
41 _Static_assert(sizeof(uint16_t) == 2, "stdints must be correct");
42 _Static_assert(sizeof(int16_t) == 2, "stdints must be correct");
43 _Static_assert(sizeof(uint8_t) == 1, "stdints must be correct");
44 _Static_assert(sizeof(int8_t) == 1, "stdints must be correct");
45
46 #define DECL_ARR_TYPE(ty, name) \
47         struct name##array { \
48                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
49                 ty elems[]; \
50         }; \
51         typedef struct name##array * name##Array; \
52         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
53                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
54                 arr->arr_len = arr_len; \
55                 return arr; \
56         }
57
58 DECL_ARR_TYPE(int64_t, int64_t);
59 DECL_ARR_TYPE(uint64_t, uint64_t);
60 DECL_ARR_TYPE(int8_t, int8_t);
61 DECL_ARR_TYPE(int16_t, int16_t);
62 DECL_ARR_TYPE(uint32_t, uint32_t);
63 DECL_ARR_TYPE(void*, ptr);
64 DECL_ARR_TYPE(char, char);
65 typedef charArray jstring;
66
67 static inline jstring str_ref_to_cs(const char* chars, size_t len) {
68         charArray arr = init_charArray(len, __LINE__);
69         memcpy(arr->elems, chars, len);
70         return arr;
71 }
72 static inline LDKStr str_ref_to_owned_c(const jstring str) {
73         char* newchars = MALLOC(str->arr_len + 1, "String chars");
74         memcpy(newchars, str->elems, str->arr_len);
75         newchars[str->arr_len] = 0;
76         LDKStr res = {
77                 .chars = newchars,
78                 .len = str->arr_len,
79                 .chars_is_owned = true
80         };
81         return res;
82 }
83
84 typedef bool jboolean;
85
86 int64_t CS_LDK_allocate_buffer(int64_t len) {
87         return (int64_t)MALLOC(len, "C#-requested buffer");
88 }
89
90 void CS_LDK_free_buffer(int64_t buf) {
91         FREE((void*)buf);
92 }
93
94 jstring CS_LDK_get_ldk_c_bindings_version() {
95         return str_ref_to_cs(check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
96 }
97 jstring CS_LDK_get_ldk_version() {
98         return str_ref_to_cs(check_get_ldk_version(), strlen(check_get_ldk_version()));
99 }
100 #include "version.c"
101
102 typedef int64_t (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
103 static invoker_l_l js_invoke_function_l_l;
104 int CS_LDK_register_l_l_invoker(invoker_l_l invoker) {
105         js_invoke_function_l_l = invoker;
106         return 0;
107 }
108
109 typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
110 static invoker_l_ll js_invoke_function_l_ll;
111 int CS_LDK_register_l_ll_invoker(invoker_l_ll invoker) {
112         js_invoke_function_l_ll = invoker;
113         return 0;
114 }
115
116 typedef int64_t (*invoker_l_)(int obj_ptr, int fn_id);
117 static invoker_l_ js_invoke_function_l_;
118 int CS_LDK_register_l__invoker(invoker_l_ invoker) {
119         js_invoke_function_l_ = invoker;
120         return 0;
121 }
122
123 typedef void (*invoker_void_l)(int obj_ptr, int fn_id, int64_t a);
124 static invoker_void_l js_invoke_function_void_l;
125 int CS_LDK_register_void_l_invoker(invoker_void_l invoker) {
126         js_invoke_function_void_l = invoker;
127         return 0;
128 }
129
130 typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
131 static invoker_l_lll js_invoke_function_l_lll;
132 int CS_LDK_register_l_lll_invoker(invoker_l_lll invoker) {
133         js_invoke_function_l_lll = invoker;
134         return 0;
135 }
136
137 typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
138 static invoker_l_llll js_invoke_function_l_llll;
139 int CS_LDK_register_l_llll_invoker(invoker_l_llll invoker) {
140         js_invoke_function_l_llll = invoker;
141         return 0;
142 }
143
144 typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e);
145 static invoker_l_lllll js_invoke_function_l_lllll;
146 int CS_LDK_register_l_lllll_invoker(invoker_l_lllll invoker) {
147         js_invoke_function_l_lllll = invoker;
148         return 0;
149 }
150
151 typedef void (*invoker_void_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
152 static invoker_void_lll js_invoke_function_void_lll;
153 int CS_LDK_register_void_lll_invoker(invoker_void_lll invoker) {
154         js_invoke_function_void_lll = invoker;
155         return 0;
156 }
157
158 typedef void (*invoker_void_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
159 static invoker_void_ll js_invoke_function_void_ll;
160 int CS_LDK_register_void_ll_invoker(invoker_void_ll invoker) {
161         js_invoke_function_void_ll = invoker;
162         return 0;
163 }
164
165 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
166 static invoker_ChannelMonitorUpdateStatus_ll js_invoke_function_ChannelMonitorUpdateStatus_ll;
167 int CS_LDK_register_ChannelMonitorUpdateStatus_ll_invoker(invoker_ChannelMonitorUpdateStatus_ll invoker) {
168         js_invoke_function_ChannelMonitorUpdateStatus_ll = invoker;
169         return 0;
170 }
171
172 typedef int64_t (*invoker_l_Recipient)(int obj_ptr, int fn_id, int32_t a);
173 static invoker_l_Recipient js_invoke_function_l_Recipient;
174 int CS_LDK_register_l_Recipient_invoker(invoker_l_Recipient invoker) {
175         js_invoke_function_l_Recipient = invoker;
176         return 0;
177 }
178
179 typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int64_t b, int64_t c);
180 static invoker_l_Recipientll js_invoke_function_l_Recipientll;
181 int CS_LDK_register_l_Recipientll_invoker(invoker_l_Recipientll invoker) {
182         js_invoke_function_l_Recipientll = invoker;
183         return 0;
184 }
185
186 typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
187 static invoker_l_llRecipient js_invoke_function_l_llRecipient;
188 int CS_LDK_register_l_llRecipient_invoker(invoker_l_llRecipient invoker) {
189         js_invoke_function_l_llRecipient = invoker;
190         return 0;
191 }
192
193 typedef int64_t (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int64_t c);
194 static invoker_l_bll js_invoke_function_l_bll;
195 int CS_LDK_register_l_bll_invoker(invoker_l_bll invoker) {
196         js_invoke_function_l_bll = invoker;
197         return 0;
198 }
199
200 typedef int32_t (*invoker_i_ConfirmationTarget)(int obj_ptr, int fn_id, int32_t a);
201 static invoker_i_ConfirmationTarget js_invoke_function_i_ConfirmationTarget;
202 int CS_LDK_register_i_ConfirmationTarget_invoker(invoker_i_ConfirmationTarget invoker) {
203         js_invoke_function_i_ConfirmationTarget = invoker;
204         return 0;
205 }
206
207 typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e, int64_t f);
208 static invoker_l_llllll js_invoke_function_l_llllll;
209 int CS_LDK_register_l_llllll_invoker(invoker_l_llllll invoker) {
210         js_invoke_function_l_llllll = invoker;
211         return 0;
212 }
213
214 typedef int16_t (*invoker_s_)(int obj_ptr, int fn_id);
215 static invoker_s_ js_invoke_function_s_;
216 int CS_LDK_register_s__invoker(invoker_s_ invoker) {
217         js_invoke_function_s_ = invoker;
218         return 0;
219 }
220
221 typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, jboolean d);
222 static invoker_l_lllb js_invoke_function_l_lllb;
223 int CS_LDK_register_l_lllb_invoker(invoker_l_lllb invoker) {
224         js_invoke_function_l_lllb = invoker;
225         return 0;
226 }
227
228 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
229 static invoker_ChannelMonitorUpdateStatus_lll js_invoke_function_ChannelMonitorUpdateStatus_lll;
230 int CS_LDK_register_ChannelMonitorUpdateStatus_lll_invoker(invoker_ChannelMonitorUpdateStatus_lll invoker) {
231         js_invoke_function_ChannelMonitorUpdateStatus_lll = invoker;
232         return 0;
233 }
234
235 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
236 static invoker_ChannelMonitorUpdateStatus_llll js_invoke_function_ChannelMonitorUpdateStatus_llll;
237 int CS_LDK_register_ChannelMonitorUpdateStatus_llll_invoker(invoker_ChannelMonitorUpdateStatus_llll invoker) {
238         js_invoke_function_ChannelMonitorUpdateStatus_llll = invoker;
239         return 0;
240 }
241
242 typedef void (*invoker_void_)(int obj_ptr, int fn_id);
243 static invoker_void_ js_invoke_function_void_;
244 int CS_LDK_register_void__invoker(invoker_void_ invoker) {
245         js_invoke_function_void_ = invoker;
246         return 0;
247 }
248
249 typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
250 static invoker_void_lli js_invoke_function_void_lli;
251 int CS_LDK_register_void_lli_invoker(invoker_void_lli invoker) {
252         js_invoke_function_void_lli = invoker;
253         return 0;
254 }
255
256 typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int64_t a, int32_t b);
257 static invoker_void_li js_invoke_function_void_li;
258 int CS_LDK_register_void_li_invoker(invoker_void_li invoker) {
259         js_invoke_function_void_li = invoker;
260         return 0;
261 }
262
263 typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int64_t a, int64_t b, jboolean c);
264 static invoker_l_llb js_invoke_function_l_llb;
265 int CS_LDK_register_l_llb_invoker(invoker_l_llb invoker) {
266         js_invoke_function_l_llb = invoker;
267         return 0;
268 }
269
270 typedef jboolean (*invoker_b_)(int obj_ptr, int fn_id);
271 static invoker_b_ js_invoke_function_b_;
272 int CS_LDK_register_b__invoker(invoker_b_ invoker) {
273         js_invoke_function_b_ = invoker;
274         return 0;
275 }
276
277 typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int64_t b);
278 static invoker_l_sl js_invoke_function_l_sl;
279 int CS_LDK_register_l_sl_invoker(invoker_l_sl invoker) {
280         js_invoke_function_l_sl = invoker;
281         return 0;
282 }
283
284 typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int64_t a, jboolean b);
285 static invoker_l_lb js_invoke_function_l_lb;
286 int CS_LDK_register_l_lb_invoker(invoker_l_lb invoker) {
287         js_invoke_function_l_lb = invoker;
288         return 0;
289 }
290
291 typedef jboolean (*invoker_b_l)(int obj_ptr, int fn_id, int64_t a);
292 static invoker_b_l js_invoke_function_b_l;
293 int CS_LDK_register_b_l_invoker(invoker_b_l invoker) {
294         js_invoke_function_b_l = invoker;
295         return 0;
296 }
297
298 typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d);
299 static invoker_l_llli js_invoke_function_l_llli;
300 int CS_LDK_register_l_llli_invoker(invoker_l_llli invoker) {
301         js_invoke_function_l_llli = invoker;
302         return 0;
303 }
304 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
305
306 static inline void* untag_ptr(uint64_t ptr) {
307         if (ptr < 4096) return (void*)ptr;
308         if (sizeof(void*) == 4) {
309                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
310                 return (void*)(uintptr_t)ptr;
311         } else {
312                 // For 64-bit systems, assume the top byte is used for tagging, then
313                 // use bit 9 ^ bit 10.
314                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
315                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
316 #ifdef LDK_DEBUG_BUILD
317                 // On debug builds we also use the 11th bit as a debug flag
318                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
319                 CHECK(tenth_bit != eleventh_bit);
320                 p ^= 1ULL << 53;
321 #endif
322                 return (void*)p;
323         }
324 }
325 static inline bool ptr_is_owned(uint64_t ptr) {
326         if(ptr < 4096) return true;
327         if (sizeof(void*) == 4) {
328                 return ptr & (1ULL << 32);
329         } else {
330                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
331                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
332 #ifdef LDK_DEBUG_BUILD
333                 // On debug builds we also use the 11th bit as a debug flag
334                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
335                 CHECK(tenth_bit != eleventh_bit);
336 #endif
337                 return (ninth_bit ^ tenth_bit) ? true : false;
338         }
339 }
340 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
341         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
342         if (sizeof(void*) == 4) {
343                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
344         } else {
345                 CHECK(sizeof(uintptr_t) == 8);
346                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
347                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
348 #ifdef LDK_DEBUG_BUILD
349                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
350                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
351                 CHECK(ninth_bit == tenth_bit);
352                 CHECK(ninth_bit == eleventh_bit);
353                 t ^= 1ULL << 53;
354 #endif
355                 CHECK(ptr_is_owned(t) == is_owned);
356                 CHECK(untag_ptr(t) == ptr);
357                 return t;
358         }
359 }
360
361 static inline LDKBlindedFailure LDKBlindedFailure_from_cs(int32_t ord) {
362         switch (ord) {
363                 case 0: return LDKBlindedFailure_FromIntroductionNode;
364                 case 1: return LDKBlindedFailure_FromBlindedNode;
365                 default: abort();
366         }
367 }
368 static inline int32_t LDKBlindedFailure_to_cs(LDKBlindedFailure val) {
369         switch (val) {
370                 case LDKBlindedFailure_FromIntroductionNode: return 0;
371                 case LDKBlindedFailure_FromBlindedNode: return 1;
372                 default: abort();
373         }
374 }
375 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_cs(int32_t ord) {
376         switch (ord) {
377                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
378                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
379                 case 2: return LDKBolt11SemanticError_NoDescription;
380                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
381                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
382                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
383                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
384                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
385                 case 8: return LDKBolt11SemanticError_InvalidSignature;
386                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
387                 default: abort();
388         }
389 }
390 static inline int32_t LDKBolt11SemanticError_to_cs(LDKBolt11SemanticError val) {
391         switch (val) {
392                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
393                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
394                 case LDKBolt11SemanticError_NoDescription: return 2;
395                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
396                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
397                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
398                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
399                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
400                 case LDKBolt11SemanticError_InvalidSignature: return 8;
401                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
402                 default: abort();
403         }
404 }
405 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_cs(int32_t ord) {
406         switch (ord) {
407                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
408                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
409                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
410                 case 3: return LDKBolt12SemanticError_MissingAmount;
411                 case 4: return LDKBolt12SemanticError_InvalidAmount;
412                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
413                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
414                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
415                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
416                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
417                 case 10: return LDKBolt12SemanticError_MissingDescription;
418                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
419                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
420                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
421                 case 14: return LDKBolt12SemanticError_MissingQuantity;
422                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
423                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
424                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
425                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
426                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
427                 case 20: return LDKBolt12SemanticError_MissingPayerId;
428                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
429                 case 22: return LDKBolt12SemanticError_MissingPaths;
430                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
431                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
432                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
433                 case 26: return LDKBolt12SemanticError_MissingSignature;
434                 default: abort();
435         }
436 }
437 static inline int32_t LDKBolt12SemanticError_to_cs(LDKBolt12SemanticError val) {
438         switch (val) {
439                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
440                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
441                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
442                 case LDKBolt12SemanticError_MissingAmount: return 3;
443                 case LDKBolt12SemanticError_InvalidAmount: return 4;
444                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
445                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
446                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
447                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
448                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
449                 case LDKBolt12SemanticError_MissingDescription: return 10;
450                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
451                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
452                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
453                 case LDKBolt12SemanticError_MissingQuantity: return 14;
454                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
455                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
456                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
457                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
458                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
459                 case LDKBolt12SemanticError_MissingPayerId: return 20;
460                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
461                 case LDKBolt12SemanticError_MissingPaths: return 22;
462                 case LDKBolt12SemanticError_InvalidPayInfo: return 23;
463                 case LDKBolt12SemanticError_MissingCreationTime: return 24;
464                 case LDKBolt12SemanticError_MissingPaymentHash: return 25;
465                 case LDKBolt12SemanticError_MissingSignature: return 26;
466                 default: abort();
467         }
468 }
469 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_cs(int32_t ord) {
470         switch (ord) {
471                 case 0: return LDKCOption_NoneZ_Some;
472                 case 1: return LDKCOption_NoneZ_None;
473                 default: abort();
474         }
475 }
476 static inline int32_t LDKCOption_NoneZ_to_cs(LDKCOption_NoneZ val) {
477         switch (val) {
478                 case LDKCOption_NoneZ_Some: return 0;
479                 case LDKCOption_NoneZ_None: return 1;
480                 default: abort();
481         }
482 }
483 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_cs(int32_t ord) {
484         switch (ord) {
485                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
486                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
487                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
488                 default: abort();
489         }
490 }
491 static inline int32_t LDKChannelMonitorUpdateStatus_to_cs(LDKChannelMonitorUpdateStatus val) {
492         switch (val) {
493                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
494                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
495                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
496                 default: abort();
497         }
498 }
499 static inline LDKChannelShutdownState LDKChannelShutdownState_from_cs(int32_t ord) {
500         switch (ord) {
501                 case 0: return LDKChannelShutdownState_NotShuttingDown;
502                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
503                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
504                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
505                 case 4: return LDKChannelShutdownState_ShutdownComplete;
506                 default: abort();
507         }
508 }
509 static inline int32_t LDKChannelShutdownState_to_cs(LDKChannelShutdownState val) {
510         switch (val) {
511                 case LDKChannelShutdownState_NotShuttingDown: return 0;
512                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
513                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
514                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
515                 case LDKChannelShutdownState_ShutdownComplete: return 4;
516                 default: abort();
517         }
518 }
519 static inline LDKConfirmationTarget LDKConfirmationTarget_from_cs(int32_t ord) {
520         switch (ord) {
521                 case 0: return LDKConfirmationTarget_OnChainSweep;
522                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
523                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
524                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
525                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
526                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
527                 default: abort();
528         }
529 }
530 static inline int32_t LDKConfirmationTarget_to_cs(LDKConfirmationTarget val) {
531         switch (val) {
532                 case LDKConfirmationTarget_OnChainSweep: return 0;
533                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
534                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
535                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
536                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
537                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
538                 default: abort();
539         }
540 }
541 static inline LDKCreationError LDKCreationError_from_cs(int32_t ord) {
542         switch (ord) {
543                 case 0: return LDKCreationError_DescriptionTooLong;
544                 case 1: return LDKCreationError_RouteTooLong;
545                 case 2: return LDKCreationError_TimestampOutOfBounds;
546                 case 3: return LDKCreationError_InvalidAmount;
547                 case 4: return LDKCreationError_MissingRouteHints;
548                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
549                 default: abort();
550         }
551 }
552 static inline int32_t LDKCreationError_to_cs(LDKCreationError val) {
553         switch (val) {
554                 case LDKCreationError_DescriptionTooLong: return 0;
555                 case LDKCreationError_RouteTooLong: return 1;
556                 case LDKCreationError_TimestampOutOfBounds: return 2;
557                 case LDKCreationError_InvalidAmount: return 3;
558                 case LDKCreationError_MissingRouteHints: return 4;
559                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
560                 default: abort();
561         }
562 }
563 static inline LDKCurrency LDKCurrency_from_cs(int32_t ord) {
564         switch (ord) {
565                 case 0: return LDKCurrency_Bitcoin;
566                 case 1: return LDKCurrency_BitcoinTestnet;
567                 case 2: return LDKCurrency_Regtest;
568                 case 3: return LDKCurrency_Simnet;
569                 case 4: return LDKCurrency_Signet;
570                 default: abort();
571         }
572 }
573 static inline int32_t LDKCurrency_to_cs(LDKCurrency val) {
574         switch (val) {
575                 case LDKCurrency_Bitcoin: return 0;
576                 case LDKCurrency_BitcoinTestnet: return 1;
577                 case LDKCurrency_Regtest: return 2;
578                 case LDKCurrency_Simnet: return 3;
579                 case LDKCurrency_Signet: return 4;
580                 default: abort();
581         }
582 }
583 static inline LDKHTLCClaim LDKHTLCClaim_from_cs(int32_t ord) {
584         switch (ord) {
585                 case 0: return LDKHTLCClaim_OfferedTimeout;
586                 case 1: return LDKHTLCClaim_OfferedPreimage;
587                 case 2: return LDKHTLCClaim_AcceptedTimeout;
588                 case 3: return LDKHTLCClaim_AcceptedPreimage;
589                 case 4: return LDKHTLCClaim_Revocation;
590                 default: abort();
591         }
592 }
593 static inline int32_t LDKHTLCClaim_to_cs(LDKHTLCClaim val) {
594         switch (val) {
595                 case LDKHTLCClaim_OfferedTimeout: return 0;
596                 case LDKHTLCClaim_OfferedPreimage: return 1;
597                 case LDKHTLCClaim_AcceptedTimeout: return 2;
598                 case LDKHTLCClaim_AcceptedPreimage: return 3;
599                 case LDKHTLCClaim_Revocation: return 4;
600                 default: abort();
601         }
602 }
603 static inline LDKIOError LDKIOError_from_cs(int32_t ord) {
604         switch (ord) {
605                 case 0: return LDKIOError_NotFound;
606                 case 1: return LDKIOError_PermissionDenied;
607                 case 2: return LDKIOError_ConnectionRefused;
608                 case 3: return LDKIOError_ConnectionReset;
609                 case 4: return LDKIOError_ConnectionAborted;
610                 case 5: return LDKIOError_NotConnected;
611                 case 6: return LDKIOError_AddrInUse;
612                 case 7: return LDKIOError_AddrNotAvailable;
613                 case 8: return LDKIOError_BrokenPipe;
614                 case 9: return LDKIOError_AlreadyExists;
615                 case 10: return LDKIOError_WouldBlock;
616                 case 11: return LDKIOError_InvalidInput;
617                 case 12: return LDKIOError_InvalidData;
618                 case 13: return LDKIOError_TimedOut;
619                 case 14: return LDKIOError_WriteZero;
620                 case 15: return LDKIOError_Interrupted;
621                 case 16: return LDKIOError_Other;
622                 case 17: return LDKIOError_UnexpectedEof;
623                 default: abort();
624         }
625 }
626 static inline int32_t LDKIOError_to_cs(LDKIOError val) {
627         switch (val) {
628                 case LDKIOError_NotFound: return 0;
629                 case LDKIOError_PermissionDenied: return 1;
630                 case LDKIOError_ConnectionRefused: return 2;
631                 case LDKIOError_ConnectionReset: return 3;
632                 case LDKIOError_ConnectionAborted: return 4;
633                 case LDKIOError_NotConnected: return 5;
634                 case LDKIOError_AddrInUse: return 6;
635                 case LDKIOError_AddrNotAvailable: return 7;
636                 case LDKIOError_BrokenPipe: return 8;
637                 case LDKIOError_AlreadyExists: return 9;
638                 case LDKIOError_WouldBlock: return 10;
639                 case LDKIOError_InvalidInput: return 11;
640                 case LDKIOError_InvalidData: return 12;
641                 case LDKIOError_TimedOut: return 13;
642                 case LDKIOError_WriteZero: return 14;
643                 case LDKIOError_Interrupted: return 15;
644                 case LDKIOError_Other: return 16;
645                 case LDKIOError_UnexpectedEof: return 17;
646                 default: abort();
647         }
648 }
649 static inline LDKLevel LDKLevel_from_cs(int32_t ord) {
650         switch (ord) {
651                 case 0: return LDKLevel_Gossip;
652                 case 1: return LDKLevel_Trace;
653                 case 2: return LDKLevel_Debug;
654                 case 3: return LDKLevel_Info;
655                 case 4: return LDKLevel_Warn;
656                 case 5: return LDKLevel_Error;
657                 default: abort();
658         }
659 }
660 static inline int32_t LDKLevel_to_cs(LDKLevel val) {
661         switch (val) {
662                 case LDKLevel_Gossip: return 0;
663                 case LDKLevel_Trace: return 1;
664                 case LDKLevel_Debug: return 2;
665                 case LDKLevel_Info: return 3;
666                 case LDKLevel_Warn: return 4;
667                 case LDKLevel_Error: return 5;
668                 default: abort();
669         }
670 }
671 static inline LDKNetwork LDKNetwork_from_cs(int32_t ord) {
672         switch (ord) {
673                 case 0: return LDKNetwork_Bitcoin;
674                 case 1: return LDKNetwork_Testnet;
675                 case 2: return LDKNetwork_Regtest;
676                 case 3: return LDKNetwork_Signet;
677                 default: abort();
678         }
679 }
680 static inline int32_t LDKNetwork_to_cs(LDKNetwork val) {
681         switch (val) {
682                 case LDKNetwork_Bitcoin: return 0;
683                 case LDKNetwork_Testnet: return 1;
684                 case LDKNetwork_Regtest: return 2;
685                 case LDKNetwork_Signet: return 3;
686                 default: abort();
687         }
688 }
689 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_cs(int32_t ord) {
690         switch (ord) {
691                 case 0: return LDKPaymentFailureReason_RecipientRejected;
692                 case 1: return LDKPaymentFailureReason_UserAbandoned;
693                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
694                 case 3: return LDKPaymentFailureReason_PaymentExpired;
695                 case 4: return LDKPaymentFailureReason_RouteNotFound;
696                 case 5: return LDKPaymentFailureReason_UnexpectedError;
697                 default: abort();
698         }
699 }
700 static inline int32_t LDKPaymentFailureReason_to_cs(LDKPaymentFailureReason val) {
701         switch (val) {
702                 case LDKPaymentFailureReason_RecipientRejected: return 0;
703                 case LDKPaymentFailureReason_UserAbandoned: return 1;
704                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
705                 case LDKPaymentFailureReason_PaymentExpired: return 3;
706                 case LDKPaymentFailureReason_RouteNotFound: return 4;
707                 case LDKPaymentFailureReason_UnexpectedError: return 5;
708                 default: abort();
709         }
710 }
711 static inline LDKRecipient LDKRecipient_from_cs(int32_t ord) {
712         switch (ord) {
713                 case 0: return LDKRecipient_Node;
714                 case 1: return LDKRecipient_PhantomNode;
715                 default: abort();
716         }
717 }
718 static inline int32_t LDKRecipient_to_cs(LDKRecipient val) {
719         switch (val) {
720                 case LDKRecipient_Node: return 0;
721                 case LDKRecipient_PhantomNode: return 1;
722                 default: abort();
723         }
724 }
725 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_cs(int32_t ord) {
726         switch (ord) {
727                 case 0: return LDKRetryableSendFailure_PaymentExpired;
728                 case 1: return LDKRetryableSendFailure_RouteNotFound;
729                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
730                 default: abort();
731         }
732 }
733 static inline int32_t LDKRetryableSendFailure_to_cs(LDKRetryableSendFailure val) {
734         switch (val) {
735                 case LDKRetryableSendFailure_PaymentExpired: return 0;
736                 case LDKRetryableSendFailure_RouteNotFound: return 1;
737                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
738                 default: abort();
739         }
740 }
741 static inline LDKSecp256k1Error LDKSecp256k1Error_from_cs(int32_t ord) {
742         switch (ord) {
743                 case 0: return LDKSecp256k1Error_IncorrectSignature;
744                 case 1: return LDKSecp256k1Error_InvalidMessage;
745                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
746                 case 3: return LDKSecp256k1Error_InvalidSignature;
747                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
748                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
749                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
750                 case 7: return LDKSecp256k1Error_InvalidTweak;
751                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
752                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
753                 case 10: return LDKSecp256k1Error_InvalidParityValue;
754                 default: abort();
755         }
756 }
757 static inline int32_t LDKSecp256k1Error_to_cs(LDKSecp256k1Error val) {
758         switch (val) {
759                 case LDKSecp256k1Error_IncorrectSignature: return 0;
760                 case LDKSecp256k1Error_InvalidMessage: return 1;
761                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
762                 case LDKSecp256k1Error_InvalidSignature: return 3;
763                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
764                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
765                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
766                 case LDKSecp256k1Error_InvalidTweak: return 7;
767                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
768                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
769                 case LDKSecp256k1Error_InvalidParityValue: return 10;
770                 default: abort();
771         }
772 }
773 static inline LDKSiPrefix LDKSiPrefix_from_cs(int32_t ord) {
774         switch (ord) {
775                 case 0: return LDKSiPrefix_Milli;
776                 case 1: return LDKSiPrefix_Micro;
777                 case 2: return LDKSiPrefix_Nano;
778                 case 3: return LDKSiPrefix_Pico;
779                 default: abort();
780         }
781 }
782 static inline int32_t LDKSiPrefix_to_cs(LDKSiPrefix val) {
783         switch (val) {
784                 case LDKSiPrefix_Milli: return 0;
785                 case LDKSiPrefix_Micro: return 1;
786                 case LDKSiPrefix_Nano: return 2;
787                 case LDKSiPrefix_Pico: return 3;
788                 default: abort();
789         }
790 }
791 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_cs(int32_t ord) {
792         switch (ord) {
793                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
794                 case 1: return LDKSocketAddressParseError_InvalidInput;
795                 case 2: return LDKSocketAddressParseError_InvalidPort;
796                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
797                 default: abort();
798         }
799 }
800 static inline int32_t LDKSocketAddressParseError_to_cs(LDKSocketAddressParseError val) {
801         switch (val) {
802                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
803                 case LDKSocketAddressParseError_InvalidInput: return 1;
804                 case LDKSocketAddressParseError_InvalidPort: return 2;
805                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
806                 default: abort();
807         }
808 }
809 static inline LDKUtxoLookupError LDKUtxoLookupError_from_cs(int32_t ord) {
810         switch (ord) {
811                 case 0: return LDKUtxoLookupError_UnknownChain;
812                 case 1: return LDKUtxoLookupError_UnknownTx;
813                 default: abort();
814         }
815 }
816 static inline int32_t LDKUtxoLookupError_to_cs(LDKUtxoLookupError val) {
817         switch (val) {
818                 case LDKUtxoLookupError_UnknownChain: return 0;
819                 case LDKUtxoLookupError_UnknownTx: return 1;
820                 default: abort();
821         }
822 }
823 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
824         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
825         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
826         return ret;
827 }
828 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
829         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
830         return ret;
831 }
832 int8_tArray  CS_LDK_BigEndianScalar_get_bytes(int64_t thing) {
833         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
834         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
835         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
836         return ret_arr;
837 }
838
839 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
840 void  CS_LDK_BigEndianScalar_free(int64_t thing) {
841         if (!ptr_is_owned(thing)) return;
842         void* thing_ptr = untag_ptr(thing);
843         CHECK_ACCESS(thing_ptr);
844         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
845         FREE(untag_ptr(thing));
846         BigEndianScalar_free(thing_conv);
847 }
848
849 uint32_t CS_LDK_LDKBech32Error_ty_from_ptr(int64_t ptr) {
850         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
851         switch(obj->tag) {
852                 case LDKBech32Error_MissingSeparator: return 0;
853                 case LDKBech32Error_InvalidChecksum: return 1;
854                 case LDKBech32Error_InvalidLength: return 2;
855                 case LDKBech32Error_InvalidChar: return 3;
856                 case LDKBech32Error_InvalidData: return 4;
857                 case LDKBech32Error_InvalidPadding: return 5;
858                 case LDKBech32Error_MixedCase: return 6;
859                 default: abort();
860         }
861 }
862 int32_t CS_LDK_LDKBech32Error_InvalidChar_get_invalid_char(int64_t ptr) {
863         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
864         CHECK(obj->tag == LDKBech32Error_InvalidChar);
865         int32_t invalid_char_conv = obj->invalid_char;
866         return invalid_char_conv;
867 }
868 int8_t CS_LDK_LDKBech32Error_InvalidData_get_invalid_data(int64_t ptr) {
869         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
870         CHECK(obj->tag == LDKBech32Error_InvalidData);
871         int8_t invalid_data_conv = obj->invalid_data;
872         return invalid_data_conv;
873 }
874 uint32_t CS_LDK_LDKCOption_u64Z_ty_from_ptr(int64_t ptr) {
875         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
876         switch(obj->tag) {
877                 case LDKCOption_u64Z_Some: return 0;
878                 case LDKCOption_u64Z_None: return 1;
879                 default: abort();
880         }
881 }
882 int64_t CS_LDK_LDKCOption_u64Z_Some_get_some(int64_t ptr) {
883         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
884         CHECK(obj->tag == LDKCOption_u64Z_Some);
885         int64_t some_conv = obj->some;
886         return some_conv;
887 }
888 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
889         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
890         for (size_t i = 0; i < ret.datalen; i++) {
891                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
892         }
893         return ret;
894 }
895 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
896         LDKRefund ret = *owner->contents.result;
897         ret.is_owned = false;
898         return ret;
899 }
900 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_ok(int64_t owner) {
901         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
902         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
903         int64_t ret_ref = 0;
904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
906         return ret_ref;
907 }
908
909 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
910         LDKBolt12ParseError ret = *owner->contents.err;
911         ret.is_owned = false;
912         return ret;
913 }
914 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_err(int64_t owner) {
915         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
916         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
917         int64_t ret_ref = 0;
918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
920         return ret_ref;
921 }
922
923 uint32_t CS_LDK_LDKRetry_ty_from_ptr(int64_t ptr) {
924         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
925         switch(obj->tag) {
926                 case LDKRetry_Attempts: return 0;
927                 case LDKRetry_Timeout: return 1;
928                 default: abort();
929         }
930 }
931 int32_t CS_LDK_LDKRetry_Attempts_get_attempts(int64_t ptr) {
932         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
933         CHECK(obj->tag == LDKRetry_Attempts);
934         int32_t attempts_conv = obj->attempts;
935         return attempts_conv;
936 }
937 int64_t CS_LDK_LDKRetry_Timeout_get_timeout(int64_t ptr) {
938         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
939         CHECK(obj->tag == LDKRetry_Timeout);
940         int64_t timeout_conv = obj->timeout;
941         return timeout_conv;
942 }
943 uint32_t CS_LDK_LDKDecodeError_ty_from_ptr(int64_t ptr) {
944         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
945         switch(obj->tag) {
946                 case LDKDecodeError_UnknownVersion: return 0;
947                 case LDKDecodeError_UnknownRequiredFeature: return 1;
948                 case LDKDecodeError_InvalidValue: return 2;
949                 case LDKDecodeError_ShortRead: return 3;
950                 case LDKDecodeError_BadLengthDescriptor: return 4;
951                 case LDKDecodeError_Io: return 5;
952                 case LDKDecodeError_UnsupportedCompression: return 6;
953                 default: abort();
954         }
955 }
956 int32_t CS_LDK_LDKDecodeError_Io_get_io(int64_t ptr) {
957         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
958         CHECK(obj->tag == LDKDecodeError_Io);
959         int32_t io_conv = LDKIOError_to_cs(obj->io);
960         return io_conv;
961 }
962 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
963 CHECK(owner->result_ok);
964         return Retry_clone(&*owner->contents.result);
965 }
966 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_ok(int64_t owner) {
967         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
968         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
969         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
970         int64_t ret_ref = tag_ptr(ret_copy, true);
971         return ret_ref;
972 }
973
974 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
975 CHECK(!owner->result_ok);
976         return DecodeError_clone(&*owner->contents.err);
977 }
978 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_err(int64_t owner) {
979         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
980         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
981         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
982         int64_t ret_ref = tag_ptr(ret_copy, true);
983         return ret_ref;
984 }
985
986 uint32_t CS_LDK_LDKAPIError_ty_from_ptr(int64_t ptr) {
987         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
988         switch(obj->tag) {
989                 case LDKAPIError_APIMisuseError: return 0;
990                 case LDKAPIError_FeeRateTooHigh: return 1;
991                 case LDKAPIError_InvalidRoute: return 2;
992                 case LDKAPIError_ChannelUnavailable: return 3;
993                 case LDKAPIError_MonitorUpdateInProgress: return 4;
994                 case LDKAPIError_IncompatibleShutdownScript: return 5;
995                 default: abort();
996         }
997 }
998 jstring CS_LDK_LDKAPIError_APIMisuseError_get_err(int64_t ptr) {
999         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1000         CHECK(obj->tag == LDKAPIError_APIMisuseError);
1001         LDKStr err_str = obj->api_misuse_error.err;
1002                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1003         return err_conv;
1004 }
1005 jstring CS_LDK_LDKAPIError_FeeRateTooHigh_get_err(int64_t ptr) {
1006         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1007         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1008         LDKStr err_str = obj->fee_rate_too_high.err;
1009                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1010         return err_conv;
1011 }
1012 int32_t CS_LDK_LDKAPIError_FeeRateTooHigh_get_feerate(int64_t ptr) {
1013         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1014         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1015         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1016         return feerate_conv;
1017 }
1018 jstring CS_LDK_LDKAPIError_InvalidRoute_get_err(int64_t ptr) {
1019         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1020         CHECK(obj->tag == LDKAPIError_InvalidRoute);
1021         LDKStr err_str = obj->invalid_route.err;
1022                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1023         return err_conv;
1024 }
1025 jstring CS_LDK_LDKAPIError_ChannelUnavailable_get_err(int64_t ptr) {
1026         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1027         CHECK(obj->tag == LDKAPIError_ChannelUnavailable);
1028         LDKStr err_str = obj->channel_unavailable.err;
1029                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1030         return err_conv;
1031 }
1032 int64_t CS_LDK_LDKAPIError_IncompatibleShutdownScript_get_script(int64_t ptr) {
1033         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1034         CHECK(obj->tag == LDKAPIError_IncompatibleShutdownScript);
1035         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1036                         int64_t script_ref = 0;
1037                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1038                         script_ref = tag_ptr(script_var.inner, false);
1039         return script_ref;
1040 }
1041 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1042 CHECK(owner->result_ok);
1043         return *owner->contents.result;
1044 }
1045 void  CS_LDK_CResult_NoneAPIErrorZ_get_ok(int64_t owner) {
1046         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1047         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1048 }
1049
1050 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1051 CHECK(!owner->result_ok);
1052         return APIError_clone(&*owner->contents.err);
1053 }
1054 int64_t  CS_LDK_CResult_NoneAPIErrorZ_get_err(int64_t owner) {
1055         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1056         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1057         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1058         int64_t ret_ref = tag_ptr(ret_copy, true);
1059         return ret_ref;
1060 }
1061
1062 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1063         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1064         for (size_t i = 0; i < ret.datalen; i++) {
1065                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1066         }
1067         return ret;
1068 }
1069 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1070         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1071         for (size_t i = 0; i < ret.datalen; i++) {
1072                 ret.data[i] = APIError_clone(&orig->data[i]);
1073         }
1074         return ret;
1075 }
1076 uint32_t CS_LDK_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(int64_t ptr) {
1077         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1078         switch(obj->tag) {
1079                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
1080                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
1081                 default: abort();
1082         }
1083 }
1084 int8_tArray CS_LDK_LDKCOption_ThirtyTwoBytesZ_Some_get_some(int64_t ptr) {
1085         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1086         CHECK(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
1087         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
1088         memcpy(some_arr->elems, obj->some.data, 32);
1089         return some_arr;
1090 }
1091 uint32_t CS_LDK_LDKCOption_CVec_u8ZZ_ty_from_ptr(int64_t ptr) {
1092         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1093         switch(obj->tag) {
1094                 case LDKCOption_CVec_u8ZZ_Some: return 0;
1095                 case LDKCOption_CVec_u8ZZ_None: return 1;
1096                 default: abort();
1097         }
1098 }
1099 int8_tArray CS_LDK_LDKCOption_CVec_u8ZZ_Some_get_some(int64_t ptr) {
1100         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1101         CHECK(obj->tag == LDKCOption_CVec_u8ZZ_Some);
1102         LDKCVec_u8Z some_var = obj->some;
1103                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
1104                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
1105         return some_arr;
1106 }
1107 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1108         LDKRecipientOnionFields ret = *owner->contents.result;
1109         ret.is_owned = false;
1110         return ret;
1111 }
1112 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(int64_t owner) {
1113         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1114         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1115         int64_t ret_ref = 0;
1116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1118         return ret_ref;
1119 }
1120
1121 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1122 CHECK(!owner->result_ok);
1123         return DecodeError_clone(&*owner->contents.err);
1124 }
1125 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(int64_t owner) {
1126         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1127         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1128         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1129         int64_t ret_ref = tag_ptr(ret_copy, true);
1130         return ret_ref;
1131 }
1132
1133 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1134         return owner->a;
1135 }
1136 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_a(int64_t owner) {
1137         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1138         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1139         return ret_conv;
1140 }
1141
1142 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1143         return CVec_u8Z_clone(&owner->b);
1144 }
1145 int8_tArray  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_b(int64_t owner) {
1146         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1147         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1150         CVec_u8Z_free(ret_var);
1151         return ret_arr;
1152 }
1153
1154 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
1155         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
1156         for (size_t i = 0; i < ret.datalen; i++) {
1157                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
1158         }
1159         return ret;
1160 }
1161 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1162         LDKRecipientOnionFields ret = *owner->contents.result;
1163         ret.is_owned = false;
1164         return ret;
1165 }
1166 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_ok(int64_t owner) {
1167         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1168         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
1169         int64_t ret_ref = 0;
1170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1172         return ret_ref;
1173 }
1174
1175 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1176 CHECK(!owner->result_ok);
1177         return *owner->contents.err;
1178 }
1179 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_err(int64_t owner) {
1180         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1181         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1182 }
1183
1184 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1185         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1186         for (size_t i = 0; i < ret.datalen; i++) {
1187                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1188         }
1189         return ret;
1190 }
1191 uint32_t CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(int64_t ptr) {
1192         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1193         switch(obj->tag) {
1194                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1195                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1196                 default: abort();
1197         }
1198 }
1199 ptrArray CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(int64_t ptr) {
1200         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1201         CHECK(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1202         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1203                         ptrArray some_arr = NULL;
1204                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1205                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1206                         for (size_t i = 0; i < some_var.datalen; i++) {
1207                                 int8_tArray some_conv_8_arr = init_int8_tArray(32, __LINE__);
1208                                 memcpy(some_conv_8_arr->elems, some_var.data[i].data, 32);
1209                                 some_arr_ptr[i] = some_conv_8_arr;
1210                         }
1211                         
1212         return some_arr;
1213 }
1214 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1215 CHECK(owner->result_ok);
1216         return ThirtyTwoBytes_clone(&*owner->contents.result);
1217 }
1218 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_ok(int64_t owner) {
1219         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1220         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1221         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1222         return ret_arr;
1223 }
1224
1225 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1226 CHECK(!owner->result_ok);
1227         return *owner->contents.err;
1228 }
1229 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_err(int64_t owner) {
1230         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1231         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1232 }
1233
1234 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1235         LDKBlindedPayInfo ret = *owner->contents.result;
1236         ret.is_owned = false;
1237         return ret;
1238 }
1239 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_ok(int64_t owner) {
1240         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1241         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1242         int64_t ret_ref = 0;
1243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1245         return ret_ref;
1246 }
1247
1248 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1249 CHECK(!owner->result_ok);
1250         return DecodeError_clone(&*owner->contents.err);
1251 }
1252 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_err(int64_t owner) {
1253         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1254         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1255         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1256         int64_t ret_ref = tag_ptr(ret_copy, true);
1257         return ret_ref;
1258 }
1259
1260 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1261         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1262         ret.is_owned = false;
1263         return ret;
1264 }
1265 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1266         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1267         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1268         int64_t ret_ref = 0;
1269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1271         return ret_ref;
1272 }
1273
1274 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1275 CHECK(!owner->result_ok);
1276         return DecodeError_clone(&*owner->contents.err);
1277 }
1278 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1279         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1280         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1281         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1282         int64_t ret_ref = tag_ptr(ret_copy, true);
1283         return ret_ref;
1284 }
1285
1286 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1287         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1288         ret.is_owned = false;
1289         return ret;
1290 }
1291 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1292         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1293         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1294         int64_t ret_ref = 0;
1295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1297         return ret_ref;
1298 }
1299
1300 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1301 CHECK(!owner->result_ok);
1302         return DecodeError_clone(&*owner->contents.err);
1303 }
1304 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1305         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1306         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1307         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1308         int64_t ret_ref = tag_ptr(ret_copy, true);
1309         return ret_ref;
1310 }
1311
1312 uint32_t CS_LDK_LDKSpendableOutputDescriptor_ty_from_ptr(int64_t ptr) {
1313         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1314         switch(obj->tag) {
1315                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1316                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1317                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1318                 default: abort();
1319         }
1320 }
1321 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(int64_t ptr) {
1322         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1323         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1324         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1325                         int64_t outpoint_ref = 0;
1326                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1327                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1328         return outpoint_ref;
1329 }
1330 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_output(int64_t ptr) {
1331         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1332         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1333         LDKTxOut* output_ref = &obj->static_output.output;
1334         return tag_ptr(output_ref, false);
1335 }
1336 int8_tArray CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(int64_t ptr) {
1337         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1338         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1339         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1340         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1341         return channel_keys_id_arr;
1342 }
1343 int64_t CS_LDK_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(int64_t ptr) {
1344         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1345         CHECK(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1346         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1347                         int64_t delayed_payment_output_ref = 0;
1348                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1349                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1350         return delayed_payment_output_ref;
1351 }
1352 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(int64_t ptr) {
1353         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1354         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1355         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1356                         int64_t static_payment_output_ref = 0;
1357                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1358                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1359         return static_payment_output_ref;
1360 }
1361 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1362 CHECK(owner->result_ok);
1363         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1364 }
1365 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1366         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1367         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1368         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1369         int64_t ret_ref = tag_ptr(ret_copy, true);
1370         return ret_ref;
1371 }
1372
1373 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1374 CHECK(!owner->result_ok);
1375         return DecodeError_clone(&*owner->contents.err);
1376 }
1377 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1378         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1379         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1380         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1381         int64_t ret_ref = tag_ptr(ret_copy, true);
1382         return ret_ref;
1383 }
1384
1385 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1386         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1387         for (size_t i = 0; i < ret.datalen; i++) {
1388                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1389         }
1390         return ret;
1391 }
1392 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1393         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1394         for (size_t i = 0; i < ret.datalen; i++) {
1395                 ret.data[i] = TxOut_clone(&orig->data[i]);
1396         }
1397         return ret;
1398 }
1399 uint32_t CS_LDK_LDKCOption_u32Z_ty_from_ptr(int64_t ptr) {
1400         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1401         switch(obj->tag) {
1402                 case LDKCOption_u32Z_Some: return 0;
1403                 case LDKCOption_u32Z_None: return 1;
1404                 default: abort();
1405         }
1406 }
1407 int32_t CS_LDK_LDKCOption_u32Z_Some_get_some(int64_t ptr) {
1408         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1409         CHECK(obj->tag == LDKCOption_u32Z_Some);
1410         int32_t some_conv = obj->some;
1411         return some_conv;
1412 }
1413 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1414         return CVec_u8Z_clone(&owner->a);
1415 }
1416 int8_tArray  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_a(int64_t owner) {
1417         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1418         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1419         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1420         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1421         CVec_u8Z_free(ret_var);
1422         return ret_arr;
1423 }
1424
1425 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1426         return owner->b;
1427 }
1428 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_b(int64_t owner) {
1429         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1430         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1431         return ret_conv;
1432 }
1433
1434 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1435 CHECK(owner->result_ok);
1436         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1437 }
1438 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(int64_t owner) {
1439         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1440         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1441         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1442         return tag_ptr(ret_conv, true);
1443 }
1444
1445 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1446 CHECK(!owner->result_ok);
1447         return *owner->contents.err;
1448 }
1449 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(int64_t owner) {
1450         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1451         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1452 }
1453
1454 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1455         LDKChannelDerivationParameters ret = *owner->contents.result;
1456         ret.is_owned = false;
1457         return ret;
1458 }
1459 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(int64_t owner) {
1460         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1461         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1462         int64_t ret_ref = 0;
1463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1465         return ret_ref;
1466 }
1467
1468 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1469 CHECK(!owner->result_ok);
1470         return DecodeError_clone(&*owner->contents.err);
1471 }
1472 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(int64_t owner) {
1473         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1474         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1475         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1476         int64_t ret_ref = tag_ptr(ret_copy, true);
1477         return ret_ref;
1478 }
1479
1480 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1481         LDKHTLCDescriptor ret = *owner->contents.result;
1482         ret.is_owned = false;
1483         return ret;
1484 }
1485 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1486         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1487         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1488         int64_t ret_ref = 0;
1489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1491         return ret_ref;
1492 }
1493
1494 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1495 CHECK(!owner->result_ok);
1496         return DecodeError_clone(&*owner->contents.err);
1497 }
1498 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_err(int64_t owner) {
1499         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1500         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1501         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1502         int64_t ret_ref = tag_ptr(ret_copy, true);
1503         return ret_ref;
1504 }
1505
1506 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1507 CHECK(owner->result_ok);
1508         return *owner->contents.result;
1509 }
1510 void  CS_LDK_CResult_NoneNoneZ_get_ok(int64_t owner) {
1511         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1512         CResult_NoneNoneZ_get_ok(owner_conv);
1513 }
1514
1515 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1516 CHECK(!owner->result_ok);
1517         return *owner->contents.err;
1518 }
1519 void  CS_LDK_CResult_NoneNoneZ_get_err(int64_t owner) {
1520         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1521         CResult_NoneNoneZ_get_err(owner_conv);
1522 }
1523
1524 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1525 CHECK(owner->result_ok);
1526         return *owner->contents.result;
1527 }
1528 int8_tArray  CS_LDK_CResult_PublicKeyNoneZ_get_ok(int64_t owner) {
1529         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1530         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1531         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1532         return ret_arr;
1533 }
1534
1535 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1536 CHECK(!owner->result_ok);
1537         return *owner->contents.err;
1538 }
1539 void  CS_LDK_CResult_PublicKeyNoneZ_get_err(int64_t owner) {
1540         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1541         CResult_PublicKeyNoneZ_get_err(owner_conv);
1542 }
1543
1544 uint32_t CS_LDK_LDKCOption_BigEndianScalarZ_ty_from_ptr(int64_t ptr) {
1545         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1546         switch(obj->tag) {
1547                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1548                 case LDKCOption_BigEndianScalarZ_None: return 1;
1549                 default: abort();
1550         }
1551 }
1552 int64_t CS_LDK_LDKCOption_BigEndianScalarZ_Some_get_some(int64_t ptr) {
1553         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1554         CHECK(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1555         LDKBigEndianScalar* some_ref = &obj->some;
1556         return tag_ptr(some_ref, false);
1557 }
1558 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1559 CHECK(owner->result_ok);
1560         return *owner->contents.result;
1561 }
1562 int8_tArray  CS_LDK_CResult_RecoverableSignatureNoneZ_get_ok(int64_t owner) {
1563         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1564         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1565         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1566         return ret_arr;
1567 }
1568
1569 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1570 CHECK(!owner->result_ok);
1571         return *owner->contents.err;
1572 }
1573 void  CS_LDK_CResult_RecoverableSignatureNoneZ_get_err(int64_t owner) {
1574         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1575         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1576 }
1577
1578 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1579 CHECK(owner->result_ok);
1580         return *owner->contents.result;
1581 }
1582 int8_tArray  CS_LDK_CResult_SchnorrSignatureNoneZ_get_ok(int64_t owner) {
1583         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1584         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1585         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1586         return ret_arr;
1587 }
1588
1589 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1590 CHECK(!owner->result_ok);
1591         return *owner->contents.err;
1592 }
1593 void  CS_LDK_CResult_SchnorrSignatureNoneZ_get_err(int64_t owner) {
1594         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1595         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1596 }
1597
1598 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1599 CHECK(owner->result_ok);
1600         return *owner->contents.result;
1601 }
1602 int8_tArray  CS_LDK_CResult_ECDSASignatureNoneZ_get_ok(int64_t owner) {
1603         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1604         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1605         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1606         return ret_arr;
1607 }
1608
1609 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1610 CHECK(!owner->result_ok);
1611         return *owner->contents.err;
1612 }
1613 void  CS_LDK_CResult_ECDSASignatureNoneZ_get_err(int64_t owner) {
1614         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1615         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1616 }
1617
1618 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1619         return owner->a;
1620 }
1621 int8_tArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(int64_t owner) {
1622         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1623         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1624         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1625         return ret_arr;
1626 }
1627
1628 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1629         return owner->b;
1630 }
1631 ptrArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(int64_t owner) {
1632         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1633         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1634         ptrArray ret_arr = NULL;
1635         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1636         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1637         for (size_t i = 0; i < ret_var.datalen; i++) {
1638                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
1639                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
1640                 ret_arr_ptr[i] = ret_conv_8_arr;
1641         }
1642         
1643         return ret_arr;
1644 }
1645
1646 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1647 CHECK(owner->result_ok);
1648         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1649 }
1650 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(int64_t owner) {
1651         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1652         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1653         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1654         return tag_ptr(ret_conv, true);
1655 }
1656
1657 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1658 CHECK(!owner->result_ok);
1659         return *owner->contents.err;
1660 }
1661 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(int64_t owner) {
1662         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1663         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1664 }
1665
1666 typedef struct LDKChannelSigner_JCalls {
1667         atomic_size_t refcnt;
1668         uint32_t instance_ptr;
1669 } LDKChannelSigner_JCalls;
1670 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1671         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1672         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1673                 FREE(j_calls);
1674         }
1675 }
1676 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1677         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1678         int64_t idx_conv = idx;
1679         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 0, idx_conv);
1680         LDKPublicKey ret_ref;
1681         CHECK(ret->arr_len == 33);
1682         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1683         return ret_ref;
1684 }
1685 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1686         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1687         int64_t idx_conv = idx;
1688         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 1, idx_conv);
1689         LDKThirtyTwoBytes ret_ref;
1690         CHECK(ret->arr_len == 32);
1691         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1692         return ret_ref;
1693 }
1694 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1695         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1696         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1697         int64_t holder_tx_ref = 0;
1698         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1699         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1700         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1701         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1702         ptrArray outbound_htlc_preimages_arr = NULL;
1703         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1704         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1705         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
1706                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1707                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
1708                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
1709         }
1710         
1711         FREE(outbound_htlc_preimages_var.data);
1712         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 2, holder_tx_ref, (int64_t)outbound_htlc_preimages_arr);
1713         void* ret_ptr = untag_ptr(ret);
1714         CHECK_ACCESS(ret_ptr);
1715         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1716         FREE(untag_ptr(ret));
1717         return ret_conv;
1718 }
1719 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1720         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1721         int64_t idx_conv = idx;
1722         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1723         memcpy(secret_arr->elems, *secret, 32);
1724         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 3, idx_conv, (int64_t)secret_arr);
1725         void* ret_ptr = untag_ptr(ret);
1726         CHECK_ACCESS(ret_ptr);
1727         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1728         FREE(untag_ptr(ret));
1729         return ret_conv;
1730 }
1731 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1732         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1733         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 4);
1734         LDKThirtyTwoBytes ret_ref;
1735         CHECK(ret->arr_len == 32);
1736         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1737         return ret_ref;
1738 }
1739 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1740         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1741         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1742         int64_t channel_parameters_ref = 0;
1743         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1744         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1745         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1746         js_invoke_function_void_l(j_calls->instance_ptr, 5, channel_parameters_ref);
1747 }
1748 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1749         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1750         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1751 }
1752 static inline LDKChannelSigner LDKChannelSigner_init (int64_t o, int64_t pubkeys) {
1753         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1754         atomic_init(&calls->refcnt, 1);
1755         calls->instance_ptr = o;
1756
1757         LDKChannelPublicKeys pubkeys_conv;
1758         pubkeys_conv.inner = untag_ptr(pubkeys);
1759         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1760         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1761
1762         LDKChannelSigner ret = {
1763                 .this_arg = (void*) calls,
1764                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1765                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1766                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1767                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1768                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1769                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1770                 .free = LDKChannelSigner_JCalls_free,
1771                 .pubkeys = pubkeys_conv,
1772                 .set_pubkeys = NULL,
1773         };
1774         return ret;
1775 }
1776 uint64_t  CS_LDK_LDKChannelSigner_new(int32_t o, int64_t pubkeys) {
1777         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1778         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1779         return tag_ptr(res_ptr, true);
1780 }
1781 int8_tArray  CS_LDK_ChannelSigner_get_per_commitment_point(int64_t this_arg, int64_t idx) {
1782         void* this_arg_ptr = untag_ptr(this_arg);
1783         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1784         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1785         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1786         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1787         return ret_arr;
1788 }
1789
1790 int8_tArray  CS_LDK_ChannelSigner_release_commitment_secret(int64_t this_arg, int64_t idx) {
1791         void* this_arg_ptr = untag_ptr(this_arg);
1792         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1793         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1794         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1795         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1796         return ret_arr;
1797 }
1798
1799 int64_t  CS_LDK_ChannelSigner_validate_holder_commitment(int64_t this_arg, int64_t holder_tx, ptrArray outbound_htlc_preimages) {
1800         void* this_arg_ptr = untag_ptr(this_arg);
1801         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1802         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1803         LDKHolderCommitmentTransaction holder_tx_conv;
1804         holder_tx_conv.inner = untag_ptr(holder_tx);
1805         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1806         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1807         holder_tx_conv.is_owned = false;
1808         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1809         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1810         if (outbound_htlc_preimages_constr.datalen > 0)
1811                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1812         else
1813                 outbound_htlc_preimages_constr.data = NULL;
1814         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1815         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
1816                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
1817                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
1818                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
1819                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
1820                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
1821         }
1822         FREE(outbound_htlc_preimages);
1823         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1824         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
1825         return tag_ptr(ret_conv, true);
1826 }
1827
1828 int64_t  CS_LDK_ChannelSigner_validate_counterparty_revocation(int64_t this_arg, int64_t idx, int8_tArray secret) {
1829         void* this_arg_ptr = untag_ptr(this_arg);
1830         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1831         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1832         uint8_t secret_arr[32];
1833         CHECK(secret->arr_len == 32);
1834         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1835         uint8_t (*secret_ref)[32] = &secret_arr;
1836         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1837         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1838         return tag_ptr(ret_conv, true);
1839 }
1840
1841 int8_tArray  CS_LDK_ChannelSigner_channel_keys_id(int64_t this_arg) {
1842         void* this_arg_ptr = untag_ptr(this_arg);
1843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1844         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1845         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1846         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1847         return ret_arr;
1848 }
1849
1850 void  CS_LDK_ChannelSigner_provide_channel_parameters(int64_t this_arg, int64_t channel_parameters) {
1851         void* this_arg_ptr = untag_ptr(this_arg);
1852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1853         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1854         LDKChannelTransactionParameters channel_parameters_conv;
1855         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1856         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1857         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1858         channel_parameters_conv.is_owned = false;
1859         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1860 }
1861
1862 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1863         if (this_arg->set_pubkeys != NULL)
1864                 this_arg->set_pubkeys(this_arg);
1865         return this_arg->pubkeys;
1866 }
1867 int64_t  CS_LDK_ChannelSigner_get_pubkeys(int64_t this_arg) {
1868         void* this_arg_ptr = untag_ptr(this_arg);
1869         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1870         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1871         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1872         int64_t ret_ref = 0;
1873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1875         return ret_ref;
1876 }
1877
1878 typedef struct LDKEcdsaChannelSigner_JCalls {
1879         atomic_size_t refcnt;
1880         uint32_t instance_ptr;
1881         LDKChannelSigner_JCalls* ChannelSigner;
1882 } LDKEcdsaChannelSigner_JCalls;
1883 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1884         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1885         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1886                 FREE(j_calls);
1887         }
1888 }
1889 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1890         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1891         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1892         int64_t commitment_tx_ref = 0;
1893         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1894         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1895         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1896         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
1897         ptrArray inbound_htlc_preimages_arr = NULL;
1898         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
1899         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
1900         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
1901                 int8_tArray inbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1902                 memcpy(inbound_htlc_preimages_conv_8_arr->elems, inbound_htlc_preimages_var.data[i].data, 32);
1903                 inbound_htlc_preimages_arr_ptr[i] = inbound_htlc_preimages_conv_8_arr;
1904         }
1905         
1906         FREE(inbound_htlc_preimages_var.data);
1907         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1908         ptrArray outbound_htlc_preimages_arr = NULL;
1909         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1910         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1911         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
1912                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1913                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
1914                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
1915         }
1916         
1917         FREE(outbound_htlc_preimages_var.data);
1918         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 6, commitment_tx_ref, (int64_t)inbound_htlc_preimages_arr, (int64_t)outbound_htlc_preimages_arr);
1919         void* ret_ptr = untag_ptr(ret);
1920         CHECK_ACCESS(ret_ptr);
1921         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1922         FREE(untag_ptr(ret));
1923         return ret_conv;
1924 }
1925 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1926         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1927         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1928         int64_t commitment_tx_ref = 0;
1929         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1930         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1931         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1932         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 7, commitment_tx_ref);
1933         void* ret_ptr = untag_ptr(ret);
1934         CHECK_ACCESS(ret_ptr);
1935         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1936         FREE(untag_ptr(ret));
1937         return ret_conv;
1938 }
1939 LDKCResult_ECDSASignatureNoneZ 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]) {
1940         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1941         LDKTransaction justice_tx_var = justice_tx;
1942         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1943         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1944         Transaction_free(justice_tx_var);
1945         int64_t input_conv = input;
1946         int64_t amount_conv = amount;
1947         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1948         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1949         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 8, (int64_t)justice_tx_arr, input_conv, amount_conv, (int64_t)per_commitment_key_arr);
1950         void* ret_ptr = untag_ptr(ret);
1951         CHECK_ACCESS(ret_ptr);
1952         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1953         FREE(untag_ptr(ret));
1954         return ret_conv;
1955 }
1956 LDKCResult_ECDSASignatureNoneZ 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) {
1957         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1958         LDKTransaction justice_tx_var = justice_tx;
1959         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1960         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1961         Transaction_free(justice_tx_var);
1962         int64_t input_conv = input;
1963         int64_t amount_conv = amount;
1964         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1965         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1966         LDKHTLCOutputInCommitment htlc_var = *htlc;
1967         int64_t htlc_ref = 0;
1968         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1969         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1970         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1971         uint64_t ret = js_invoke_function_l_lllll(j_calls->instance_ptr, 9, (int64_t)justice_tx_arr, input_conv, amount_conv, (int64_t)per_commitment_key_arr, htlc_ref);
1972         void* ret_ptr = untag_ptr(ret);
1973         CHECK_ACCESS(ret_ptr);
1974         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1975         FREE(untag_ptr(ret));
1976         return ret_conv;
1977 }
1978 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1979         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1980         LDKTransaction htlc_tx_var = htlc_tx;
1981         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1982         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1983         Transaction_free(htlc_tx_var);
1984         int64_t input_conv = input;
1985         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1986         int64_t htlc_descriptor_ref = 0;
1987         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1988         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1989         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1990         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 10, (int64_t)htlc_tx_arr, input_conv, htlc_descriptor_ref);
1991         void* ret_ptr = untag_ptr(ret);
1992         CHECK_ACCESS(ret_ptr);
1993         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1994         FREE(untag_ptr(ret));
1995         return ret_conv;
1996 }
1997 LDKCResult_ECDSASignatureNoneZ 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) {
1998         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1999         LDKTransaction htlc_tx_var = htlc_tx;
2000         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2001         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2002         Transaction_free(htlc_tx_var);
2003         int64_t input_conv = input;
2004         int64_t amount_conv = amount;
2005         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2006         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2007         LDKHTLCOutputInCommitment htlc_var = *htlc;
2008         int64_t htlc_ref = 0;
2009         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2010         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2011         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2012         uint64_t ret = js_invoke_function_l_lllll(j_calls->instance_ptr, 11, (int64_t)htlc_tx_arr, input_conv, amount_conv, (int64_t)per_commitment_point_arr, htlc_ref);
2013         void* ret_ptr = untag_ptr(ret);
2014         CHECK_ACCESS(ret_ptr);
2015         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2016         FREE(untag_ptr(ret));
2017         return ret_conv;
2018 }
2019 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2020         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2021         LDKClosingTransaction closing_tx_var = *closing_tx;
2022         int64_t closing_tx_ref = 0;
2023         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2024         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2025         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2026         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 12, closing_tx_ref);
2027         void* ret_ptr = untag_ptr(ret);
2028         CHECK_ACCESS(ret_ptr);
2029         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2030         FREE(untag_ptr(ret));
2031         return ret_conv;
2032 }
2033 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2034         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2035         LDKTransaction anchor_tx_var = anchor_tx;
2036         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2037         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2038         Transaction_free(anchor_tx_var);
2039         int64_t input_conv = input;
2040         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 13, (int64_t)anchor_tx_arr, input_conv);
2041         void* ret_ptr = untag_ptr(ret);
2042         CHECK_ACCESS(ret_ptr);
2043         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2044         FREE(untag_ptr(ret));
2045         return ret_conv;
2046 }
2047 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2048         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2049         LDKUnsignedChannelAnnouncement msg_var = *msg;
2050         int64_t msg_ref = 0;
2051         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2053         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2054         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 14, msg_ref);
2055         void* ret_ptr = untag_ptr(ret);
2056         CHECK_ACCESS(ret_ptr);
2057         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2058         FREE(untag_ptr(ret));
2059         return ret_conv;
2060 }
2061 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2062         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2063         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2064         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2065 }
2066 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (int64_t o, int64_t ChannelSigner, int64_t pubkeys) {
2067         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2068         atomic_init(&calls->refcnt, 1);
2069         calls->instance_ptr = o;
2070
2071         LDKChannelPublicKeys pubkeys_conv;
2072         pubkeys_conv.inner = untag_ptr(pubkeys);
2073         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2074         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2075
2076         LDKEcdsaChannelSigner ret = {
2077                 .this_arg = (void*) calls,
2078                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2079                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
2080                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2081                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2082                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2083                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2084                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2085                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2086                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2087                 .free = LDKEcdsaChannelSigner_JCalls_free,
2088                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2089         };
2090         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2091         return ret;
2092 }
2093 uint64_t  CS_LDK_LDKEcdsaChannelSigner_new(int32_t o, int32_t ChannelSigner, int64_t pubkeys) {
2094         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2095         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2096         return tag_ptr(res_ptr, true);
2097 }
2098 int64_t  CS_LDK_EcdsaChannelSigner_sign_counterparty_commitment(int64_t this_arg, int64_t commitment_tx, ptrArray inbound_htlc_preimages, ptrArray outbound_htlc_preimages) {
2099         void* this_arg_ptr = untag_ptr(this_arg);
2100         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2101         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2102         LDKCommitmentTransaction commitment_tx_conv;
2103         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2104         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2105         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2106         commitment_tx_conv.is_owned = false;
2107         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
2108         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
2109         if (inbound_htlc_preimages_constr.datalen > 0)
2110                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2111         else
2112                 inbound_htlc_preimages_constr.data = NULL;
2113         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
2114         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
2115                 int8_tArray inbound_htlc_preimages_conv_8 = inbound_htlc_preimages_vals[i];
2116                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
2117                 CHECK(inbound_htlc_preimages_conv_8->arr_len == 32);
2118                 memcpy(inbound_htlc_preimages_conv_8_ref.data, inbound_htlc_preimages_conv_8->elems, 32); FREE(inbound_htlc_preimages_conv_8);
2119                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
2120         }
2121         FREE(inbound_htlc_preimages);
2122         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2123         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2124         if (outbound_htlc_preimages_constr.datalen > 0)
2125                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2126         else
2127                 outbound_htlc_preimages_constr.data = NULL;
2128         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2129         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2130                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
2131                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2132                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
2133                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
2134                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2135         }
2136         FREE(outbound_htlc_preimages);
2137         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
2138         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
2139         return tag_ptr(ret_conv, true);
2140 }
2141
2142 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_commitment(int64_t this_arg, int64_t commitment_tx) {
2143         void* this_arg_ptr = untag_ptr(this_arg);
2144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2145         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2146         LDKHolderCommitmentTransaction commitment_tx_conv;
2147         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2148         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2149         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2150         commitment_tx_conv.is_owned = false;
2151         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2152         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2153         return tag_ptr(ret_conv, true);
2154 }
2155
2156 int64_t  CS_LDK_EcdsaChannelSigner_sign_justice_revoked_output(int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2157         void* this_arg_ptr = untag_ptr(this_arg);
2158         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2159         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2160         LDKTransaction justice_tx_ref;
2161         justice_tx_ref.datalen = justice_tx->arr_len;
2162         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2163         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2164         justice_tx_ref.data_is_owned = true;
2165         uint8_t per_commitment_key_arr[32];
2166         CHECK(per_commitment_key->arr_len == 32);
2167         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2168         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2169         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2170         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2171         return tag_ptr(ret_conv, true);
2172 }
2173
2174 int64_t  CS_LDK_EcdsaChannelSigner_sign_justice_revoked_htlc(int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
2175         void* this_arg_ptr = untag_ptr(this_arg);
2176         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2177         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2178         LDKTransaction justice_tx_ref;
2179         justice_tx_ref.datalen = justice_tx->arr_len;
2180         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2181         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2182         justice_tx_ref.data_is_owned = true;
2183         uint8_t per_commitment_key_arr[32];
2184         CHECK(per_commitment_key->arr_len == 32);
2185         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2186         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2187         LDKHTLCOutputInCommitment htlc_conv;
2188         htlc_conv.inner = untag_ptr(htlc);
2189         htlc_conv.is_owned = ptr_is_owned(htlc);
2190         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2191         htlc_conv.is_owned = false;
2192         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2193         *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);
2194         return tag_ptr(ret_conv, true);
2195 }
2196
2197 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_htlc_transaction(int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t htlc_descriptor) {
2198         void* this_arg_ptr = untag_ptr(this_arg);
2199         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2200         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2201         LDKTransaction htlc_tx_ref;
2202         htlc_tx_ref.datalen = htlc_tx->arr_len;
2203         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2204         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2205         htlc_tx_ref.data_is_owned = true;
2206         LDKHTLCDescriptor htlc_descriptor_conv;
2207         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2208         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2209         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2210         htlc_descriptor_conv.is_owned = false;
2211         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2212         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2213         return tag_ptr(ret_conv, true);
2214 }
2215
2216 int64_t  CS_LDK_EcdsaChannelSigner_sign_counterparty_htlc_transaction(int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
2217         void* this_arg_ptr = untag_ptr(this_arg);
2218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2219         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2220         LDKTransaction htlc_tx_ref;
2221         htlc_tx_ref.datalen = htlc_tx->arr_len;
2222         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2223         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2224         htlc_tx_ref.data_is_owned = true;
2225         LDKPublicKey per_commitment_point_ref;
2226         CHECK(per_commitment_point->arr_len == 33);
2227         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2228         LDKHTLCOutputInCommitment htlc_conv;
2229         htlc_conv.inner = untag_ptr(htlc);
2230         htlc_conv.is_owned = ptr_is_owned(htlc);
2231         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2232         htlc_conv.is_owned = false;
2233         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2234         *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);
2235         return tag_ptr(ret_conv, true);
2236 }
2237
2238 int64_t  CS_LDK_EcdsaChannelSigner_sign_closing_transaction(int64_t this_arg, int64_t closing_tx) {
2239         void* this_arg_ptr = untag_ptr(this_arg);
2240         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2241         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2242         LDKClosingTransaction closing_tx_conv;
2243         closing_tx_conv.inner = untag_ptr(closing_tx);
2244         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2245         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2246         closing_tx_conv.is_owned = false;
2247         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2248         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2249         return tag_ptr(ret_conv, true);
2250 }
2251
2252 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_anchor_input(int64_t this_arg, int8_tArray anchor_tx, int64_t input) {
2253         void* this_arg_ptr = untag_ptr(this_arg);
2254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2255         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2256         LDKTransaction anchor_tx_ref;
2257         anchor_tx_ref.datalen = anchor_tx->arr_len;
2258         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2259         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2260         anchor_tx_ref.data_is_owned = true;
2261         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2262         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2263         return tag_ptr(ret_conv, true);
2264 }
2265
2266 int64_t  CS_LDK_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(int64_t this_arg, int64_t msg) {
2267         void* this_arg_ptr = untag_ptr(this_arg);
2268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2269         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2270         LDKUnsignedChannelAnnouncement msg_conv;
2271         msg_conv.inner = untag_ptr(msg);
2272         msg_conv.is_owned = ptr_is_owned(msg);
2273         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2274         msg_conv.is_owned = false;
2275         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2276         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2277         return tag_ptr(ret_conv, true);
2278 }
2279
2280 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2281         atomic_size_t refcnt;
2282         uint32_t instance_ptr;
2283         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2284         LDKChannelSigner_JCalls* ChannelSigner;
2285 } LDKWriteableEcdsaChannelSigner_JCalls;
2286 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2287         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2288         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2289                 FREE(j_calls);
2290         }
2291 }
2292 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2293         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2294         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 15);
2295         LDKCVec_u8Z ret_ref;
2296         ret_ref.datalen = ret->arr_len;
2297         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2298         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2299         return ret_ref;
2300 }
2301 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2302         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2303         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2304         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2305         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2306 }
2307 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (int64_t o, int64_t EcdsaChannelSigner, int64_t ChannelSigner, int64_t pubkeys) {
2308         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2309         atomic_init(&calls->refcnt, 1);
2310         calls->instance_ptr = o;
2311
2312         LDKChannelPublicKeys pubkeys_conv;
2313         pubkeys_conv.inner = untag_ptr(pubkeys);
2314         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2315         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2316
2317         LDKWriteableEcdsaChannelSigner ret = {
2318                 .this_arg = (void*) calls,
2319                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2320                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2321                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2322                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2323         };
2324         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2325         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2326         return ret;
2327 }
2328 uint64_t  CS_LDK_LDKWriteableEcdsaChannelSigner_new(int32_t o, int32_t EcdsaChannelSigner, int32_t ChannelSigner, int64_t pubkeys) {
2329         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2330         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2331         return tag_ptr(res_ptr, true);
2332 }
2333 int8_tArray  CS_LDK_WriteableEcdsaChannelSigner_write(int64_t this_arg) {
2334         void* this_arg_ptr = untag_ptr(this_arg);
2335         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2336         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2337         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2338         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2339         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2340         CVec_u8Z_free(ret_var);
2341         return ret_arr;
2342 }
2343
2344 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2345 CHECK(owner->result_ok);
2346         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2347 }
2348 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(int64_t owner) {
2349         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2350         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2351         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2352         return tag_ptr(ret_ret, true);
2353 }
2354
2355 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2356 CHECK(!owner->result_ok);
2357         return DecodeError_clone(&*owner->contents.err);
2358 }
2359 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(int64_t owner) {
2360         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2361         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2362         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2363         int64_t ret_ref = tag_ptr(ret_copy, true);
2364         return ret_ref;
2365 }
2366
2367 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2368 CHECK(owner->result_ok);
2369         return CVec_u8Z_clone(&*owner->contents.result);
2370 }
2371 int8_tArray  CS_LDK_CResult_CVec_u8ZNoneZ_get_ok(int64_t owner) {
2372         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2373         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2374         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2375         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2376         CVec_u8Z_free(ret_var);
2377         return ret_arr;
2378 }
2379
2380 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2381 CHECK(!owner->result_ok);
2382         return *owner->contents.err;
2383 }
2384 void  CS_LDK_CResult_CVec_u8ZNoneZ_get_err(int64_t owner) {
2385         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2386         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2387 }
2388
2389 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2390         LDKShutdownScript ret = *owner->contents.result;
2391         ret.is_owned = false;
2392         return ret;
2393 }
2394 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_get_ok(int64_t owner) {
2395         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2396         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2397         int64_t ret_ref = 0;
2398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2400         return ret_ref;
2401 }
2402
2403 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2404 CHECK(!owner->result_ok);
2405         return *owner->contents.err;
2406 }
2407 void  CS_LDK_CResult_ShutdownScriptNoneZ_get_err(int64_t owner) {
2408         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2409         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2410 }
2411
2412 uint32_t CS_LDK_LDKCOption_u16Z_ty_from_ptr(int64_t ptr) {
2413         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2414         switch(obj->tag) {
2415                 case LDKCOption_u16Z_Some: return 0;
2416                 case LDKCOption_u16Z_None: return 1;
2417                 default: abort();
2418         }
2419 }
2420 int16_t CS_LDK_LDKCOption_u16Z_Some_get_some(int64_t ptr) {
2421         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2422         CHECK(obj->tag == LDKCOption_u16Z_Some);
2423         int16_t some_conv = obj->some;
2424         return some_conv;
2425 }
2426 uint32_t CS_LDK_LDKCOption_boolZ_ty_from_ptr(int64_t ptr) {
2427         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2428         switch(obj->tag) {
2429                 case LDKCOption_boolZ_Some: return 0;
2430                 case LDKCOption_boolZ_None: return 1;
2431                 default: abort();
2432         }
2433 }
2434 jboolean CS_LDK_LDKCOption_boolZ_Some_get_some(int64_t ptr) {
2435         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2436         CHECK(obj->tag == LDKCOption_boolZ_Some);
2437         jboolean some_conv = obj->some;
2438         return some_conv;
2439 }
2440 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2441 CHECK(owner->result_ok);
2442         return Witness_clone(&*owner->contents.result);
2443 }
2444 int8_tArray  CS_LDK_CResult_WitnessNoneZ_get_ok(int64_t owner) {
2445         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2446         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2447         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2448         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2449         Witness_free(ret_var);
2450         return ret_arr;
2451 }
2452
2453 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2454 CHECK(!owner->result_ok);
2455         return *owner->contents.err;
2456 }
2457 void  CS_LDK_CResult_WitnessNoneZ_get_err(int64_t owner) {
2458         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2459         CResult_WitnessNoneZ_get_err(owner_conv);
2460 }
2461
2462 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2463         LDKInMemorySigner ret = *owner->contents.result;
2464         ret.is_owned = false;
2465         return ret;
2466 }
2467 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_ok(int64_t owner) {
2468         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2469         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2470         int64_t ret_ref = 0;
2471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2473         return ret_ref;
2474 }
2475
2476 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2477 CHECK(!owner->result_ok);
2478         return DecodeError_clone(&*owner->contents.err);
2479 }
2480 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_err(int64_t owner) {
2481         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2483         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2484         int64_t ret_ref = tag_ptr(ret_copy, true);
2485         return ret_ref;
2486 }
2487
2488 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2489 CHECK(owner->result_ok);
2490         return *owner->contents.result;
2491 }
2492 int8_tArray  CS_LDK_CResult_TransactionNoneZ_get_ok(int64_t owner) {
2493         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2494         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2495         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2496         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2497         return ret_arr;
2498 }
2499
2500 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2501 CHECK(!owner->result_ok);
2502         return *owner->contents.err;
2503 }
2504 void  CS_LDK_CResult_TransactionNoneZ_get_err(int64_t owner) {
2505         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2506         CResult_TransactionNoneZ_get_err(owner_conv);
2507 }
2508
2509 uint32_t CS_LDK_LDKCandidateRouteHop_ty_from_ptr(int64_t ptr) {
2510         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2511         switch(obj->tag) {
2512                 case LDKCandidateRouteHop_FirstHop: return 0;
2513                 case LDKCandidateRouteHop_PublicHop: return 1;
2514                 case LDKCandidateRouteHop_PrivateHop: return 2;
2515                 case LDKCandidateRouteHop_Blinded: return 3;
2516                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
2517                 default: abort();
2518         }
2519 }
2520 int64_t CS_LDK_LDKCandidateRouteHop_FirstHop_get_first_hop(int64_t ptr) {
2521         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2522         CHECK(obj->tag == LDKCandidateRouteHop_FirstHop);
2523         LDKFirstHopCandidate first_hop_var = obj->first_hop;
2524                         int64_t first_hop_ref = 0;
2525                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
2526                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
2527         return first_hop_ref;
2528 }
2529 int64_t CS_LDK_LDKCandidateRouteHop_PublicHop_get_public_hop(int64_t ptr) {
2530         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2531         CHECK(obj->tag == LDKCandidateRouteHop_PublicHop);
2532         LDKPublicHopCandidate public_hop_var = obj->public_hop;
2533                         int64_t public_hop_ref = 0;
2534                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
2535                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
2536         return public_hop_ref;
2537 }
2538 int64_t CS_LDK_LDKCandidateRouteHop_PrivateHop_get_private_hop(int64_t ptr) {
2539         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2540         CHECK(obj->tag == LDKCandidateRouteHop_PrivateHop);
2541         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
2542                         int64_t private_hop_ref = 0;
2543                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
2544                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
2545         return private_hop_ref;
2546 }
2547 int64_t CS_LDK_LDKCandidateRouteHop_Blinded_get_blinded(int64_t ptr) {
2548         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2549         CHECK(obj->tag == LDKCandidateRouteHop_Blinded);
2550         LDKBlindedPathCandidate blinded_var = obj->blinded;
2551                         int64_t blinded_ref = 0;
2552                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
2553                         blinded_ref = tag_ptr(blinded_var.inner, false);
2554         return blinded_ref;
2555 }
2556 int64_t CS_LDK_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(int64_t ptr) {
2557         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2558         CHECK(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
2559         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
2560                         int64_t one_hop_blinded_ref = 0;
2561                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
2562                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
2563         return one_hop_blinded_ref;
2564 }
2565 typedef struct LDKScoreLookUp_JCalls {
2566         atomic_size_t refcnt;
2567         uint32_t instance_ptr;
2568 } LDKScoreLookUp_JCalls;
2569 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
2570         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2571         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2572                 FREE(j_calls);
2573         }
2574 }
2575 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
2576         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2577         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
2578         *ret_candidate = CandidateRouteHop_clone(candidate);
2579         int64_t ref_candidate = tag_ptr(ret_candidate, true);
2580         LDKChannelUsage usage_var = usage;
2581         int64_t usage_ref = 0;
2582         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
2583         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
2584         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
2585         int64_t score_params_ref = 0;
2586         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
2587         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
2588         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
2589         return js_invoke_function_l_lll(j_calls->instance_ptr, 16, ref_candidate, usage_ref, score_params_ref);
2590 }
2591 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
2592         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
2593         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2594 }
2595 static inline LDKScoreLookUp LDKScoreLookUp_init (int64_t o) {
2596         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
2597         atomic_init(&calls->refcnt, 1);
2598         calls->instance_ptr = o;
2599
2600         LDKScoreLookUp ret = {
2601                 .this_arg = (void*) calls,
2602                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
2603                 .free = LDKScoreLookUp_JCalls_free,
2604         };
2605         return ret;
2606 }
2607 uint64_t  CS_LDK_LDKScoreLookUp_new(int32_t o) {
2608         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
2609         *res_ptr = LDKScoreLookUp_init(o);
2610         return tag_ptr(res_ptr, true);
2611 }
2612 int64_t  CS_LDK_ScoreLookUp_channel_penalty_msat(int64_t this_arg, int64_t candidate, int64_t usage, int64_t score_params) {
2613         void* this_arg_ptr = untag_ptr(this_arg);
2614         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2615         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
2616         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
2617         LDKChannelUsage usage_conv;
2618         usage_conv.inner = untag_ptr(usage);
2619         usage_conv.is_owned = ptr_is_owned(usage);
2620         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
2621         usage_conv = ChannelUsage_clone(&usage_conv);
2622         LDKProbabilisticScoringFeeParameters score_params_conv;
2623         score_params_conv.inner = untag_ptr(score_params);
2624         score_params_conv.is_owned = ptr_is_owned(score_params);
2625         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
2626         score_params_conv.is_owned = false;
2627         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
2628         return ret_conv;
2629 }
2630
2631 typedef struct LDKScoreUpdate_JCalls {
2632         atomic_size_t refcnt;
2633         uint32_t instance_ptr;
2634 } LDKScoreUpdate_JCalls;
2635 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
2636         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2637         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2638                 FREE(j_calls);
2639         }
2640 }
2641 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2642         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2643         LDKPath path_var = *path;
2644         int64_t path_ref = 0;
2645         path_var = Path_clone(&path_var);
2646         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2647         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2648         int64_t short_channel_id_conv = short_channel_id;
2649         int64_t duration_since_epoch_conv = duration_since_epoch;
2650         js_invoke_function_void_lll(j_calls->instance_ptr, 17, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2651 }
2652 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2653         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2654         LDKPath path_var = *path;
2655         int64_t path_ref = 0;
2656         path_var = Path_clone(&path_var);
2657         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2658         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2659         int64_t duration_since_epoch_conv = duration_since_epoch;
2660         js_invoke_function_void_ll(j_calls->instance_ptr, 18, path_ref, duration_since_epoch_conv);
2661 }
2662 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2663         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2664         LDKPath path_var = *path;
2665         int64_t path_ref = 0;
2666         path_var = Path_clone(&path_var);
2667         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2668         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2669         int64_t short_channel_id_conv = short_channel_id;
2670         int64_t duration_since_epoch_conv = duration_since_epoch;
2671         js_invoke_function_void_lll(j_calls->instance_ptr, 19, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2672 }
2673 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2674         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2675         LDKPath path_var = *path;
2676         int64_t path_ref = 0;
2677         path_var = Path_clone(&path_var);
2678         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2679         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2680         int64_t duration_since_epoch_conv = duration_since_epoch;
2681         js_invoke_function_void_ll(j_calls->instance_ptr, 20, path_ref, duration_since_epoch_conv);
2682 }
2683 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
2684         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2685         int64_t duration_since_epoch_conv = duration_since_epoch;
2686         js_invoke_function_void_l(j_calls->instance_ptr, 21, duration_since_epoch_conv);
2687 }
2688 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
2689         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
2690         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2691 }
2692 static inline LDKScoreUpdate LDKScoreUpdate_init (int64_t o) {
2693         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
2694         atomic_init(&calls->refcnt, 1);
2695         calls->instance_ptr = o;
2696
2697         LDKScoreUpdate ret = {
2698                 .this_arg = (void*) calls,
2699                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
2700                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
2701                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
2702                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
2703                 .time_passed = time_passed_LDKScoreUpdate_jcall,
2704                 .free = LDKScoreUpdate_JCalls_free,
2705         };
2706         return ret;
2707 }
2708 uint64_t  CS_LDK_LDKScoreUpdate_new(int32_t o) {
2709         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
2710         *res_ptr = LDKScoreUpdate_init(o);
2711         return tag_ptr(res_ptr, true);
2712 }
2713 void  CS_LDK_ScoreUpdate_payment_path_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2714         void* this_arg_ptr = untag_ptr(this_arg);
2715         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2716         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2717         LDKPath path_conv;
2718         path_conv.inner = untag_ptr(path);
2719         path_conv.is_owned = ptr_is_owned(path);
2720         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2721         path_conv.is_owned = false;
2722         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2723 }
2724
2725 void  CS_LDK_ScoreUpdate_payment_path_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2726         void* this_arg_ptr = untag_ptr(this_arg);
2727         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2728         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2729         LDKPath path_conv;
2730         path_conv.inner = untag_ptr(path);
2731         path_conv.is_owned = ptr_is_owned(path);
2732         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2733         path_conv.is_owned = false;
2734         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
2735 }
2736
2737 void  CS_LDK_ScoreUpdate_probe_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2738         void* this_arg_ptr = untag_ptr(this_arg);
2739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2740         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2741         LDKPath path_conv;
2742         path_conv.inner = untag_ptr(path);
2743         path_conv.is_owned = ptr_is_owned(path);
2744         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2745         path_conv.is_owned = false;
2746         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2747 }
2748
2749 void  CS_LDK_ScoreUpdate_probe_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2750         void* this_arg_ptr = untag_ptr(this_arg);
2751         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2752         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2753         LDKPath path_conv;
2754         path_conv.inner = untag_ptr(path);
2755         path_conv.is_owned = ptr_is_owned(path);
2756         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2757         path_conv.is_owned = false;
2758         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
2759 }
2760
2761 void  CS_LDK_ScoreUpdate_time_passed(int64_t this_arg, int64_t duration_since_epoch) {
2762         void* this_arg_ptr = untag_ptr(this_arg);
2763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2764         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2765         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
2766 }
2767
2768 typedef struct LDKLockableScore_JCalls {
2769         atomic_size_t refcnt;
2770         uint32_t instance_ptr;
2771 } LDKLockableScore_JCalls;
2772 static void LDKLockableScore_JCalls_free(void* this_arg) {
2773         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2774         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2775                 FREE(j_calls);
2776         }
2777 }
2778 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
2779         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2780         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 22);
2781         void* ret_ptr = untag_ptr(ret);
2782         CHECK_ACCESS(ret_ptr);
2783         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
2784         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
2785                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2786                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
2787         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
2788         
2789         return ret_conv;
2790 }
2791 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
2792         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2793         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 23);
2794         void* ret_ptr = untag_ptr(ret);
2795         CHECK_ACCESS(ret_ptr);
2796         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
2797         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
2798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2799                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
2800         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
2801         
2802         return ret_conv;
2803 }
2804 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
2805         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
2806         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2807 }
2808 static inline LDKLockableScore LDKLockableScore_init (int64_t o) {
2809         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
2810         atomic_init(&calls->refcnt, 1);
2811         calls->instance_ptr = o;
2812
2813         LDKLockableScore ret = {
2814                 .this_arg = (void*) calls,
2815                 .read_lock = read_lock_LDKLockableScore_jcall,
2816                 .write_lock = write_lock_LDKLockableScore_jcall,
2817                 .free = LDKLockableScore_JCalls_free,
2818         };
2819         return ret;
2820 }
2821 uint64_t  CS_LDK_LDKLockableScore_new(int32_t o) {
2822         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
2823         *res_ptr = LDKLockableScore_init(o);
2824         return tag_ptr(res_ptr, true);
2825 }
2826 int64_t  CS_LDK_LockableScore_read_lock(int64_t this_arg) {
2827         void* this_arg_ptr = untag_ptr(this_arg);
2828         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2829         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
2830         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
2831         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
2832         return tag_ptr(ret_ret, true);
2833 }
2834
2835 int64_t  CS_LDK_LockableScore_write_lock(int64_t this_arg) {
2836         void* this_arg_ptr = untag_ptr(this_arg);
2837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2838         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
2839         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
2840         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
2841         return tag_ptr(ret_ret, true);
2842 }
2843
2844 typedef struct LDKWriteableScore_JCalls {
2845         atomic_size_t refcnt;
2846         uint32_t instance_ptr;
2847         LDKLockableScore_JCalls* LockableScore;
2848 } LDKWriteableScore_JCalls;
2849 static void LDKWriteableScore_JCalls_free(void* this_arg) {
2850         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2851         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2852                 FREE(j_calls);
2853         }
2854 }
2855 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
2856         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2857         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 24);
2858         LDKCVec_u8Z ret_ref;
2859         ret_ref.datalen = ret->arr_len;
2860         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2861         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2862         return ret_ref;
2863 }
2864 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
2865         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
2866         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2867         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
2868 }
2869 static inline LDKWriteableScore LDKWriteableScore_init (int64_t o, int64_t LockableScore) {
2870         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
2871         atomic_init(&calls->refcnt, 1);
2872         calls->instance_ptr = o;
2873
2874         LDKWriteableScore ret = {
2875                 .this_arg = (void*) calls,
2876                 .write = write_LDKWriteableScore_jcall,
2877                 .free = LDKWriteableScore_JCalls_free,
2878                 .LockableScore = LDKLockableScore_init(LockableScore),
2879         };
2880         calls->LockableScore = ret.LockableScore.this_arg;
2881         return ret;
2882 }
2883 uint64_t  CS_LDK_LDKWriteableScore_new(int32_t o, int32_t LockableScore) {
2884         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2885         *res_ptr = LDKWriteableScore_init(o, LockableScore);
2886         return tag_ptr(res_ptr, true);
2887 }
2888 int8_tArray  CS_LDK_WriteableScore_write(int64_t this_arg) {
2889         void* this_arg_ptr = untag_ptr(this_arg);
2890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2891         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
2892         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2893         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2894         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2895         CVec_u8Z_free(ret_var);
2896         return ret_arr;
2897 }
2898
2899 uint32_t CS_LDK_LDKCOption_WriteableScoreZ_ty_from_ptr(int64_t ptr) {
2900         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
2901         switch(obj->tag) {
2902                 case LDKCOption_WriteableScoreZ_Some: return 0;
2903                 case LDKCOption_WriteableScoreZ_None: return 1;
2904                 default: abort();
2905         }
2906 }
2907 int64_t CS_LDK_LDKCOption_WriteableScoreZ_Some_get_some(int64_t ptr) {
2908         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
2909         CHECK(obj->tag == LDKCOption_WriteableScoreZ_Some);
2910         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2911         *some_ret = obj->some;
2912                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
2913                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
2914                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2915                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
2916                         }
2917         return tag_ptr(some_ret, true);
2918 }
2919 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
2920 CHECK(owner->result_ok);
2921         return *owner->contents.result;
2922 }
2923 void  CS_LDK_CResult_NoneIOErrorZ_get_ok(int64_t owner) {
2924         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
2925         CResult_NoneIOErrorZ_get_ok(owner_conv);
2926 }
2927
2928 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
2929 CHECK(!owner->result_ok);
2930         return *owner->contents.err;
2931 }
2932 int32_t  CS_LDK_CResult_NoneIOErrorZ_get_err(int64_t owner) {
2933         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
2934         int32_t ret_conv = LDKIOError_to_cs(CResult_NoneIOErrorZ_get_err(owner_conv));
2935         return ret_conv;
2936 }
2937
2938 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2939         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2940         for (size_t i = 0; i < ret.datalen; i++) {
2941                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2942         }
2943         return ret;
2944 }
2945 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2946         LDKRoute ret = *owner->contents.result;
2947         ret.is_owned = false;
2948         return ret;
2949 }
2950 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_ok(int64_t owner) {
2951         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2952         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2953         int64_t ret_ref = 0;
2954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2956         return ret_ref;
2957 }
2958
2959 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2960         LDKLightningError ret = *owner->contents.err;
2961         ret.is_owned = false;
2962         return ret;
2963 }
2964 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_err(int64_t owner) {
2965         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2966         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2967         int64_t ret_ref = 0;
2968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2970         return ret_ref;
2971 }
2972
2973 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2974         LDKBlindedPayInfo ret = owner->a;
2975         ret.is_owned = false;
2976         return ret;
2977 }
2978 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(int64_t owner) {
2979         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2980         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2981         int64_t ret_ref = 0;
2982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2984         return ret_ref;
2985 }
2986
2987 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2988         LDKBlindedPath ret = owner->b;
2989         ret.is_owned = false;
2990         return ret;
2991 }
2992 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(int64_t owner) {
2993         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2994         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2995         int64_t ret_ref = 0;
2996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2998         return ret_ref;
2999 }
3000
3001 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
3002         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
3003         for (size_t i = 0; i < ret.datalen; i++) {
3004                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
3005         }
3006         return ret;
3007 }
3008 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3009 CHECK(owner->result_ok);
3010         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
3011 }
3012 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(int64_t owner) {
3013         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3014         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
3015         int64_tArray ret_arr = NULL;
3016         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3017         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3018         for (size_t l = 0; l < ret_var.datalen; l++) {
3019                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
3020                 *ret_conv_37_conv = ret_var.data[l];
3021                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
3022         }
3023         
3024         FREE(ret_var.data);
3025         return ret_arr;
3026 }
3027
3028 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3029 CHECK(!owner->result_ok);
3030         return *owner->contents.err;
3031 }
3032 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(int64_t owner) {
3033         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3034         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
3035 }
3036
3037 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3038         LDKOnionMessagePath ret = *owner->contents.result;
3039         ret.is_owned = false;
3040         return ret;
3041 }
3042 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_get_ok(int64_t owner) {
3043         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3044         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
3045         int64_t ret_ref = 0;
3046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3048         return ret_ref;
3049 }
3050
3051 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3052 CHECK(!owner->result_ok);
3053         return *owner->contents.err;
3054 }
3055 void  CS_LDK_CResult_OnionMessagePathNoneZ_get_err(int64_t owner) {
3056         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3057         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
3058 }
3059
3060 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3061 CHECK(owner->result_ok);
3062         return CVec_BlindedPathZ_clone(&*owner->contents.result);
3063 }
3064 int64_tArray  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_ok(int64_t owner) {
3065         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3066         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
3067         int64_tArray ret_arr = NULL;
3068         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3069         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3070         for (size_t n = 0; n < ret_var.datalen; n++) {
3071                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
3072                 int64_t ret_conv_13_ref = 0;
3073                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
3074                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
3075                 ret_arr_ptr[n] = ret_conv_13_ref;
3076         }
3077         
3078         FREE(ret_var.data);
3079         return ret_arr;
3080 }
3081
3082 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3083 CHECK(!owner->result_ok);
3084         return *owner->contents.err;
3085 }
3086 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_err(int64_t owner) {
3087         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3088         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
3089 }
3090
3091 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3092         LDKInFlightHtlcs ret = *owner->contents.result;
3093         ret.is_owned = false;
3094         return ret;
3095 }
3096 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_ok(int64_t owner) {
3097         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3098         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
3099         int64_t ret_ref = 0;
3100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3102         return ret_ref;
3103 }
3104
3105 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3106 CHECK(!owner->result_ok);
3107         return DecodeError_clone(&*owner->contents.err);
3108 }
3109 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_err(int64_t owner) {
3110         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3111         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3112         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
3113         int64_t ret_ref = tag_ptr(ret_copy, true);
3114         return ret_ref;
3115 }
3116
3117 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3118         LDKRouteHop ret = *owner->contents.result;
3119         ret.is_owned = false;
3120         return ret;
3121 }
3122 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_ok(int64_t owner) {
3123         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3124         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
3125         int64_t ret_ref = 0;
3126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3128         return ret_ref;
3129 }
3130
3131 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3132 CHECK(!owner->result_ok);
3133         return DecodeError_clone(&*owner->contents.err);
3134 }
3135 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_err(int64_t owner) {
3136         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3137         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3138         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
3139         int64_t ret_ref = tag_ptr(ret_copy, true);
3140         return ret_ref;
3141 }
3142
3143 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
3144         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
3145         for (size_t i = 0; i < ret.datalen; i++) {
3146                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
3147         }
3148         return ret;
3149 }
3150 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3151         LDKBlindedTail ret = *owner->contents.result;
3152         ret.is_owned = false;
3153         return ret;
3154 }
3155 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_ok(int64_t owner) {
3156         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3157         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
3158         int64_t ret_ref = 0;
3159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3161         return ret_ref;
3162 }
3163
3164 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3165 CHECK(!owner->result_ok);
3166         return DecodeError_clone(&*owner->contents.err);
3167 }
3168 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_err(int64_t owner) {
3169         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3171         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
3172         int64_t ret_ref = tag_ptr(ret_copy, true);
3173         return ret_ref;
3174 }
3175
3176 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3177         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3178         for (size_t i = 0; i < ret.datalen; i++) {
3179                 ret.data[i] = RouteHop_clone(&orig->data[i]);
3180         }
3181         return ret;
3182 }
3183 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
3184         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
3185         for (size_t i = 0; i < ret.datalen; i++) {
3186                 ret.data[i] = Path_clone(&orig->data[i]);
3187         }
3188         return ret;
3189 }
3190 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3191         LDKRoute ret = *owner->contents.result;
3192         ret.is_owned = false;
3193         return ret;
3194 }
3195 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_ok(int64_t owner) {
3196         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3197         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
3198         int64_t ret_ref = 0;
3199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3201         return ret_ref;
3202 }
3203
3204 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3205 CHECK(!owner->result_ok);
3206         return DecodeError_clone(&*owner->contents.err);
3207 }
3208 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_err(int64_t owner) {
3209         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3211         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
3212         int64_t ret_ref = tag_ptr(ret_copy, true);
3213         return ret_ref;
3214 }
3215
3216 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3217         LDKRouteParameters ret = *owner->contents.result;
3218         ret.is_owned = false;
3219         return ret;
3220 }
3221 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_ok(int64_t owner) {
3222         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3223         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
3224         int64_t ret_ref = 0;
3225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3227         return ret_ref;
3228 }
3229
3230 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3231 CHECK(!owner->result_ok);
3232         return DecodeError_clone(&*owner->contents.err);
3233 }
3234 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_err(int64_t owner) {
3235         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3237         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
3238         int64_t ret_ref = tag_ptr(ret_copy, true);
3239         return ret_ref;
3240 }
3241
3242 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3243         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3244         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3245         return ret;
3246 }
3247 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3248         LDKPaymentParameters ret = *owner->contents.result;
3249         ret.is_owned = false;
3250         return ret;
3251 }
3252 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_ok(int64_t owner) {
3253         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3254         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
3255         int64_t ret_ref = 0;
3256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3258         return ret_ref;
3259 }
3260
3261 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3262 CHECK(!owner->result_ok);
3263         return DecodeError_clone(&*owner->contents.err);
3264 }
3265 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_err(int64_t owner) {
3266         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3267         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3268         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
3269         int64_t ret_ref = tag_ptr(ret_copy, true);
3270         return ret_ref;
3271 }
3272
3273 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3274         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3275         for (size_t i = 0; i < ret.datalen; i++) {
3276                 ret.data[i] = RouteHint_clone(&orig->data[i]);
3277         }
3278         return ret;
3279 }
3280 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
3281         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
3282         for (size_t i = 0; i < ret.datalen; i++) {
3283                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
3284         }
3285         return ret;
3286 }
3287 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3288         LDKRouteHint ret = *owner->contents.result;
3289         ret.is_owned = false;
3290         return ret;
3291 }
3292 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_ok(int64_t owner) {
3293         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3294         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
3295         int64_t ret_ref = 0;
3296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3298         return ret_ref;
3299 }
3300
3301 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3302 CHECK(!owner->result_ok);
3303         return DecodeError_clone(&*owner->contents.err);
3304 }
3305 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_err(int64_t owner) {
3306         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3308         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
3309         int64_t ret_ref = tag_ptr(ret_copy, true);
3310         return ret_ref;
3311 }
3312
3313 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3314         LDKRouteHintHop ret = *owner->contents.result;
3315         ret.is_owned = false;
3316         return ret;
3317 }
3318 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_ok(int64_t owner) {
3319         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3320         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
3321         int64_t ret_ref = 0;
3322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3324         return ret_ref;
3325 }
3326
3327 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3328 CHECK(!owner->result_ok);
3329         return DecodeError_clone(&*owner->contents.err);
3330 }
3331 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_err(int64_t owner) {
3332         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3333         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3334         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
3335         int64_t ret_ref = tag_ptr(ret_copy, true);
3336         return ret_ref;
3337 }
3338
3339 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3340         LDKFixedPenaltyScorer ret = *owner->contents.result;
3341         ret.is_owned = false;
3342         return ret;
3343 }
3344 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(int64_t owner) {
3345         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3346         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3347         int64_t ret_ref = 0;
3348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3350         return ret_ref;
3351 }
3352
3353 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3354 CHECK(!owner->result_ok);
3355         return DecodeError_clone(&*owner->contents.err);
3356 }
3357 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(int64_t owner) {
3358         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3359         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3360         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3361         int64_t ret_ref = tag_ptr(ret_copy, true);
3362         return ret_ref;
3363 }
3364
3365 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3366         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3367         for (size_t i = 0; i < ret.datalen; i++) {
3368                 ret.data[i] = NodeId_clone(&orig->data[i]);
3369         }
3370         return ret;
3371 }
3372 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3373         return owner->a;
3374 }
3375 int64_t  CS_LDK_C2Tuple_u64u64Z_get_a(int64_t owner) {
3376         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3377         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3378         return ret_conv;
3379 }
3380
3381 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3382         return owner->b;
3383 }
3384 int64_t  CS_LDK_C2Tuple_u64u64Z_get_b(int64_t owner) {
3385         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3386         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3387         return ret_conv;
3388 }
3389
3390 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(int64_t ptr) {
3391         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3392         switch(obj->tag) {
3393                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
3394                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
3395                 default: abort();
3396         }
3397 }
3398 int64_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(int64_t ptr) {
3399         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3400         CHECK(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
3401         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3402         *some_conv = obj->some;
3403                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3404         return tag_ptr(some_conv, true);
3405 }
3406 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
3407         return owner->a;
3408 }
3409 int16_tArray  CS_LDK_C2Tuple_Z_get_a(int64_t owner) {
3410         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3411         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3412         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
3413         return ret_arr;
3414 }
3415
3416 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
3417         return owner->b;
3418 }
3419 int16_tArray  CS_LDK_C2Tuple_Z_get_b(int64_t owner) {
3420         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3421         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3422         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
3423         return ret_arr;
3424 }
3425
3426 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3427         return owner->a;
3428 }
3429 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_a(int64_t owner) {
3430         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3431         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3432         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
3433         return ret_arr;
3434 }
3435
3436 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3437         return owner->b;
3438 }
3439 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_b(int64_t owner) {
3440         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3441         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3442         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
3443         return ret_arr;
3444 }
3445
3446 uint32_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(int64_t ptr) {
3447         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3448         switch(obj->tag) {
3449                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
3450                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
3451                 default: abort();
3452         }
3453 }
3454 int64_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(int64_t ptr) {
3455         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3456         CHECK(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
3457         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
3458                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
3459         return tag_ptr(some_conv, false);
3460 }
3461 uint32_t CS_LDK_LDKCOption_f64Z_ty_from_ptr(int64_t ptr) {
3462         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3463         switch(obj->tag) {
3464                 case LDKCOption_f64Z_Some: return 0;
3465                 case LDKCOption_f64Z_None: return 1;
3466                 default: abort();
3467         }
3468 }
3469 double CS_LDK_LDKCOption_f64Z_Some_get_some(int64_t ptr) {
3470         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3471         CHECK(obj->tag == LDKCOption_f64Z_Some);
3472         double some_conv = obj->some;
3473         return some_conv;
3474 }
3475 typedef struct LDKLogger_JCalls {
3476         atomic_size_t refcnt;
3477         uint32_t instance_ptr;
3478 } LDKLogger_JCalls;
3479 static void LDKLogger_JCalls_free(void* this_arg) {
3480         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3481         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3482                 FREE(j_calls);
3483         }
3484 }
3485 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
3486         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3487         LDKRecord record_var = record;
3488         int64_t record_ref = 0;
3489         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3490         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3491         js_invoke_function_void_l(j_calls->instance_ptr, 25, record_ref);
3492 }
3493 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3494         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3495         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3496 }
3497 static inline LDKLogger LDKLogger_init (int64_t o) {
3498         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3499         atomic_init(&calls->refcnt, 1);
3500         calls->instance_ptr = o;
3501
3502         LDKLogger ret = {
3503                 .this_arg = (void*) calls,
3504                 .log = log_LDKLogger_jcall,
3505                 .free = LDKLogger_JCalls_free,
3506         };
3507         return ret;
3508 }
3509 uint64_t  CS_LDK_LDKLogger_new(int32_t o) {
3510         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3511         *res_ptr = LDKLogger_init(o);
3512         return tag_ptr(res_ptr, true);
3513 }
3514 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3515         LDKProbabilisticScorer ret = *owner->contents.result;
3516         ret.is_owned = false;
3517         return ret;
3518 }
3519 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(int64_t owner) {
3520         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3521         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3522         int64_t ret_ref = 0;
3523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3525         return ret_ref;
3526 }
3527
3528 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3529 CHECK(!owner->result_ok);
3530         return DecodeError_clone(&*owner->contents.err);
3531 }
3532 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_err(int64_t owner) {
3533         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3534         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3535         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3536         int64_t ret_ref = tag_ptr(ret_copy, true);
3537         return ret_ref;
3538 }
3539
3540 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3541         return owner->a;
3542 }
3543 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_get_a(int64_t owner) {
3544         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3545         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3546         return ret_conv;
3547 }
3548
3549 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3550         return owner->b;
3551 }
3552 int8_tArray  CS_LDK_C2Tuple_usizeTransactionZ_get_b(int64_t owner) {
3553         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3554         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3555         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3556         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3557         return ret_arr;
3558 }
3559
3560 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3561         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3562         for (size_t i = 0; i < ret.datalen; i++) {
3563                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3564         }
3565         return ret;
3566 }
3567 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3568         return ThirtyTwoBytes_clone(&owner->a);
3569 }
3570 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(int64_t owner) {
3571         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3572         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3573         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
3574         return ret_arr;
3575 }
3576
3577 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3578         return owner->b;
3579 }
3580 int32_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(int64_t owner) {
3581         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3582         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
3583         return ret_conv;
3584 }
3585
3586 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3587         return COption_ThirtyTwoBytesZ_clone(&owner->c);
3588 }
3589 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(int64_t owner) {
3590         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3591         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
3592         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
3593         int64_t ret_ref = tag_ptr(ret_copy, true);
3594         return ret_ref;
3595 }
3596
3597 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
3598         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
3599         for (size_t i = 0; i < ret.datalen; i++) {
3600                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
3601         }
3602         return ret;
3603 }
3604 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3605 CHECK(owner->result_ok);
3606         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
3607 }
3608 int32_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(int64_t owner) {
3609         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3610         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
3611         return ret_conv;
3612 }
3613
3614 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3615 CHECK(!owner->result_ok);
3616         return *owner->contents.err;
3617 }
3618 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(int64_t owner) {
3619         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3620         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
3621 }
3622
3623 uint32_t CS_LDK_LDKMonitorEvent_ty_from_ptr(int64_t ptr) {
3624         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3625         switch(obj->tag) {
3626                 case LDKMonitorEvent_HTLCEvent: return 0;
3627                 case LDKMonitorEvent_HolderForceClosed: return 1;
3628                 case LDKMonitorEvent_Completed: return 2;
3629                 default: abort();
3630         }
3631 }
3632 int64_t CS_LDK_LDKMonitorEvent_HTLCEvent_get_htlc_event(int64_t ptr) {
3633         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3634         CHECK(obj->tag == LDKMonitorEvent_HTLCEvent);
3635         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3636                         int64_t htlc_event_ref = 0;
3637                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3638                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3639         return htlc_event_ref;
3640 }
3641 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(int64_t ptr) {
3642         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3643         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosed);
3644         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3645                         int64_t holder_force_closed_ref = 0;
3646                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3647                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3648         return holder_force_closed_ref;
3649 }
3650 int64_t CS_LDK_LDKMonitorEvent_Completed_get_funding_txo(int64_t ptr) {
3651         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3652         CHECK(obj->tag == LDKMonitorEvent_Completed);
3653         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3654                         int64_t funding_txo_ref = 0;
3655                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3656                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3657         return funding_txo_ref;
3658 }
3659 int64_t CS_LDK_LDKMonitorEvent_Completed_get_monitor_update_id(int64_t ptr) {
3660         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3661         CHECK(obj->tag == LDKMonitorEvent_Completed);
3662         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3663         return monitor_update_id_conv;
3664 }
3665 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3666         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3667         for (size_t i = 0; i < ret.datalen; i++) {
3668                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3669         }
3670         return ret;
3671 }
3672 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3673         LDKOutPoint ret = owner->a;
3674         ret.is_owned = false;
3675         return ret;
3676 }
3677 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(int64_t owner) {
3678         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3679         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3680         int64_t ret_ref = 0;
3681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3683         return ret_ref;
3684 }
3685
3686 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3687         return CVec_MonitorEventZ_clone(&owner->b);
3688 }
3689 int64_tArray  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(int64_t owner) {
3690         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3691         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3692         int64_tArray ret_arr = NULL;
3693         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3694         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3695         for (size_t o = 0; o < ret_var.datalen; o++) {
3696                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3697                 *ret_conv_14_copy = ret_var.data[o];
3698                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3699                 ret_arr_ptr[o] = ret_conv_14_ref;
3700         }
3701         
3702         FREE(ret_var.data);
3703         return ret_arr;
3704 }
3705
3706 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3707         return owner->c;
3708 }
3709 int8_tArray  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(int64_t owner) {
3710         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3711         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3712         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3713         return ret_arr;
3714 }
3715
3716 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3717         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3718         for (size_t i = 0; i < ret.datalen; i++) {
3719                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3720         }
3721         return ret;
3722 }
3723 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3724         LDKInitFeatures ret = *owner->contents.result;
3725         ret.is_owned = false;
3726         return ret;
3727 }
3728 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3729         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3730         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3731         int64_t ret_ref = 0;
3732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3734         return ret_ref;
3735 }
3736
3737 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3738 CHECK(!owner->result_ok);
3739         return DecodeError_clone(&*owner->contents.err);
3740 }
3741 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_err(int64_t owner) {
3742         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3743         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3744         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3745         int64_t ret_ref = tag_ptr(ret_copy, true);
3746         return ret_ref;
3747 }
3748
3749 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3750         LDKChannelFeatures ret = *owner->contents.result;
3751         ret.is_owned = false;
3752         return ret;
3753 }
3754 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3755         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3756         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3757         int64_t ret_ref = 0;
3758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3760         return ret_ref;
3761 }
3762
3763 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3764 CHECK(!owner->result_ok);
3765         return DecodeError_clone(&*owner->contents.err);
3766 }
3767 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_err(int64_t owner) {
3768         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3769         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3770         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3771         int64_t ret_ref = tag_ptr(ret_copy, true);
3772         return ret_ref;
3773 }
3774
3775 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3776         LDKNodeFeatures ret = *owner->contents.result;
3777         ret.is_owned = false;
3778         return ret;
3779 }
3780 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3781         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3782         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3783         int64_t ret_ref = 0;
3784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3786         return ret_ref;
3787 }
3788
3789 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3790 CHECK(!owner->result_ok);
3791         return DecodeError_clone(&*owner->contents.err);
3792 }
3793 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_err(int64_t owner) {
3794         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3795         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3796         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3797         int64_t ret_ref = tag_ptr(ret_copy, true);
3798         return ret_ref;
3799 }
3800
3801 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3802         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3803         ret.is_owned = false;
3804         return ret;
3805 }
3806 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3807         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3808         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3809         int64_t ret_ref = 0;
3810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3812         return ret_ref;
3813 }
3814
3815 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3816 CHECK(!owner->result_ok);
3817         return DecodeError_clone(&*owner->contents.err);
3818 }
3819 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
3820         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3821         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3822         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3823         int64_t ret_ref = tag_ptr(ret_copy, true);
3824         return ret_ref;
3825 }
3826
3827 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3828         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3829         ret.is_owned = false;
3830         return ret;
3831 }
3832 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3833         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3834         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3835         int64_t ret_ref = 0;
3836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3838         return ret_ref;
3839 }
3840
3841 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3842 CHECK(!owner->result_ok);
3843         return DecodeError_clone(&*owner->contents.err);
3844 }
3845 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
3846         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3847         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3848         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3849         int64_t ret_ref = tag_ptr(ret_copy, true);
3850         return ret_ref;
3851 }
3852
3853 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3854         LDKBlindedHopFeatures ret = *owner->contents.result;
3855         ret.is_owned = false;
3856         return ret;
3857 }
3858 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3859         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3860         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3861         int64_t ret_ref = 0;
3862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3864         return ret_ref;
3865 }
3866
3867 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3868 CHECK(!owner->result_ok);
3869         return DecodeError_clone(&*owner->contents.err);
3870 }
3871 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(int64_t owner) {
3872         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3873         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3874         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3875         int64_t ret_ref = tag_ptr(ret_copy, true);
3876         return ret_ref;
3877 }
3878
3879 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3880         LDKChannelTypeFeatures ret = *owner->contents.result;
3881         ret.is_owned = false;
3882         return ret;
3883 }
3884 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3885         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3886         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3887         int64_t ret_ref = 0;
3888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3890         return ret_ref;
3891 }
3892
3893 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3894 CHECK(!owner->result_ok);
3895         return DecodeError_clone(&*owner->contents.err);
3896 }
3897 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(int64_t owner) {
3898         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3899         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3900         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3901         int64_t ret_ref = tag_ptr(ret_copy, true);
3902         return ret_ref;
3903 }
3904
3905 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3906         LDKOffer ret = *owner->contents.result;
3907         ret.is_owned = false;
3908         return ret;
3909 }
3910 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_ok(int64_t owner) {
3911         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3912         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3913         int64_t ret_ref = 0;
3914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3916         return ret_ref;
3917 }
3918
3919 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3920         LDKBolt12ParseError ret = *owner->contents.err;
3921         ret.is_owned = false;
3922         return ret;
3923 }
3924 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_err(int64_t owner) {
3925         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3926         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3927         int64_t ret_ref = 0;
3928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3930         return ret_ref;
3931 }
3932
3933 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3934 CHECK(owner->result_ok);
3935         return *owner->contents.result;
3936 }
3937 int8_tArray  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_ok(int64_t owner) {
3938         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3939         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3940         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3941         return ret_arr;
3942 }
3943
3944 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3945 CHECK(!owner->result_ok);
3946         return *owner->contents.err;
3947 }
3948 int32_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_err(int64_t owner) {
3949         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3950         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3951         return ret_conv;
3952 }
3953
3954 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3955         LDKNodeId ret = *owner->contents.result;
3956         ret.is_owned = false;
3957         return ret;
3958 }
3959 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_ok(int64_t owner) {
3960         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3961         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3962         int64_t ret_ref = 0;
3963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3965         return ret_ref;
3966 }
3967
3968 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3969 CHECK(!owner->result_ok);
3970         return DecodeError_clone(&*owner->contents.err);
3971 }
3972 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_err(int64_t owner) {
3973         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3974         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3975         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3976         int64_t ret_ref = tag_ptr(ret_copy, true);
3977         return ret_ref;
3978 }
3979
3980 uint32_t CS_LDK_LDKNetworkUpdate_ty_from_ptr(int64_t ptr) {
3981         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3982         switch(obj->tag) {
3983                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3984                 case LDKNetworkUpdate_ChannelFailure: return 1;
3985                 case LDKNetworkUpdate_NodeFailure: return 2;
3986                 default: abort();
3987         }
3988 }
3989 int64_t CS_LDK_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(int64_t ptr) {
3990         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3991         CHECK(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3992         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3993                         int64_t msg_ref = 0;
3994                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3995                         msg_ref = tag_ptr(msg_var.inner, false);
3996         return msg_ref;
3997 }
3998 int64_t CS_LDK_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(int64_t ptr) {
3999         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4000         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
4001         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
4002         return short_channel_id_conv;
4003 }
4004 jboolean CS_LDK_LDKNetworkUpdate_ChannelFailure_get_is_permanent(int64_t ptr) {
4005         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4006         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
4007         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
4008         return is_permanent_conv;
4009 }
4010 int8_tArray CS_LDK_LDKNetworkUpdate_NodeFailure_get_node_id(int64_t ptr) {
4011         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4012         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4013         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4014         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
4015         return node_id_arr;
4016 }
4017 jboolean CS_LDK_LDKNetworkUpdate_NodeFailure_get_is_permanent(int64_t ptr) {
4018         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4019         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4020         jboolean is_permanent_conv = obj->node_failure.is_permanent;
4021         return is_permanent_conv;
4022 }
4023 uint32_t CS_LDK_LDKCOption_NetworkUpdateZ_ty_from_ptr(int64_t ptr) {
4024         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4025         switch(obj->tag) {
4026                 case LDKCOption_NetworkUpdateZ_Some: return 0;
4027                 case LDKCOption_NetworkUpdateZ_None: return 1;
4028                 default: abort();
4029         }
4030 }
4031 int64_t CS_LDK_LDKCOption_NetworkUpdateZ_Some_get_some(int64_t ptr) {
4032         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4033         CHECK(obj->tag == LDKCOption_NetworkUpdateZ_Some);
4034         int64_t some_ref = tag_ptr(&obj->some, false);
4035         return some_ref;
4036 }
4037 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4038 CHECK(owner->result_ok);
4039         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
4040 }
4041 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(int64_t owner) {
4042         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4043         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
4044         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
4045         int64_t ret_ref = tag_ptr(ret_copy, true);
4046         return ret_ref;
4047 }
4048
4049 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4050 CHECK(!owner->result_ok);
4051         return DecodeError_clone(&*owner->contents.err);
4052 }
4053 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(int64_t owner) {
4054         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4055         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4056         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
4057         int64_t ret_ref = tag_ptr(ret_copy, true);
4058         return ret_ref;
4059 }
4060
4061 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4062 CHECK(owner->result_ok);
4063         return TxOut_clone(&*owner->contents.result);
4064 }
4065 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_ok(int64_t owner) {
4066         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4067         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
4068         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
4069         return tag_ptr(ret_ref, true);
4070 }
4071
4072 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4073 CHECK(!owner->result_ok);
4074         return UtxoLookupError_clone(&*owner->contents.err);
4075 }
4076 int32_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_err(int64_t owner) {
4077         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4078         int32_t ret_conv = LDKUtxoLookupError_to_cs(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
4079         return ret_conv;
4080 }
4081
4082 uint32_t CS_LDK_LDKUtxoResult_ty_from_ptr(int64_t ptr) {
4083         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4084         switch(obj->tag) {
4085                 case LDKUtxoResult_Sync: return 0;
4086                 case LDKUtxoResult_Async: return 1;
4087                 default: abort();
4088         }
4089 }
4090 int64_t CS_LDK_LDKUtxoResult_Sync_get_sync(int64_t ptr) {
4091         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4092         CHECK(obj->tag == LDKUtxoResult_Sync);
4093         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
4094         *sync_conv = obj->sync;
4095                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
4096         return tag_ptr(sync_conv, true);
4097 }
4098 int64_t CS_LDK_LDKUtxoResult_Async_get_async(int64_t ptr) {
4099         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4100         CHECK(obj->tag == LDKUtxoResult_Async);
4101         LDKUtxoFuture async_var = obj->async;
4102                         int64_t async_ref = 0;
4103                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
4104                         async_ref = tag_ptr(async_var.inner, false);
4105         return async_ref;
4106 }
4107 typedef struct LDKUtxoLookup_JCalls {
4108         atomic_size_t refcnt;
4109         uint32_t instance_ptr;
4110 } LDKUtxoLookup_JCalls;
4111 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
4112         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4113         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4114                 FREE(j_calls);
4115         }
4116 }
4117 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
4118         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4119         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
4120         memcpy(chain_hash_arr->elems, *chain_hash, 32);
4121         int64_t short_channel_id_conv = short_channel_id;
4122         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 26, (int64_t)chain_hash_arr, short_channel_id_conv);
4123         void* ret_ptr = untag_ptr(ret);
4124         CHECK_ACCESS(ret_ptr);
4125         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
4126         FREE(untag_ptr(ret));
4127         return ret_conv;
4128 }
4129 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
4130         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
4131         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4132 }
4133 static inline LDKUtxoLookup LDKUtxoLookup_init (int64_t o) {
4134         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
4135         atomic_init(&calls->refcnt, 1);
4136         calls->instance_ptr = o;
4137
4138         LDKUtxoLookup ret = {
4139                 .this_arg = (void*) calls,
4140                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
4141                 .free = LDKUtxoLookup_JCalls_free,
4142         };
4143         return ret;
4144 }
4145 uint64_t  CS_LDK_LDKUtxoLookup_new(int32_t o) {
4146         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4147         *res_ptr = LDKUtxoLookup_init(o);
4148         return tag_ptr(res_ptr, true);
4149 }
4150 int64_t  CS_LDK_UtxoLookup_get_utxo(int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
4151         void* this_arg_ptr = untag_ptr(this_arg);
4152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4153         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
4154         uint8_t chain_hash_arr[32];
4155         CHECK(chain_hash->arr_len == 32);
4156         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
4157         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
4158         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
4159         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
4160         int64_t ret_ref = tag_ptr(ret_copy, true);
4161         return ret_ref;
4162 }
4163
4164 uint32_t CS_LDK_LDKCOption_UtxoLookupZ_ty_from_ptr(int64_t ptr) {
4165         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4166         switch(obj->tag) {
4167                 case LDKCOption_UtxoLookupZ_Some: return 0;
4168                 case LDKCOption_UtxoLookupZ_None: return 1;
4169                 default: abort();
4170         }
4171 }
4172 int64_t CS_LDK_LDKCOption_UtxoLookupZ_Some_get_some(int64_t ptr) {
4173         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4174         CHECK(obj->tag == LDKCOption_UtxoLookupZ_Some);
4175         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4176         *some_ret = obj->some;
4177                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4178                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
4179                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4180                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
4181                         }
4182         return tag_ptr(some_ret, true);
4183 }
4184 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4185 CHECK(owner->result_ok);
4186         return *owner->contents.result;
4187 }
4188 void  CS_LDK_CResult_NoneLightningErrorZ_get_ok(int64_t owner) {
4189         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4190         CResult_NoneLightningErrorZ_get_ok(owner_conv);
4191 }
4192
4193 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4194         LDKLightningError ret = *owner->contents.err;
4195         ret.is_owned = false;
4196         return ret;
4197 }
4198 int64_t  CS_LDK_CResult_NoneLightningErrorZ_get_err(int64_t owner) {
4199         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4200         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4201         int64_t ret_ref = 0;
4202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4204         return ret_ref;
4205 }
4206
4207 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4208 CHECK(owner->result_ok);
4209         return *owner->contents.result;
4210 }
4211 jboolean  CS_LDK_CResult_boolLightningErrorZ_get_ok(int64_t owner) {
4212         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4213         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4214         return ret_conv;
4215 }
4216
4217 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4218         LDKLightningError ret = *owner->contents.err;
4219         ret.is_owned = false;
4220         return ret;
4221 }
4222 int64_t  CS_LDK_CResult_boolLightningErrorZ_get_err(int64_t owner) {
4223         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4224         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4225         int64_t ret_ref = 0;
4226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4228         return ret_ref;
4229 }
4230
4231 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4232         LDKChannelAnnouncement ret = owner->a;
4233         ret.is_owned = false;
4234         return ret;
4235 }
4236 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(int64_t owner) {
4237         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4238         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4239         int64_t ret_ref = 0;
4240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4242         return ret_ref;
4243 }
4244
4245 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4246         LDKChannelUpdate ret = owner->b;
4247         ret.is_owned = false;
4248         return ret;
4249 }
4250 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(int64_t owner) {
4251         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4252         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4253         int64_t ret_ref = 0;
4254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4256         return ret_ref;
4257 }
4258
4259 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4260         LDKChannelUpdate ret = owner->c;
4261         ret.is_owned = false;
4262         return ret;
4263 }
4264 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(int64_t owner) {
4265         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4266         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4267         int64_t ret_ref = 0;
4268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4270         return ret_ref;
4271 }
4272
4273 uint32_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(int64_t ptr) {
4274         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4275         switch(obj->tag) {
4276                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
4277                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
4278                 default: abort();
4279         }
4280 }
4281 int64_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(int64_t ptr) {
4282         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4283         CHECK(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
4284         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4285         *some_conv = obj->some;
4286                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4287         return tag_ptr(some_conv, true);
4288 }
4289 uint32_t CS_LDK_LDKErrorAction_ty_from_ptr(int64_t ptr) {
4290         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4291         switch(obj->tag) {
4292                 case LDKErrorAction_DisconnectPeer: return 0;
4293                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4294                 case LDKErrorAction_IgnoreError: return 2;
4295                 case LDKErrorAction_IgnoreAndLog: return 3;
4296                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4297                 case LDKErrorAction_SendErrorMessage: return 5;
4298                 case LDKErrorAction_SendWarningMessage: return 6;
4299                 default: abort();
4300         }
4301 }
4302 int64_t CS_LDK_LDKErrorAction_DisconnectPeer_get_msg(int64_t ptr) {
4303         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4304         CHECK(obj->tag == LDKErrorAction_DisconnectPeer);
4305         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4306                         int64_t msg_ref = 0;
4307                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4308                         msg_ref = tag_ptr(msg_var.inner, false);
4309         return msg_ref;
4310 }
4311 int64_t CS_LDK_LDKErrorAction_DisconnectPeerWithWarning_get_msg(int64_t ptr) {
4312         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4313         CHECK(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4314         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4315                         int64_t msg_ref = 0;
4316                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4317                         msg_ref = tag_ptr(msg_var.inner, false);
4318         return msg_ref;
4319 }
4320 int32_t CS_LDK_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(int64_t ptr) {
4321         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4322         CHECK(obj->tag == LDKErrorAction_IgnoreAndLog);
4323         int32_t ignore_and_log_conv = LDKLevel_to_cs(obj->ignore_and_log);
4324         return ignore_and_log_conv;
4325 }
4326 int64_t CS_LDK_LDKErrorAction_SendErrorMessage_get_msg(int64_t ptr) {
4327         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4328         CHECK(obj->tag == LDKErrorAction_SendErrorMessage);
4329         LDKErrorMessage msg_var = obj->send_error_message.msg;
4330                         int64_t msg_ref = 0;
4331                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4332                         msg_ref = tag_ptr(msg_var.inner, false);
4333         return msg_ref;
4334 }
4335 int64_t CS_LDK_LDKErrorAction_SendWarningMessage_get_msg(int64_t ptr) {
4336         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4337         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4338         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4339                         int64_t msg_ref = 0;
4340                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4341                         msg_ref = tag_ptr(msg_var.inner, false);
4342         return msg_ref;
4343 }
4344 int32_t CS_LDK_LDKErrorAction_SendWarningMessage_get_log_level(int64_t ptr) {
4345         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4346         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4347         int32_t log_level_conv = LDKLevel_to_cs(obj->send_warning_message.log_level);
4348         return log_level_conv;
4349 }
4350 uint32_t CS_LDK_LDKMessageSendEvent_ty_from_ptr(int64_t ptr) {
4351         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4352         switch(obj->tag) {
4353                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4354                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4355                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4356                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4357                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4358                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4359                 case LDKMessageSendEvent_SendStfu: return 6;
4360                 case LDKMessageSendEvent_SendSplice: return 7;
4361                 case LDKMessageSendEvent_SendSpliceAck: return 8;
4362                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
4363                 case LDKMessageSendEvent_SendTxAddInput: return 10;
4364                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
4365                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
4366                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
4367                 case LDKMessageSendEvent_SendTxComplete: return 14;
4368                 case LDKMessageSendEvent_SendTxSignatures: return 15;
4369                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
4370                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
4371                 case LDKMessageSendEvent_SendTxAbort: return 18;
4372                 case LDKMessageSendEvent_SendChannelReady: return 19;
4373                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
4374                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
4375                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
4376                 case LDKMessageSendEvent_SendClosingSigned: return 23;
4377                 case LDKMessageSendEvent_SendShutdown: return 24;
4378                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
4379                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
4380                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
4381                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
4382                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
4383                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
4384                 case LDKMessageSendEvent_HandleError: return 31;
4385                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
4386                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
4387                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
4388                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
4389                 default: abort();
4390         }
4391 }
4392 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_node_id(int64_t ptr) {
4393         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4394         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4395         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4396         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4397         return node_id_arr;
4398 }
4399 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_msg(int64_t ptr) {
4400         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4401         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4402         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4403                         int64_t msg_ref = 0;
4404                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4405                         msg_ref = tag_ptr(msg_var.inner, false);
4406         return msg_ref;
4407 }
4408 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(int64_t ptr) {
4409         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4410         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4411         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4412         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4413         return node_id_arr;
4414 }
4415 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(int64_t ptr) {
4416         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4417         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4418         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4419                         int64_t msg_ref = 0;
4420                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4421                         msg_ref = tag_ptr(msg_var.inner, false);
4422         return msg_ref;
4423 }
4424 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_node_id(int64_t ptr) {
4425         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4426         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4427         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4428         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4429         return node_id_arr;
4430 }
4431 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_msg(int64_t ptr) {
4432         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4433         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4434         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4435                         int64_t msg_ref = 0;
4436                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4437                         msg_ref = tag_ptr(msg_var.inner, false);
4438         return msg_ref;
4439 }
4440 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(int64_t ptr) {
4441         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4442         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4443         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4444         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4445         return node_id_arr;
4446 }
4447 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_msg(int64_t ptr) {
4448         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4449         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4450         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4451                         int64_t msg_ref = 0;
4452                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4453                         msg_ref = tag_ptr(msg_var.inner, false);
4454         return msg_ref;
4455 }
4456 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_node_id(int64_t ptr) {
4457         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4458         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4459         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4460         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4461         return node_id_arr;
4462 }
4463 int64_t CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_msg(int64_t ptr) {
4464         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4465         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4466         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4467                         int64_t msg_ref = 0;
4468                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4469                         msg_ref = tag_ptr(msg_var.inner, false);
4470         return msg_ref;
4471 }
4472 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_node_id(int64_t ptr) {
4473         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4474         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4475         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4476         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4477         return node_id_arr;
4478 }
4479 int64_t CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_msg(int64_t ptr) {
4480         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4481         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4482         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4483                         int64_t msg_ref = 0;
4484                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4485                         msg_ref = tag_ptr(msg_var.inner, false);
4486         return msg_ref;
4487 }
4488 int8_tArray CS_LDK_LDKMessageSendEvent_SendStfu_get_node_id(int64_t ptr) {
4489         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4490         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4491         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4492         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
4493         return node_id_arr;
4494 }
4495 int64_t CS_LDK_LDKMessageSendEvent_SendStfu_get_msg(int64_t ptr) {
4496         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4497         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4498         LDKStfu msg_var = obj->send_stfu.msg;
4499                         int64_t msg_ref = 0;
4500                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4501                         msg_ref = tag_ptr(msg_var.inner, false);
4502         return msg_ref;
4503 }
4504 int8_tArray CS_LDK_LDKMessageSendEvent_SendSplice_get_node_id(int64_t ptr) {
4505         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4506         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4507         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4508         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
4509         return node_id_arr;
4510 }
4511 int64_t CS_LDK_LDKMessageSendEvent_SendSplice_get_msg(int64_t ptr) {
4512         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4513         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4514         LDKSplice msg_var = obj->send_splice.msg;
4515                         int64_t msg_ref = 0;
4516                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4517                         msg_ref = tag_ptr(msg_var.inner, false);
4518         return msg_ref;
4519 }
4520 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_node_id(int64_t ptr) {
4521         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4522         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4523         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4524         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
4525         return node_id_arr;
4526 }
4527 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_msg(int64_t ptr) {
4528         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4529         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4530         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
4531                         int64_t msg_ref = 0;
4532                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4533                         msg_ref = tag_ptr(msg_var.inner, false);
4534         return msg_ref;
4535 }
4536 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_node_id(int64_t ptr) {
4537         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4538         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4539         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4540         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
4541         return node_id_arr;
4542 }
4543 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_msg(int64_t ptr) {
4544         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4545         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4546         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
4547                         int64_t msg_ref = 0;
4548                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4549                         msg_ref = tag_ptr(msg_var.inner, false);
4550         return msg_ref;
4551 }
4552 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_node_id(int64_t ptr) {
4553         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4554         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4555         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4556         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4557         return node_id_arr;
4558 }
4559 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_msg(int64_t ptr) {
4560         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4561         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4562         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4563                         int64_t msg_ref = 0;
4564                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4565                         msg_ref = tag_ptr(msg_var.inner, false);
4566         return msg_ref;
4567 }
4568 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_node_id(int64_t ptr) {
4569         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4570         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4571         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4572         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
4573         return node_id_arr;
4574 }
4575 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_msg(int64_t ptr) {
4576         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4577         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4578         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
4579                         int64_t msg_ref = 0;
4580                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4581                         msg_ref = tag_ptr(msg_var.inner, false);
4582         return msg_ref;
4583 }
4584 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(int64_t ptr) {
4585         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4586         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4587         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4588         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
4589         return node_id_arr;
4590 }
4591 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_msg(int64_t ptr) {
4592         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4593         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4594         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
4595                         int64_t msg_ref = 0;
4596                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4597                         msg_ref = tag_ptr(msg_var.inner, false);
4598         return msg_ref;
4599 }
4600 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(int64_t ptr) {
4601         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4602         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4603         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4604         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
4605         return node_id_arr;
4606 }
4607 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(int64_t ptr) {
4608         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4609         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4610         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
4611                         int64_t msg_ref = 0;
4612                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4613                         msg_ref = tag_ptr(msg_var.inner, false);
4614         return msg_ref;
4615 }
4616 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxComplete_get_node_id(int64_t ptr) {
4617         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4618         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
4619         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4620         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
4621         return node_id_arr;
4622 }
4623 int64_t CS_LDK_LDKMessageSendEvent_SendTxComplete_get_msg(int64_t ptr) {
4624         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4625         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
4626         LDKTxComplete msg_var = obj->send_tx_complete.msg;
4627                         int64_t msg_ref = 0;
4628                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4629                         msg_ref = tag_ptr(msg_var.inner, false);
4630         return msg_ref;
4631 }
4632 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_node_id(int64_t ptr) {
4633         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4634         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4635         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4636         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
4637         return node_id_arr;
4638 }
4639 int64_t CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_msg(int64_t ptr) {
4640         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4641         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4642         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4643                         int64_t msg_ref = 0;
4644                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4645                         msg_ref = tag_ptr(msg_var.inner, false);
4646         return msg_ref;
4647 }
4648 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_node_id(int64_t ptr) {
4649         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4650         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4651         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4652         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4653         return node_id_arr;
4654 }
4655 int64_t CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_msg(int64_t ptr) {
4656         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4657         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4658         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4659                         int64_t msg_ref = 0;
4660                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4661                         msg_ref = tag_ptr(msg_var.inner, false);
4662         return msg_ref;
4663 }
4664 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_node_id(int64_t ptr) {
4665         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4666         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4667         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4668         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4669         return node_id_arr;
4670 }
4671 int64_t CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_msg(int64_t ptr) {
4672         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4673         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4674         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4675                         int64_t msg_ref = 0;
4676                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4677                         msg_ref = tag_ptr(msg_var.inner, false);
4678         return msg_ref;
4679 }
4680 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAbort_get_node_id(int64_t ptr) {
4681         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4682         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
4683         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4684         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4685         return node_id_arr;
4686 }
4687 int64_t CS_LDK_LDKMessageSendEvent_SendTxAbort_get_msg(int64_t ptr) {
4688         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4689         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
4690         LDKTxAbort msg_var = obj->send_tx_abort.msg;
4691                         int64_t msg_ref = 0;
4692                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4693                         msg_ref = tag_ptr(msg_var.inner, false);
4694         return msg_ref;
4695 }
4696 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReady_get_node_id(int64_t ptr) {
4697         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4698         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
4699         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4700         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4701         return node_id_arr;
4702 }
4703 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReady_get_msg(int64_t ptr) {
4704         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4705         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
4706         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4707                         int64_t msg_ref = 0;
4708                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4709                         msg_ref = tag_ptr(msg_var.inner, false);
4710         return msg_ref;
4711 }
4712 int8_tArray CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(int64_t ptr) {
4713         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4714         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4715         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4716         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4717         return node_id_arr;
4718 }
4719 int64_t CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(int64_t ptr) {
4720         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4721         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4722         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4723                         int64_t msg_ref = 0;
4724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4725                         msg_ref = tag_ptr(msg_var.inner, false);
4726         return msg_ref;
4727 }
4728 int8_tArray CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_node_id(int64_t ptr) {
4729         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4730         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4731         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4732         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4733         return node_id_arr;
4734 }
4735 int64_t CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_updates(int64_t ptr) {
4736         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4737         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4738         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4739                         int64_t updates_ref = 0;
4740                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4741                         updates_ref = tag_ptr(updates_var.inner, false);
4742         return updates_ref;
4743 }
4744 int8_tArray CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(int64_t ptr) {
4745         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4746         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4747         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4748         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4749         return node_id_arr;
4750 }
4751 int64_t CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_msg(int64_t ptr) {
4752         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4753         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4754         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4755                         int64_t msg_ref = 0;
4756                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4757                         msg_ref = tag_ptr(msg_var.inner, false);
4758         return msg_ref;
4759 }
4760 int8_tArray CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_node_id(int64_t ptr) {
4761         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4762         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4763         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4764         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4765         return node_id_arr;
4766 }
4767 int64_t CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_msg(int64_t ptr) {
4768         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4769         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4770         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4771                         int64_t msg_ref = 0;
4772                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4773                         msg_ref = tag_ptr(msg_var.inner, false);
4774         return msg_ref;
4775 }
4776 int8_tArray CS_LDK_LDKMessageSendEvent_SendShutdown_get_node_id(int64_t ptr) {
4777         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4778         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
4779         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4780         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4781         return node_id_arr;
4782 }
4783 int64_t CS_LDK_LDKMessageSendEvent_SendShutdown_get_msg(int64_t ptr) {
4784         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4785         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
4786         LDKShutdown msg_var = obj->send_shutdown.msg;
4787                         int64_t msg_ref = 0;
4788                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4789                         msg_ref = tag_ptr(msg_var.inner, false);
4790         return msg_ref;
4791 }
4792 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_node_id(int64_t ptr) {
4793         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4794         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4795         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4796         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4797         return node_id_arr;
4798 }
4799 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_msg(int64_t ptr) {
4800         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4801         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4802         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4803                         int64_t msg_ref = 0;
4804                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4805                         msg_ref = tag_ptr(msg_var.inner, false);
4806         return msg_ref;
4807 }
4808 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(int64_t ptr) {
4809         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4810         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4811         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4812         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4813         return node_id_arr;
4814 }
4815 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(int64_t ptr) {
4816         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4817         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4818         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4819                         int64_t msg_ref = 0;
4820                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4821                         msg_ref = tag_ptr(msg_var.inner, false);
4822         return msg_ref;
4823 }
4824 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(int64_t ptr) {
4825         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4826         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4827         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4828                         int64_t update_msg_ref = 0;
4829                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4830                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4831         return update_msg_ref;
4832 }
4833 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(int64_t ptr) {
4834         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4835         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4836         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4837                         int64_t msg_ref = 0;
4838                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4839                         msg_ref = tag_ptr(msg_var.inner, false);
4840         return msg_ref;
4841 }
4842 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(int64_t ptr) {
4843         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4844         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4845         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4846                         int64_t update_msg_ref = 0;
4847                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4848                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4849         return update_msg_ref;
4850 }
4851 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(int64_t ptr) {
4852         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4853         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4854         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4855                         int64_t msg_ref = 0;
4856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4857                         msg_ref = tag_ptr(msg_var.inner, false);
4858         return msg_ref;
4859 }
4860 int64_t CS_LDK_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(int64_t ptr) {
4861         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4862         CHECK(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4863         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4864                         int64_t msg_ref = 0;
4865                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4866                         msg_ref = tag_ptr(msg_var.inner, false);
4867         return msg_ref;
4868 }
4869 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_node_id(int64_t ptr) {
4870         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4871         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4872         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4873         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4874         return node_id_arr;
4875 }
4876 int64_t CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_msg(int64_t ptr) {
4877         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4878         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4879         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4880                         int64_t msg_ref = 0;
4881                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4882                         msg_ref = tag_ptr(msg_var.inner, false);
4883         return msg_ref;
4884 }
4885 int8_tArray CS_LDK_LDKMessageSendEvent_HandleError_get_node_id(int64_t ptr) {
4886         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4887         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
4888         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4889         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4890         return node_id_arr;
4891 }
4892 int64_t CS_LDK_LDKMessageSendEvent_HandleError_get_action(int64_t ptr) {
4893         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4894         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
4895         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4896         return action_ref;
4897 }
4898 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(int64_t ptr) {
4899         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4900         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4901         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4902         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4903         return node_id_arr;
4904 }
4905 int64_t CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(int64_t ptr) {
4906         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4907         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4908         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4909                         int64_t msg_ref = 0;
4910                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4911                         msg_ref = tag_ptr(msg_var.inner, false);
4912         return msg_ref;
4913 }
4914 int8_tArray CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(int64_t ptr) {
4915         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4916         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4917         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4918         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4919         return node_id_arr;
4920 }
4921 int64_t CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_msg(int64_t ptr) {
4922         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4923         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4924         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4925                         int64_t msg_ref = 0;
4926                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4927                         msg_ref = tag_ptr(msg_var.inner, false);
4928         return msg_ref;
4929 }
4930 int8_tArray CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(int64_t ptr) {
4931         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4932         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4933         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4934         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4935         return node_id_arr;
4936 }
4937 int64_t CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_msg(int64_t ptr) {
4938         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4939         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4940         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4941                         int64_t msg_ref = 0;
4942                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4943                         msg_ref = tag_ptr(msg_var.inner, false);
4944         return msg_ref;
4945 }
4946 int8_tArray CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(int64_t ptr) {
4947         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4948         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4949         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4950         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4951         return node_id_arr;
4952 }
4953 int64_t CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(int64_t ptr) {
4954         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4955         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4956         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4957                         int64_t msg_ref = 0;
4958                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4959                         msg_ref = tag_ptr(msg_var.inner, false);
4960         return msg_ref;
4961 }
4962 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4963         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4964         for (size_t i = 0; i < ret.datalen; i++) {
4965                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4966         }
4967         return ret;
4968 }
4969 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4970         LDKChannelUpdateInfo ret = *owner->contents.result;
4971         ret.is_owned = false;
4972         return ret;
4973 }
4974 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(int64_t owner) {
4975         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4976         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4977         int64_t ret_ref = 0;
4978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4980         return ret_ref;
4981 }
4982
4983 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4984 CHECK(!owner->result_ok);
4985         return DecodeError_clone(&*owner->contents.err);
4986 }
4987 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(int64_t owner) {
4988         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4989         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4990         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4991         int64_t ret_ref = tag_ptr(ret_copy, true);
4992         return ret_ref;
4993 }
4994
4995 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4996         LDKChannelInfo ret = *owner->contents.result;
4997         ret.is_owned = false;
4998         return ret;
4999 }
5000 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_ok(int64_t owner) {
5001         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5002         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
5003         int64_t ret_ref = 0;
5004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5006         return ret_ref;
5007 }
5008
5009 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5010 CHECK(!owner->result_ok);
5011         return DecodeError_clone(&*owner->contents.err);
5012 }
5013 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_err(int64_t owner) {
5014         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5016         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
5017         int64_t ret_ref = tag_ptr(ret_copy, true);
5018         return ret_ref;
5019 }
5020
5021 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5022         LDKRoutingFees ret = *owner->contents.result;
5023         ret.is_owned = false;
5024         return ret;
5025 }
5026 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_ok(int64_t owner) {
5027         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5028         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
5029         int64_t ret_ref = 0;
5030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5032         return ret_ref;
5033 }
5034
5035 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5036 CHECK(!owner->result_ok);
5037         return DecodeError_clone(&*owner->contents.err);
5038 }
5039 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_err(int64_t owner) {
5040         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5042         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
5043         int64_t ret_ref = tag_ptr(ret_copy, true);
5044         return ret_ref;
5045 }
5046
5047 uint32_t CS_LDK_LDKSocketAddress_ty_from_ptr(int64_t ptr) {
5048         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5049         switch(obj->tag) {
5050                 case LDKSocketAddress_TcpIpV4: return 0;
5051                 case LDKSocketAddress_TcpIpV6: return 1;
5052                 case LDKSocketAddress_OnionV2: return 2;
5053                 case LDKSocketAddress_OnionV3: return 3;
5054                 case LDKSocketAddress_Hostname: return 4;
5055                 default: abort();
5056         }
5057 }
5058 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV4_get_addr(int64_t ptr) {
5059         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5060         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5061         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
5062         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
5063         return addr_arr;
5064 }
5065 int16_t CS_LDK_LDKSocketAddress_TcpIpV4_get_port(int64_t ptr) {
5066         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5067         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5068         int16_t port_conv = obj->tcp_ip_v4.port;
5069         return port_conv;
5070 }
5071 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV6_get_addr(int64_t ptr) {
5072         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5073         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5074         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
5075         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
5076         return addr_arr;
5077 }
5078 int16_t CS_LDK_LDKSocketAddress_TcpIpV6_get_port(int64_t ptr) {
5079         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5080         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5081         int16_t port_conv = obj->tcp_ip_v6.port;
5082         return port_conv;
5083 }
5084 int8_tArray CS_LDK_LDKSocketAddress_OnionV2_get_onion_v2(int64_t ptr) {
5085         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5086         CHECK(obj->tag == LDKSocketAddress_OnionV2);
5087         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
5088         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
5089         return onion_v2_arr;
5090 }
5091 int8_tArray CS_LDK_LDKSocketAddress_OnionV3_get_ed25519_pubkey(int64_t ptr) {
5092         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5093         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5094         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
5095         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
5096         return ed25519_pubkey_arr;
5097 }
5098 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_checksum(int64_t ptr) {
5099         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5100         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5101         int16_t checksum_conv = obj->onion_v3.checksum;
5102         return checksum_conv;
5103 }
5104 int8_t CS_LDK_LDKSocketAddress_OnionV3_get_version(int64_t ptr) {
5105         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5106         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5107         int8_t version_conv = obj->onion_v3.version;
5108         return version_conv;
5109 }
5110 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_port(int64_t ptr) {
5111         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5112         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5113         int16_t port_conv = obj->onion_v3.port;
5114         return port_conv;
5115 }
5116 int64_t CS_LDK_LDKSocketAddress_Hostname_get_hostname(int64_t ptr) {
5117         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5118         CHECK(obj->tag == LDKSocketAddress_Hostname);
5119         LDKHostname hostname_var = obj->hostname.hostname;
5120                         int64_t hostname_ref = 0;
5121                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
5122                         hostname_ref = tag_ptr(hostname_var.inner, false);
5123         return hostname_ref;
5124 }
5125 int16_t CS_LDK_LDKSocketAddress_Hostname_get_port(int64_t ptr) {
5126         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5127         CHECK(obj->tag == LDKSocketAddress_Hostname);
5128         int16_t port_conv = obj->hostname.port;
5129         return port_conv;
5130 }
5131 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
5132         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
5133         for (size_t i = 0; i < ret.datalen; i++) {
5134                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
5135         }
5136         return ret;
5137 }
5138 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5139         LDKNodeAnnouncementInfo ret = *owner->contents.result;
5140         ret.is_owned = false;
5141         return ret;
5142 }
5143 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(int64_t owner) {
5144         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5145         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
5146         int64_t ret_ref = 0;
5147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5149         return ret_ref;
5150 }
5151
5152 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5153 CHECK(!owner->result_ok);
5154         return DecodeError_clone(&*owner->contents.err);
5155 }
5156 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(int64_t owner) {
5157         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5158         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5159         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
5160         int64_t ret_ref = tag_ptr(ret_copy, true);
5161         return ret_ref;
5162 }
5163
5164 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5165         LDKNodeAlias ret = *owner->contents.result;
5166         ret.is_owned = false;
5167         return ret;
5168 }
5169 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_ok(int64_t owner) {
5170         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5171         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
5172         int64_t ret_ref = 0;
5173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5175         return ret_ref;
5176 }
5177
5178 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5179 CHECK(!owner->result_ok);
5180         return DecodeError_clone(&*owner->contents.err);
5181 }
5182 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_err(int64_t owner) {
5183         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5184         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5185         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5186         int64_t ret_ref = tag_ptr(ret_copy, true);
5187         return ret_ref;
5188 }
5189
5190 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5191         LDKNodeInfo ret = *owner->contents.result;
5192         ret.is_owned = false;
5193         return ret;
5194 }
5195 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_ok(int64_t owner) {
5196         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5197         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5198         int64_t ret_ref = 0;
5199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5201         return ret_ref;
5202 }
5203
5204 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5205 CHECK(!owner->result_ok);
5206         return DecodeError_clone(&*owner->contents.err);
5207 }
5208 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_err(int64_t owner) {
5209         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5211         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5212         int64_t ret_ref = tag_ptr(ret_copy, true);
5213         return ret_ref;
5214 }
5215
5216 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5217         LDKNetworkGraph ret = *owner->contents.result;
5218         ret.is_owned = false;
5219         return ret;
5220 }
5221 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_ok(int64_t owner) {
5222         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5223         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5224         int64_t ret_ref = 0;
5225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5227         return ret_ref;
5228 }
5229
5230 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5231 CHECK(!owner->result_ok);
5232         return DecodeError_clone(&*owner->contents.err);
5233 }
5234 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_err(int64_t owner) {
5235         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5237         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5238         int64_t ret_ref = tag_ptr(ret_copy, true);
5239         return ret_ref;
5240 }
5241
5242 uint32_t CS_LDK_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(int64_t ptr) {
5243         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5244         switch(obj->tag) {
5245                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
5246                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
5247                 default: abort();
5248         }
5249 }
5250 int64_tArray CS_LDK_LDKCOption_CVec_SocketAddressZZ_Some_get_some(int64_t ptr) {
5251         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5252         CHECK(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
5253         LDKCVec_SocketAddressZ some_var = obj->some;
5254                         int64_tArray some_arr = NULL;
5255                         some_arr = init_int64_tArray(some_var.datalen, __LINE__);
5256                         int64_t *some_arr_ptr = (int64_t*)(((uint8_t*)some_arr) + 8);
5257                         for (size_t p = 0; p < some_var.datalen; p++) {
5258                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
5259                                 some_arr_ptr[p] = some_conv_15_ref;
5260                         }
5261                         
5262         return some_arr;
5263 }
5264 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5265         LDKPendingHTLCInfo ret = *owner->contents.result;
5266         ret.is_owned = false;
5267         return ret;
5268 }
5269 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(int64_t owner) {
5270         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5271         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
5272         int64_t ret_ref = 0;
5273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5275         return ret_ref;
5276 }
5277
5278 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5279         LDKInboundHTLCErr ret = *owner->contents.err;
5280         ret.is_owned = false;
5281         return ret;
5282 }
5283 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(int64_t owner) {
5284         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5285         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
5286         int64_t ret_ref = 0;
5287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5289         return ret_ref;
5290 }
5291
5292 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
5293         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
5294         for (size_t i = 0; i < ret.datalen; i++) {
5295                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
5296         }
5297         return ret;
5298 }
5299 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
5300         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
5301         for (size_t i = 0; i < ret.datalen; i++) {
5302                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
5303         }
5304         return ret;
5305 }
5306 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5307         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5308         for (size_t i = 0; i < ret.datalen; i++) {
5309                 ret.data[i] = Utxo_clone(&orig->data[i]);
5310         }
5311         return ret;
5312 }
5313 uint32_t CS_LDK_LDKCOption_TxOutZ_ty_from_ptr(int64_t ptr) {
5314         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5315         switch(obj->tag) {
5316                 case LDKCOption_TxOutZ_Some: return 0;
5317                 case LDKCOption_TxOutZ_None: return 1;
5318                 default: abort();
5319         }
5320 }
5321 int64_t CS_LDK_LDKCOption_TxOutZ_Some_get_some(int64_t ptr) {
5322         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5323         CHECK(obj->tag == LDKCOption_TxOutZ_Some);
5324         LDKTxOut* some_ref = &obj->some;
5325         return tag_ptr(some_ref, false);
5326 }
5327 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5328         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5329         for (size_t i = 0; i < ret.datalen; i++) {
5330                 ret.data[i] = Input_clone(&orig->data[i]);
5331         }
5332         return ret;
5333 }
5334 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5335         LDKCoinSelection ret = *owner->contents.result;
5336         ret.is_owned = false;
5337         return ret;
5338 }
5339 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_get_ok(int64_t owner) {
5340         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5341         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5342         int64_t ret_ref = 0;
5343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5345         return ret_ref;
5346 }
5347
5348 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5349 CHECK(!owner->result_ok);
5350         return *owner->contents.err;
5351 }
5352 void  CS_LDK_CResult_CoinSelectionNoneZ_get_err(int64_t owner) {
5353         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5354         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5355 }
5356
5357 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5358 CHECK(owner->result_ok);
5359         return CVec_UtxoZ_clone(&*owner->contents.result);
5360 }
5361 int64_tArray  CS_LDK_CResult_CVec_UtxoZNoneZ_get_ok(int64_t owner) {
5362         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5363         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5364         int64_tArray ret_arr = NULL;
5365         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
5366         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
5367         for (size_t g = 0; g < ret_var.datalen; g++) {
5368                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5369                 int64_t ret_conv_6_ref = 0;
5370                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5371                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5372                 ret_arr_ptr[g] = ret_conv_6_ref;
5373         }
5374         
5375         FREE(ret_var.data);
5376         return ret_arr;
5377 }
5378
5379 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5380 CHECK(!owner->result_ok);
5381         return *owner->contents.err;
5382 }
5383 void  CS_LDK_CResult_CVec_UtxoZNoneZ_get_err(int64_t owner) {
5384         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5385         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5386 }
5387
5388 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5389         return owner->a;
5390 }
5391 int64_t  CS_LDK_C2Tuple_u64u16Z_get_a(int64_t owner) {
5392         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5393         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
5394         return ret_conv;
5395 }
5396
5397 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5398         return owner->b;
5399 }
5400 int16_t  CS_LDK_C2Tuple_u64u16Z_get_b(int64_t owner) {
5401         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5402         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
5403         return ret_conv;
5404 }
5405
5406 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(int64_t ptr) {
5407         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5408         switch(obj->tag) {
5409                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
5410                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
5411                 default: abort();
5412         }
5413 }
5414 int64_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(int64_t ptr) {
5415         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5416         CHECK(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
5417         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
5418         *some_conv = obj->some;
5419                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
5420         return tag_ptr(some_conv, true);
5421 }
5422 uint32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(int64_t ptr) {
5423         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5424         switch(obj->tag) {
5425                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
5426                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
5427                 default: abort();
5428         }
5429 }
5430 int32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_Some_get_some(int64_t ptr) {
5431         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5432         CHECK(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
5433         int32_t some_conv = LDKChannelShutdownState_to_cs(obj->some);
5434         return some_conv;
5435 }
5436 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5437 CHECK(owner->result_ok);
5438         return ThirtyTwoBytes_clone(&*owner->contents.result);
5439 }
5440 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(int64_t owner) {
5441         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5442         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5443         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
5444         return ret_arr;
5445 }
5446
5447 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5448 CHECK(!owner->result_ok);
5449         return APIError_clone(&*owner->contents.err);
5450 }
5451 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_err(int64_t owner) {
5452         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5453         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5454         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
5455         int64_t ret_ref = tag_ptr(ret_copy, true);
5456         return ret_ref;
5457 }
5458
5459 uint32_t CS_LDK_LDKRecentPaymentDetails_ty_from_ptr(int64_t ptr) {
5460         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5461         switch(obj->tag) {
5462                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
5463                 case LDKRecentPaymentDetails_Pending: return 1;
5464                 case LDKRecentPaymentDetails_Fulfilled: return 2;
5465                 case LDKRecentPaymentDetails_Abandoned: return 3;
5466                 default: abort();
5467         }
5468 }
5469 int8_tArray CS_LDK_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(int64_t ptr) {
5470         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5471         CHECK(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
5472         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5473         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
5474         return payment_id_arr;
5475 }
5476 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_id(int64_t ptr) {
5477         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5478         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5479         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5480         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
5481         return payment_id_arr;
5482 }
5483 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_hash(int64_t ptr) {
5484         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5485         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5486         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5487         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5488         return payment_hash_arr;
5489 }
5490 int64_t CS_LDK_LDKRecentPaymentDetails_Pending_get_total_msat(int64_t ptr) {
5491         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5492         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5493         int64_t total_msat_conv = obj->pending.total_msat;
5494         return total_msat_conv;
5495 }
5496 int8_tArray CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_id(int64_t ptr) {
5497         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5498         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5499         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5500         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
5501         return payment_id_arr;
5502 }
5503 int64_t CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(int64_t ptr) {
5504         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5505         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5506         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
5507         return payment_hash_ref;
5508 }
5509 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_id(int64_t ptr) {
5510         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5511         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
5512         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5513         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
5514         return payment_id_arr;
5515 }
5516 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_hash(int64_t ptr) {
5517         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5518         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
5519         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5520         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5521         return payment_hash_arr;
5522 }
5523 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5524         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5525         for (size_t i = 0; i < ret.datalen; i++) {
5526                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5527         }
5528         return ret;
5529 }
5530 uint32_t CS_LDK_LDKPaymentSendFailure_ty_from_ptr(int64_t ptr) {
5531         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5532         switch(obj->tag) {
5533                 case LDKPaymentSendFailure_ParameterError: return 0;
5534                 case LDKPaymentSendFailure_PathParameterError: return 1;
5535                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5536                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5537                 case LDKPaymentSendFailure_PartialFailure: return 4;
5538                 default: abort();
5539         }
5540 }
5541 int64_t CS_LDK_LDKPaymentSendFailure_ParameterError_get_parameter_error(int64_t ptr) {
5542         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5543         CHECK(obj->tag == LDKPaymentSendFailure_ParameterError);
5544         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5545         return parameter_error_ref;
5546 }
5547 int64_tArray CS_LDK_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(int64_t ptr) {
5548         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5549         CHECK(obj->tag == LDKPaymentSendFailure_PathParameterError);
5550         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5551                         int64_tArray path_parameter_error_arr = NULL;
5552                         path_parameter_error_arr = init_int64_tArray(path_parameter_error_var.datalen, __LINE__);
5553                         int64_t *path_parameter_error_arr_ptr = (int64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
5554                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5555                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5556                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5557                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5558                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5559                         }
5560                         
5561         return path_parameter_error_arr;
5562 }
5563 int64_tArray CS_LDK_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(int64_t ptr) {
5564         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5565         CHECK(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
5566         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
5567                         int64_tArray all_failed_resend_safe_arr = NULL;
5568                         all_failed_resend_safe_arr = init_int64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
5569                         int64_t *all_failed_resend_safe_arr_ptr = (int64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
5570                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
5571                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
5572                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
5573                         }
5574                         
5575         return all_failed_resend_safe_arr;
5576 }
5577 int64_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_results(int64_t ptr) {
5578         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5579         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
5580         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5581                         int64_tArray results_arr = NULL;
5582                         results_arr = init_int64_tArray(results_var.datalen, __LINE__);
5583                         int64_t *results_arr_ptr = (int64_t*)(((uint8_t*)results_arr) + 8);
5584                         for (size_t w = 0; w < results_var.datalen; w++) {
5585                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5586                                 *results_conv_22_conv = results_var.data[w];
5587                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5588                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5589                         }
5590                         
5591         return results_arr;
5592 }
5593 int64_t CS_LDK_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(int64_t ptr) {
5594         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5595         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
5596         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5597                         int64_t failed_paths_retry_ref = 0;
5598                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5599                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5600         return failed_paths_retry_ref;
5601 }
5602 int8_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_payment_id(int64_t ptr) {
5603         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5604         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
5605         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5606         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5607         return payment_id_arr;
5608 }
5609 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5610 CHECK(owner->result_ok);
5611         return *owner->contents.result;
5612 }
5613 void  CS_LDK_CResult_NonePaymentSendFailureZ_get_ok(int64_t owner) {
5614         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5615         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5616 }
5617
5618 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5619 CHECK(!owner->result_ok);
5620         return PaymentSendFailure_clone(&*owner->contents.err);
5621 }
5622 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_get_err(int64_t owner) {
5623         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5624         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5625         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5626         int64_t ret_ref = tag_ptr(ret_copy, true);
5627         return ret_ref;
5628 }
5629
5630 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5631 CHECK(owner->result_ok);
5632         return *owner->contents.result;
5633 }
5634 void  CS_LDK_CResult_NoneRetryableSendFailureZ_get_ok(int64_t owner) {
5635         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5636         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
5637 }
5638
5639 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5640 CHECK(!owner->result_ok);
5641         return RetryableSendFailure_clone(&*owner->contents.err);
5642 }
5643 int32_t  CS_LDK_CResult_NoneRetryableSendFailureZ_get_err(int64_t owner) {
5644         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5645         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5646         return ret_conv;
5647 }
5648
5649 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5650 CHECK(owner->result_ok);
5651         return ThirtyTwoBytes_clone(&*owner->contents.result);
5652 }
5653 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(int64_t owner) {
5654         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5655         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5656         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5657         return ret_arr;
5658 }
5659
5660 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5661 CHECK(!owner->result_ok);
5662         return PaymentSendFailure_clone(&*owner->contents.err);
5663 }
5664 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(int64_t owner) {
5665         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5666         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5667         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
5668         int64_t ret_ref = tag_ptr(ret_copy, true);
5669         return ret_ref;
5670 }
5671
5672 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5673 CHECK(owner->result_ok);
5674         return ThirtyTwoBytes_clone(&*owner->contents.result);
5675 }
5676 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(int64_t owner) {
5677         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5678         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5679         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5680         return ret_arr;
5681 }
5682
5683 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5684 CHECK(!owner->result_ok);
5685         return RetryableSendFailure_clone(&*owner->contents.err);
5686 }
5687 int32_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(int64_t owner) {
5688         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5689         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
5690         return ret_conv;
5691 }
5692
5693 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5694         return ThirtyTwoBytes_clone(&owner->a);
5695 }
5696 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(int64_t owner) {
5697         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5698         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5699         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
5700         return ret_arr;
5701 }
5702
5703 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5704         return ThirtyTwoBytes_clone(&owner->b);
5705 }
5706 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(int64_t owner) {
5707         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5708         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5709         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
5710         return ret_arr;
5711 }
5712
5713 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5714 CHECK(owner->result_ok);
5715         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5716 }
5717 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(int64_t owner) {
5718         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5719         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5720         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
5721         return tag_ptr(ret_conv, true);
5722 }
5723
5724 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5725 CHECK(!owner->result_ok);
5726         return PaymentSendFailure_clone(&*owner->contents.err);
5727 }
5728 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(int64_t owner) {
5729         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5730         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5731         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
5732         int64_t ret_ref = tag_ptr(ret_copy, true);
5733         return ret_ref;
5734 }
5735
5736 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
5737         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
5738         for (size_t i = 0; i < ret.datalen; i++) {
5739                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
5740         }
5741         return ret;
5742 }
5743 uint32_t CS_LDK_LDKProbeSendFailure_ty_from_ptr(int64_t ptr) {
5744         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5745         switch(obj->tag) {
5746                 case LDKProbeSendFailure_RouteNotFound: return 0;
5747                 case LDKProbeSendFailure_SendingFailed: return 1;
5748                 default: abort();
5749         }
5750 }
5751 int64_t CS_LDK_LDKProbeSendFailure_SendingFailed_get_sending_failed(int64_t ptr) {
5752         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5753         CHECK(obj->tag == LDKProbeSendFailure_SendingFailed);
5754         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
5755         return sending_failed_ref;
5756 }
5757 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5758 CHECK(owner->result_ok);
5759         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
5760 }
5761 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(int64_t owner) {
5762         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5763         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
5764         int64_tArray ret_arr = NULL;
5765         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
5766         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
5767         for (size_t o = 0; o < ret_var.datalen; o++) {
5768                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5769                 *ret_conv_40_conv = ret_var.data[o];
5770                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
5771         }
5772         
5773         FREE(ret_var.data);
5774         return ret_arr;
5775 }
5776
5777 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5778 CHECK(!owner->result_ok);
5779         return ProbeSendFailure_clone(&*owner->contents.err);
5780 }
5781 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(int64_t owner) {
5782         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5783         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
5784         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
5785         int64_t ret_ref = tag_ptr(ret_copy, true);
5786         return ret_ref;
5787 }
5788
5789 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5790         return ThirtyTwoBytes_clone(&owner->a);
5791 }
5792 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(int64_t owner) {
5793         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5794         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5795         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
5796         return ret_arr;
5797 }
5798
5799 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5800         return owner->b;
5801 }
5802 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(int64_t owner) {
5803         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5804         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5805         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5806         return ret_arr;
5807 }
5808
5809 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
5810         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5811         for (size_t i = 0; i < ret.datalen; i++) {
5812                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
5813         }
5814         return ret;
5815 }
5816 uint32_t CS_LDK_LDKCOption_StrZ_ty_from_ptr(int64_t ptr) {
5817         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5818         switch(obj->tag) {
5819                 case LDKCOption_StrZ_Some: return 0;
5820                 case LDKCOption_StrZ_None: return 1;
5821                 default: abort();
5822         }
5823 }
5824 jstring CS_LDK_LDKCOption_StrZ_Some_get_some(int64_t ptr) {
5825         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5826         CHECK(obj->tag == LDKCOption_StrZ_Some);
5827         LDKStr some_str = obj->some;
5828                         jstring some_conv = str_ref_to_cs(some_str.chars, some_str.len);
5829         return some_conv;
5830 }
5831 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5832 CHECK(owner->result_ok);
5833         return *owner->contents.result;
5834 }
5835 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_ok(int64_t owner) {
5836         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5837         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
5838 }
5839
5840 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5841 CHECK(!owner->result_ok);
5842         return Bolt12SemanticError_clone(&*owner->contents.err);
5843 }
5844 int32_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_err(int64_t owner) {
5845         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5846         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
5847         return ret_conv;
5848 }
5849
5850 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5851 CHECK(owner->result_ok);
5852         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5853 }
5854 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(int64_t owner) {
5855         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5856         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5857         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5858         return tag_ptr(ret_conv, true);
5859 }
5860
5861 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5862 CHECK(!owner->result_ok);
5863         return *owner->contents.err;
5864 }
5865 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(int64_t owner) {
5866         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5867         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5868 }
5869
5870 uint32_t CS_LDK_LDKOffersMessage_ty_from_ptr(int64_t ptr) {
5871         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5872         switch(obj->tag) {
5873                 case LDKOffersMessage_InvoiceRequest: return 0;
5874                 case LDKOffersMessage_Invoice: return 1;
5875                 case LDKOffersMessage_InvoiceError: return 2;
5876                 default: abort();
5877         }
5878 }
5879 int64_t CS_LDK_LDKOffersMessage_InvoiceRequest_get_invoice_request(int64_t ptr) {
5880         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5881         CHECK(obj->tag == LDKOffersMessage_InvoiceRequest);
5882         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5883                         int64_t invoice_request_ref = 0;
5884                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5885                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5886         return invoice_request_ref;
5887 }
5888 int64_t CS_LDK_LDKOffersMessage_Invoice_get_invoice(int64_t ptr) {
5889         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5890         CHECK(obj->tag == LDKOffersMessage_Invoice);
5891         LDKBolt12Invoice invoice_var = obj->invoice;
5892                         int64_t invoice_ref = 0;
5893                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5894                         invoice_ref = tag_ptr(invoice_var.inner, false);
5895         return invoice_ref;
5896 }
5897 int64_t CS_LDK_LDKOffersMessage_InvoiceError_get_invoice_error(int64_t ptr) {
5898         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5899         CHECK(obj->tag == LDKOffersMessage_InvoiceError);
5900         LDKInvoiceError invoice_error_var = obj->invoice_error;
5901                         int64_t invoice_error_ref = 0;
5902                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5903                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5904         return invoice_error_ref;
5905 }
5906 uint32_t CS_LDK_LDKCOption_OffersMessageZ_ty_from_ptr(int64_t ptr) {
5907         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5908         switch(obj->tag) {
5909                 case LDKCOption_OffersMessageZ_Some: return 0;
5910                 case LDKCOption_OffersMessageZ_None: return 1;
5911                 default: abort();
5912         }
5913 }
5914 int64_t CS_LDK_LDKCOption_OffersMessageZ_Some_get_some(int64_t ptr) {
5915         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5916         CHECK(obj->tag == LDKCOption_OffersMessageZ_Some);
5917         int64_t some_ref = tag_ptr(&obj->some, false);
5918         return some_ref;
5919 }
5920 uint32_t CS_LDK_LDKDestination_ty_from_ptr(int64_t ptr) {
5921         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5922         switch(obj->tag) {
5923                 case LDKDestination_Node: return 0;
5924                 case LDKDestination_BlindedPath: return 1;
5925                 default: abort();
5926         }
5927 }
5928 int8_tArray CS_LDK_LDKDestination_Node_get_node(int64_t ptr) {
5929         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5930         CHECK(obj->tag == LDKDestination_Node);
5931         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5932         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5933         return node_arr;
5934 }
5935 int64_t CS_LDK_LDKDestination_BlindedPath_get_blinded_path(int64_t ptr) {
5936         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5937         CHECK(obj->tag == LDKDestination_BlindedPath);
5938         LDKBlindedPath blinded_path_var = obj->blinded_path;
5939                         int64_t blinded_path_ref = 0;
5940                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5941                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5942         return blinded_path_ref;
5943 }
5944 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5945         return OffersMessage_clone(&owner->a);
5946 }
5947 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(int64_t owner) {
5948         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5949         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5950         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5951         int64_t ret_ref = tag_ptr(ret_copy, true);
5952         return ret_ref;
5953 }
5954
5955 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5956         return Destination_clone(&owner->b);
5957 }
5958 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(int64_t owner) {
5959         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5960         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5961         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5962         int64_t ret_ref = tag_ptr(ret_copy, true);
5963         return ret_ref;
5964 }
5965
5966 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5967         LDKBlindedPath ret = owner->c;
5968         ret.is_owned = false;
5969         return ret;
5970 }
5971 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(int64_t owner) {
5972         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5973         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5974         int64_t ret_ref = 0;
5975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5977         return ret_ref;
5978 }
5979
5980 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5981         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5982         for (size_t i = 0; i < ret.datalen; i++) {
5983                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5984         }
5985         return ret;
5986 }
5987 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5988         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5989         ret.is_owned = false;
5990         return ret;
5991 }
5992 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(int64_t owner) {
5993         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5994         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5995         int64_t ret_ref = 0;
5996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5998         return ret_ref;
5999 }
6000
6001 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6002 CHECK(!owner->result_ok);
6003         return DecodeError_clone(&*owner->contents.err);
6004 }
6005 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(int64_t owner) {
6006         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6007         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6008         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6009         int64_t ret_ref = tag_ptr(ret_copy, true);
6010         return ret_ref;
6011 }
6012
6013 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6014         LDKChannelCounterparty ret = *owner->contents.result;
6015         ret.is_owned = false;
6016         return ret;
6017 }
6018 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(int64_t owner) {
6019         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6020         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6021         int64_t ret_ref = 0;
6022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6024         return ret_ref;
6025 }
6026
6027 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6028 CHECK(!owner->result_ok);
6029         return DecodeError_clone(&*owner->contents.err);
6030 }
6031 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_err(int64_t owner) {
6032         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6033         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6034         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6035         int64_t ret_ref = tag_ptr(ret_copy, true);
6036         return ret_ref;
6037 }
6038
6039 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6040         LDKChannelDetails ret = *owner->contents.result;
6041         ret.is_owned = false;
6042         return ret;
6043 }
6044 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_ok(int64_t owner) {
6045         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6046         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6047         int64_t ret_ref = 0;
6048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6050         return ret_ref;
6051 }
6052
6053 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6054 CHECK(!owner->result_ok);
6055         return DecodeError_clone(&*owner->contents.err);
6056 }
6057 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_err(int64_t owner) {
6058         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6059         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6060         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6061         int64_t ret_ref = tag_ptr(ret_copy, true);
6062         return ret_ref;
6063 }
6064
6065 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6066         LDKPhantomRouteHints ret = *owner->contents.result;
6067         ret.is_owned = false;
6068         return ret;
6069 }
6070 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(int64_t owner) {
6071         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6072         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6073         int64_t ret_ref = 0;
6074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6076         return ret_ref;
6077 }
6078
6079 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6080 CHECK(!owner->result_ok);
6081         return DecodeError_clone(&*owner->contents.err);
6082 }
6083 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_err(int64_t owner) {
6084         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6085         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6086         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6087         int64_t ret_ref = tag_ptr(ret_copy, true);
6088         return ret_ref;
6089 }
6090
6091 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6092         LDKBlindedForward ret = *owner->contents.result;
6093         ret.is_owned = false;
6094         return ret;
6095 }
6096 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_ok(int64_t owner) {
6097         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6098         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
6099         int64_t ret_ref = 0;
6100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6102         return ret_ref;
6103 }
6104
6105 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6106 CHECK(!owner->result_ok);
6107         return DecodeError_clone(&*owner->contents.err);
6108 }
6109 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_err(int64_t owner) {
6110         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6111         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6112         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
6113         int64_t ret_ref = tag_ptr(ret_copy, true);
6114         return ret_ref;
6115 }
6116
6117 uint32_t CS_LDK_LDKPendingHTLCRouting_ty_from_ptr(int64_t ptr) {
6118         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6119         switch(obj->tag) {
6120                 case LDKPendingHTLCRouting_Forward: return 0;
6121                 case LDKPendingHTLCRouting_Receive: return 1;
6122                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
6123                 default: abort();
6124         }
6125 }
6126 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_onion_packet(int64_t ptr) {
6127         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6128         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6129         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
6130                         int64_t onion_packet_ref = 0;
6131                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
6132                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
6133         return onion_packet_ref;
6134 }
6135 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_short_channel_id(int64_t ptr) {
6136         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6137         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6138         int64_t short_channel_id_conv = obj->forward.short_channel_id;
6139         return short_channel_id_conv;
6140 }
6141 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_blinded(int64_t ptr) {
6142         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6143         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6144         LDKBlindedForward blinded_var = obj->forward.blinded;
6145                         int64_t blinded_ref = 0;
6146                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
6147                         blinded_ref = tag_ptr(blinded_var.inner, false);
6148         return blinded_ref;
6149 }
6150 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_data(int64_t ptr) {
6151         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6152         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6153         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
6154                         int64_t payment_data_ref = 0;
6155                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6156                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6157         return payment_data_ref;
6158 }
6159 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_metadata(int64_t ptr) {
6160         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6161         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6162         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
6163         return payment_metadata_ref;
6164 }
6165 int32_t CS_LDK_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(int64_t ptr) {
6166         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6167         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6168         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
6169         return incoming_cltv_expiry_conv;
6170 }
6171 int8_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(int64_t ptr) {
6172         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6173         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6174         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
6175         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
6176         return phantom_shared_secret_arr;
6177 }
6178 int64_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_custom_tlvs(int64_t ptr) {
6179         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6180         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6181         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
6182                         int64_tArray custom_tlvs_arr = NULL;
6183                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6184                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6185                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6186                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6187                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6188                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6189                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6190                         }
6191                         
6192         return custom_tlvs_arr;
6193 }
6194 jboolean CS_LDK_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(int64_t ptr) {
6195         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6196         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6197         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
6198         return requires_blinded_error_conv;
6199 }
6200 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(int64_t ptr) {
6201         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6202         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6203         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
6204                         int64_t payment_data_ref = 0;
6205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6206                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6207         return payment_data_ref;
6208 }
6209 int8_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(int64_t ptr) {
6210         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6211         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6212         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6213         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
6214         return payment_preimage_arr;
6215 }
6216 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(int64_t ptr) {
6217         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6218         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6219         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
6220         return payment_metadata_ref;
6221 }
6222 int32_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(int64_t ptr) {
6223         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6224         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6225         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
6226         return incoming_cltv_expiry_conv;
6227 }
6228 int64_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(int64_t ptr) {
6229         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6230         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6231         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
6232                         int64_tArray custom_tlvs_arr = NULL;
6233                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6234                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6235                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6236                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6237                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6238                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6239                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6240                         }
6241                         
6242         return custom_tlvs_arr;
6243 }
6244 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6245 CHECK(owner->result_ok);
6246         return PendingHTLCRouting_clone(&*owner->contents.result);
6247 }
6248 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(int64_t owner) {
6249         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6250         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
6251         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
6252         int64_t ret_ref = tag_ptr(ret_copy, true);
6253         return ret_ref;
6254 }
6255
6256 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6257 CHECK(!owner->result_ok);
6258         return DecodeError_clone(&*owner->contents.err);
6259 }
6260 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(int64_t owner) {
6261         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6263         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
6264         int64_t ret_ref = tag_ptr(ret_copy, true);
6265         return ret_ref;
6266 }
6267
6268 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6269         LDKPendingHTLCInfo ret = *owner->contents.result;
6270         ret.is_owned = false;
6271         return ret;
6272 }
6273 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(int64_t owner) {
6274         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6275         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
6276         int64_t ret_ref = 0;
6277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6279         return ret_ref;
6280 }
6281
6282 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6283 CHECK(!owner->result_ok);
6284         return DecodeError_clone(&*owner->contents.err);
6285 }
6286 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_err(int64_t owner) {
6287         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6289         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
6290         int64_t ret_ref = tag_ptr(ret_copy, true);
6291         return ret_ref;
6292 }
6293
6294 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6295 CHECK(owner->result_ok);
6296         return BlindedFailure_clone(&*owner->contents.result);
6297 }
6298 int32_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_ok(int64_t owner) {
6299         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6300         int32_t ret_conv = LDKBlindedFailure_to_cs(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
6301         return ret_conv;
6302 }
6303
6304 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6305 CHECK(!owner->result_ok);
6306         return DecodeError_clone(&*owner->contents.err);
6307 }
6308 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_err(int64_t owner) {
6309         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6310         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6311         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
6312         int64_t ret_ref = tag_ptr(ret_copy, true);
6313         return ret_ref;
6314 }
6315
6316 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6317 CHECK(owner->result_ok);
6318         return ChannelShutdownState_clone(&*owner->contents.result);
6319 }
6320 int32_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(int64_t owner) {
6321         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6322         int32_t ret_conv = LDKChannelShutdownState_to_cs(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
6323         return ret_conv;
6324 }
6325
6326 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6327 CHECK(!owner->result_ok);
6328         return DecodeError_clone(&*owner->contents.err);
6329 }
6330 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_err(int64_t owner) {
6331         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6332         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6333         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
6334         int64_t ret_ref = tag_ptr(ret_copy, true);
6335         return ret_ref;
6336 }
6337
6338 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6339         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6340         for (size_t i = 0; i < ret.datalen; i++) {
6341                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6342         }
6343         return ret;
6344 }
6345 typedef struct LDKWatch_JCalls {
6346         atomic_size_t refcnt;
6347         uint32_t instance_ptr;
6348 } LDKWatch_JCalls;
6349 static void LDKWatch_JCalls_free(void* this_arg) {
6350         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6351         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6352                 FREE(j_calls);
6353         }
6354 }
6355 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6356         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6357         LDKOutPoint funding_txo_var = funding_txo;
6358         int64_t funding_txo_ref = 0;
6359         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6360         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6361         LDKChannelMonitor monitor_var = monitor;
6362         int64_t monitor_ref = 0;
6363         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6364         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6365         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 27, funding_txo_ref, monitor_ref);
6366         void* ret_ptr = untag_ptr(ret);
6367         CHECK_ACCESS(ret_ptr);
6368         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
6369         FREE(untag_ptr(ret));
6370         return ret_conv;
6371 }
6372 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6373         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6374         LDKOutPoint funding_txo_var = funding_txo;
6375         int64_t funding_txo_ref = 0;
6376         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6377         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6378         LDKChannelMonitorUpdate update_var = *update;
6379         int64_t update_ref = 0;
6380         update_var = ChannelMonitorUpdate_clone(&update_var);
6381         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6382         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6383         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_ll(j_calls->instance_ptr, 28, funding_txo_ref, update_ref);
6384         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
6385         return ret_conv;
6386 }
6387 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6388         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6389         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 29);
6390         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6391         ret_constr.datalen = ret->arr_len;
6392         if (ret_constr.datalen > 0)
6393                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6394         else
6395                 ret_constr.data = NULL;
6396         int64_t* ret_vals = ret->elems;
6397         for (size_t x = 0; x < ret_constr.datalen; x++) {
6398                 int64_t ret_conv_49 = ret_vals[x];
6399                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6400                 CHECK_ACCESS(ret_conv_49_ptr);
6401                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6402                 FREE(untag_ptr(ret_conv_49));
6403                 ret_constr.data[x] = ret_conv_49_conv;
6404         }
6405         FREE(ret);
6406         return ret_constr;
6407 }
6408 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6409         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6410         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6411 }
6412 static inline LDKWatch LDKWatch_init (int64_t o) {
6413         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6414         atomic_init(&calls->refcnt, 1);
6415         calls->instance_ptr = o;
6416
6417         LDKWatch ret = {
6418                 .this_arg = (void*) calls,
6419                 .watch_channel = watch_channel_LDKWatch_jcall,
6420                 .update_channel = update_channel_LDKWatch_jcall,
6421                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6422                 .free = LDKWatch_JCalls_free,
6423         };
6424         return ret;
6425 }
6426 uint64_t  CS_LDK_LDKWatch_new(int32_t o) {
6427         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6428         *res_ptr = LDKWatch_init(o);
6429         return tag_ptr(res_ptr, true);
6430 }
6431 int64_t  CS_LDK_Watch_watch_channel(int64_t this_arg, int64_t funding_txo, int64_t monitor) {
6432         void* this_arg_ptr = untag_ptr(this_arg);
6433         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6434         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6435         LDKOutPoint funding_txo_conv;
6436         funding_txo_conv.inner = untag_ptr(funding_txo);
6437         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6438         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6439         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6440         LDKChannelMonitor monitor_conv;
6441         monitor_conv.inner = untag_ptr(monitor);
6442         monitor_conv.is_owned = ptr_is_owned(monitor);
6443         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6444         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6445         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
6446         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6447         return tag_ptr(ret_conv, true);
6448 }
6449
6450 int32_t  CS_LDK_Watch_update_channel(int64_t this_arg, int64_t funding_txo, int64_t update) {
6451         void* this_arg_ptr = untag_ptr(this_arg);
6452         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6453         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6454         LDKOutPoint funding_txo_conv;
6455         funding_txo_conv.inner = untag_ptr(funding_txo);
6456         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6457         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6458         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6459         LDKChannelMonitorUpdate update_conv;
6460         update_conv.inner = untag_ptr(update);
6461         update_conv.is_owned = ptr_is_owned(update);
6462         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6463         update_conv.is_owned = false;
6464         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6465         return ret_conv;
6466 }
6467
6468 int64_tArray  CS_LDK_Watch_release_pending_monitor_events(int64_t this_arg) {
6469         void* this_arg_ptr = untag_ptr(this_arg);
6470         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6471         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6472         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6473         int64_tArray ret_arr = NULL;
6474         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
6475         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
6476         for (size_t x = 0; x < ret_var.datalen; x++) {
6477                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6478                 *ret_conv_49_conv = ret_var.data[x];
6479                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6480         }
6481         
6482         FREE(ret_var.data);
6483         return ret_arr;
6484 }
6485
6486 typedef struct LDKBroadcasterInterface_JCalls {
6487         atomic_size_t refcnt;
6488         uint32_t instance_ptr;
6489 } LDKBroadcasterInterface_JCalls;
6490 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6491         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6492         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6493                 FREE(j_calls);
6494         }
6495 }
6496 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6497         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6498         LDKCVec_TransactionZ txs_var = txs;
6499         ptrArray txs_arr = NULL;
6500         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6501         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6502         for (size_t i = 0; i < txs_var.datalen; i++) {
6503                 LDKTransaction txs_conv_8_var = txs_var.data[i];
6504                 int8_tArray txs_conv_8_arr = init_int8_tArray(txs_conv_8_var.datalen, __LINE__);
6505                 memcpy(txs_conv_8_arr->elems, txs_conv_8_var.data, txs_conv_8_var.datalen);
6506                 Transaction_free(txs_conv_8_var);
6507                 txs_arr_ptr[i] = txs_conv_8_arr;
6508         }
6509         
6510         FREE(txs_var.data);
6511         js_invoke_function_void_l(j_calls->instance_ptr, 30, (int64_t)txs_arr);
6512 }
6513 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6514         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6515         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6516 }
6517 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (int64_t o) {
6518         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6519         atomic_init(&calls->refcnt, 1);
6520         calls->instance_ptr = o;
6521
6522         LDKBroadcasterInterface ret = {
6523                 .this_arg = (void*) calls,
6524                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
6525                 .free = LDKBroadcasterInterface_JCalls_free,
6526         };
6527         return ret;
6528 }
6529 uint64_t  CS_LDK_LDKBroadcasterInterface_new(int32_t o) {
6530         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6531         *res_ptr = LDKBroadcasterInterface_init(o);
6532         return tag_ptr(res_ptr, true);
6533 }
6534 void  CS_LDK_BroadcasterInterface_broadcast_transactions(int64_t this_arg, ptrArray txs) {
6535         void* this_arg_ptr = untag_ptr(this_arg);
6536         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6537         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6538         LDKCVec_TransactionZ txs_constr;
6539         txs_constr.datalen = txs->arr_len;
6540         if (txs_constr.datalen > 0)
6541                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6542         else
6543                 txs_constr.data = NULL;
6544         int8_tArray* txs_vals = (void*) txs->elems;
6545         for (size_t i = 0; i < txs_constr.datalen; i++) {
6546                 int8_tArray txs_conv_8 = txs_vals[i];
6547                 LDKTransaction txs_conv_8_ref;
6548                 txs_conv_8_ref.datalen = txs_conv_8->arr_len;
6549                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
6550                 memcpy(txs_conv_8_ref.data, txs_conv_8->elems, txs_conv_8_ref.datalen); FREE(txs_conv_8);
6551                 txs_conv_8_ref.data_is_owned = true;
6552                 txs_constr.data[i] = txs_conv_8_ref;
6553         }
6554         FREE(txs);
6555         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
6556 }
6557
6558 typedef struct LDKEntropySource_JCalls {
6559         atomic_size_t refcnt;
6560         uint32_t instance_ptr;
6561 } LDKEntropySource_JCalls;
6562 static void LDKEntropySource_JCalls_free(void* this_arg) {
6563         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6564         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6565                 FREE(j_calls);
6566         }
6567 }
6568 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
6569         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6570         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 31);
6571         LDKThirtyTwoBytes ret_ref;
6572         CHECK(ret->arr_len == 32);
6573         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6574         return ret_ref;
6575 }
6576 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
6577         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
6578         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6579 }
6580 static inline LDKEntropySource LDKEntropySource_init (int64_t o) {
6581         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
6582         atomic_init(&calls->refcnt, 1);
6583         calls->instance_ptr = o;
6584
6585         LDKEntropySource ret = {
6586                 .this_arg = (void*) calls,
6587                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
6588                 .free = LDKEntropySource_JCalls_free,
6589         };
6590         return ret;
6591 }
6592 uint64_t  CS_LDK_LDKEntropySource_new(int32_t o) {
6593         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
6594         *res_ptr = LDKEntropySource_init(o);
6595         return tag_ptr(res_ptr, true);
6596 }
6597 int8_tArray  CS_LDK_EntropySource_get_secure_random_bytes(int64_t this_arg) {
6598         void* this_arg_ptr = untag_ptr(this_arg);
6599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6600         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
6601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6602         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6603         return ret_arr;
6604 }
6605
6606 uint32_t CS_LDK_LDKUnsignedGossipMessage_ty_from_ptr(int64_t ptr) {
6607         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6608         switch(obj->tag) {
6609                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
6610                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
6611                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
6612                 default: abort();
6613         }
6614 }
6615 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(int64_t ptr) {
6616         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6617         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
6618         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
6619                         int64_t channel_announcement_ref = 0;
6620                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
6621                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
6622         return channel_announcement_ref;
6623 }
6624 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(int64_t ptr) {
6625         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6626         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
6627         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
6628                         int64_t channel_update_ref = 0;
6629                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
6630                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
6631         return channel_update_ref;
6632 }
6633 int64_t CS_LDK_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(int64_t ptr) {
6634         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6635         CHECK(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
6636         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
6637                         int64_t node_announcement_ref = 0;
6638                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
6639                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
6640         return node_announcement_ref;
6641 }
6642 typedef struct LDKNodeSigner_JCalls {
6643         atomic_size_t refcnt;
6644         uint32_t instance_ptr;
6645 } LDKNodeSigner_JCalls;
6646 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6647         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6648         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6649                 FREE(j_calls);
6650         }
6651 }
6652 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6653         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6654         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 32);
6655         LDKThirtyTwoBytes ret_ref;
6656         CHECK(ret->arr_len == 32);
6657         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6658         return ret_ref;
6659 }
6660 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6661         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6662         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
6663         uint64_t ret = js_invoke_function_l_Recipient(j_calls->instance_ptr, 33, recipient_conv);
6664         void* ret_ptr = untag_ptr(ret);
6665         CHECK_ACCESS(ret_ptr);
6666         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6667         FREE(untag_ptr(ret));
6668         return ret_conv;
6669 }
6670 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
6671         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6672         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
6673         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6674         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6675         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
6676         *tweak_copy = tweak;
6677         int64_t tweak_ref = tag_ptr(tweak_copy, true);
6678         uint64_t ret = js_invoke_function_l_Recipientll(j_calls->instance_ptr, 34, recipient_conv, (int64_t)other_key_arr, tweak_ref);
6679         void* ret_ptr = untag_ptr(ret);
6680         CHECK_ACCESS(ret_ptr);
6681         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
6682         FREE(untag_ptr(ret));
6683         return ret_conv;
6684 }
6685 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6686         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6687         LDKu8slice hrp_bytes_var = hrp_bytes;
6688         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6689         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6690         LDKCVec_U5Z invoice_data_var = invoice_data;
6691         ptrArray invoice_data_arr = NULL;
6692         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6693         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6694         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6695                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6696                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6697         }
6698         
6699         FREE(invoice_data_var.data);
6700         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
6701         uint64_t ret = js_invoke_function_l_llRecipient(j_calls->instance_ptr, 35, (int64_t)hrp_bytes_arr, (int64_t)invoice_data_arr, recipient_conv);
6702         void* ret_ptr = untag_ptr(ret);
6703         CHECK_ACCESS(ret_ptr);
6704         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6705         FREE(untag_ptr(ret));
6706         return ret_conv;
6707 }
6708 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
6709         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6710         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
6711         int64_t invoice_request_ref = 0;
6712         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
6713         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6714         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
6715         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 36, invoice_request_ref);
6716         void* ret_ptr = untag_ptr(ret);
6717         CHECK_ACCESS(ret_ptr);
6718         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6719         FREE(untag_ptr(ret));
6720         return ret_conv;
6721 }
6722 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
6723         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6724         LDKUnsignedBolt12Invoice invoice_var = *invoice;
6725         int64_t invoice_ref = 0;
6726         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
6727         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6728         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
6729         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 37, invoice_ref);
6730         void* ret_ptr = untag_ptr(ret);
6731         CHECK_ACCESS(ret_ptr);
6732         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6733         FREE(untag_ptr(ret));
6734         return ret_conv;
6735 }
6736 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6737         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6738         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6739         *msg_copy = msg;
6740         int64_t msg_ref = tag_ptr(msg_copy, true);
6741         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 38, msg_ref);
6742         void* ret_ptr = untag_ptr(ret);
6743         CHECK_ACCESS(ret_ptr);
6744         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
6745         FREE(untag_ptr(ret));
6746         return ret_conv;
6747 }
6748 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6749         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6750         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6751 }
6752 static inline LDKNodeSigner LDKNodeSigner_init (int64_t o) {
6753         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6754         atomic_init(&calls->refcnt, 1);
6755         calls->instance_ptr = o;
6756
6757         LDKNodeSigner ret = {
6758                 .this_arg = (void*) calls,
6759                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6760                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6761                 .ecdh = ecdh_LDKNodeSigner_jcall,
6762                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6763                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
6764                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
6765                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6766                 .free = LDKNodeSigner_JCalls_free,
6767         };
6768         return ret;
6769 }
6770 uint64_t  CS_LDK_LDKNodeSigner_new(int32_t o) {
6771         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6772         *res_ptr = LDKNodeSigner_init(o);
6773         return tag_ptr(res_ptr, true);
6774 }
6775 int8_tArray  CS_LDK_NodeSigner_get_inbound_payment_key_material(int64_t this_arg) {
6776         void* this_arg_ptr = untag_ptr(this_arg);
6777         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6778         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6779         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6780         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6781         return ret_arr;
6782 }
6783
6784 int64_t  CS_LDK_NodeSigner_get_node_id(int64_t this_arg, int32_t recipient) {
6785         void* this_arg_ptr = untag_ptr(this_arg);
6786         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6787         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6788         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
6789         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6790         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6791         return tag_ptr(ret_conv, true);
6792 }
6793
6794 int64_t  CS_LDK_NodeSigner_ecdh(int64_t this_arg, int32_t recipient, int8_tArray other_key, int64_t tweak) {
6795         void* this_arg_ptr = untag_ptr(this_arg);
6796         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6797         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6798         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
6799         LDKPublicKey other_key_ref;
6800         CHECK(other_key->arr_len == 33);
6801         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6802         void* tweak_ptr = untag_ptr(tweak);
6803         CHECK_ACCESS(tweak_ptr);
6804         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
6805         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
6806         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
6807         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6808         return tag_ptr(ret_conv, true);
6809 }
6810
6811 int64_t  CS_LDK_NodeSigner_sign_invoice(int64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, int32_t recipient) {
6812         void* this_arg_ptr = untag_ptr(this_arg);
6813         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6814         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6815         LDKu8slice hrp_bytes_ref;
6816         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6817         hrp_bytes_ref.data = hrp_bytes->elems;
6818         LDKCVec_U5Z invoice_data_constr;
6819         invoice_data_constr.datalen = invoice_data->arr_len;
6820         if (invoice_data_constr.datalen > 0)
6821                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6822         else
6823                 invoice_data_constr.data = NULL;
6824         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6825         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6826                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6827                 
6828                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6829         }
6830         FREE(invoice_data);
6831         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
6832         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6833         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6834         FREE(hrp_bytes);
6835         return tag_ptr(ret_conv, true);
6836 }
6837
6838 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice_request(int64_t this_arg, int64_t invoice_request) {
6839         void* this_arg_ptr = untag_ptr(this_arg);
6840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6841         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6842         LDKUnsignedInvoiceRequest invoice_request_conv;
6843         invoice_request_conv.inner = untag_ptr(invoice_request);
6844         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
6845         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
6846         invoice_request_conv.is_owned = false;
6847         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6848         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
6849         return tag_ptr(ret_conv, true);
6850 }
6851
6852 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice(int64_t this_arg, int64_t invoice) {
6853         void* this_arg_ptr = untag_ptr(this_arg);
6854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6855         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6856         LDKUnsignedBolt12Invoice invoice_conv;
6857         invoice_conv.inner = untag_ptr(invoice);
6858         invoice_conv.is_owned = ptr_is_owned(invoice);
6859         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
6860         invoice_conv.is_owned = false;
6861         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6862         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
6863         return tag_ptr(ret_conv, true);
6864 }
6865
6866 int64_t  CS_LDK_NodeSigner_sign_gossip_message(int64_t this_arg, int64_t msg) {
6867         void* this_arg_ptr = untag_ptr(this_arg);
6868         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6869         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6870         void* msg_ptr = untag_ptr(msg);
6871         CHECK_ACCESS(msg_ptr);
6872         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6873         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6874         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
6875         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6876         return tag_ptr(ret_conv, true);
6877 }
6878
6879 typedef struct LDKSignerProvider_JCalls {
6880         atomic_size_t refcnt;
6881         uint32_t instance_ptr;
6882 } LDKSignerProvider_JCalls;
6883 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6884         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6885         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6886                 FREE(j_calls);
6887         }
6888 }
6889 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6890         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6891         jboolean inbound_conv = inbound;
6892         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6893         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6894         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6895         int8_tArray ret = (int8_tArray)js_invoke_function_l_bll(j_calls->instance_ptr, 39, inbound_conv, channel_value_satoshis_conv, (int64_t)user_channel_id_arr);
6896         LDKThirtyTwoBytes ret_ref;
6897         CHECK(ret->arr_len == 32);
6898         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6899         return ret_ref;
6900 }
6901 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6902         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6903         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6904         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6905         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6906         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 40, channel_value_satoshis_conv, (int64_t)channel_keys_id_arr);
6907         void* ret_ptr = untag_ptr(ret);
6908         CHECK_ACCESS(ret_ptr);
6909         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6910         FREE(untag_ptr(ret));
6911         return ret_conv;
6912 }
6913 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6914         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6915         LDKu8slice reader_var = reader;
6916         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6917         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6918         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 41, (int64_t)reader_arr);
6919         void* ret_ptr = untag_ptr(ret);
6920         CHECK_ACCESS(ret_ptr);
6921         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6922         FREE(untag_ptr(ret));
6923         return ret_conv;
6924 }
6925 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
6926         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6927         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6928         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6929         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 42, (int64_t)channel_keys_id_arr);
6930         void* ret_ptr = untag_ptr(ret);
6931         CHECK_ACCESS(ret_ptr);
6932         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
6933         FREE(untag_ptr(ret));
6934         return ret_conv;
6935 }
6936 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6937         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6938         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 43);
6939         void* ret_ptr = untag_ptr(ret);
6940         CHECK_ACCESS(ret_ptr);
6941         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6942         FREE(untag_ptr(ret));
6943         return ret_conv;
6944 }
6945 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6946         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6947         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6948 }
6949 static inline LDKSignerProvider LDKSignerProvider_init (int64_t o) {
6950         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6951         atomic_init(&calls->refcnt, 1);
6952         calls->instance_ptr = o;
6953
6954         LDKSignerProvider ret = {
6955                 .this_arg = (void*) calls,
6956                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6957                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6958                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6959                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6960                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6961                 .free = LDKSignerProvider_JCalls_free,
6962         };
6963         return ret;
6964 }
6965 uint64_t  CS_LDK_LDKSignerProvider_new(int32_t o) {
6966         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6967         *res_ptr = LDKSignerProvider_init(o);
6968         return tag_ptr(res_ptr, true);
6969 }
6970 int8_tArray  CS_LDK_SignerProvider_generate_channel_keys_id(int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) {
6971         void* this_arg_ptr = untag_ptr(this_arg);
6972         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6973         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6974         LDKU128 user_channel_id_ref;
6975         CHECK(user_channel_id->arr_len == 16);
6976         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6977         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6978         memcpy(ret_arr->elems, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data, 32);
6979         return ret_arr;
6980 }
6981
6982 int64_t  CS_LDK_SignerProvider_derive_channel_signer(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
6983         void* this_arg_ptr = untag_ptr(this_arg);
6984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6985         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6986         LDKThirtyTwoBytes channel_keys_id_ref;
6987         CHECK(channel_keys_id->arr_len == 32);
6988         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6989         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6990         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6991         return tag_ptr(ret_ret, true);
6992 }
6993
6994 int64_t  CS_LDK_SignerProvider_read_chan_signer(int64_t this_arg, int8_tArray reader) {
6995         void* this_arg_ptr = untag_ptr(this_arg);
6996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6997         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6998         LDKu8slice reader_ref;
6999         reader_ref.datalen = reader->arr_len;
7000         reader_ref.data = reader->elems;
7001         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
7002         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7003         FREE(reader);
7004         return tag_ptr(ret_conv, true);
7005 }
7006
7007 int64_t  CS_LDK_SignerProvider_get_destination_script(int64_t this_arg, int8_tArray channel_keys_id) {
7008         void* this_arg_ptr = untag_ptr(this_arg);
7009         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7010         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7011         LDKThirtyTwoBytes channel_keys_id_ref;
7012         CHECK(channel_keys_id->arr_len == 32);
7013         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7014         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
7015         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
7016         return tag_ptr(ret_conv, true);
7017 }
7018
7019 int64_t  CS_LDK_SignerProvider_get_shutdown_scriptpubkey(int64_t this_arg) {
7020         void* this_arg_ptr = untag_ptr(this_arg);
7021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7022         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7023         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
7024         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7025         return tag_ptr(ret_conv, true);
7026 }
7027
7028 typedef struct LDKFeeEstimator_JCalls {
7029         atomic_size_t refcnt;
7030         uint32_t instance_ptr;
7031 } LDKFeeEstimator_JCalls;
7032 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7033         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7034         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7035                 FREE(j_calls);
7036         }
7037 }
7038 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7039         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7040         int32_t confirmation_target_conv = LDKConfirmationTarget_to_cs(confirmation_target);
7041         return js_invoke_function_i_ConfirmationTarget(j_calls->instance_ptr, 44, confirmation_target_conv);
7042 }
7043 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7044         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7045         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7046 }
7047 static inline LDKFeeEstimator LDKFeeEstimator_init (int64_t o) {
7048         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7049         atomic_init(&calls->refcnt, 1);
7050         calls->instance_ptr = o;
7051
7052         LDKFeeEstimator ret = {
7053                 .this_arg = (void*) calls,
7054                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7055                 .free = LDKFeeEstimator_JCalls_free,
7056         };
7057         return ret;
7058 }
7059 uint64_t  CS_LDK_LDKFeeEstimator_new(int32_t o) {
7060         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7061         *res_ptr = LDKFeeEstimator_init(o);
7062         return tag_ptr(res_ptr, true);
7063 }
7064 int32_t  CS_LDK_FeeEstimator_get_est_sat_per_1000_weight(int64_t this_arg, int32_t confirmation_target) {
7065         void* this_arg_ptr = untag_ptr(this_arg);
7066         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7067         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7068         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_cs(confirmation_target);
7069         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7070         return ret_conv;
7071 }
7072
7073 typedef struct LDKMessageRouter_JCalls {
7074         atomic_size_t refcnt;
7075         uint32_t instance_ptr;
7076 } LDKMessageRouter_JCalls;
7077 static void LDKMessageRouter_JCalls_free(void* this_arg) {
7078         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7079         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7080                 FREE(j_calls);
7081         }
7082 }
7083 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
7084         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7085         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
7086         memcpy(sender_arr->elems, sender.compressed_form, 33);
7087         LDKCVec_PublicKeyZ peers_var = peers;
7088         ptrArray peers_arr = NULL;
7089         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7090         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7091         for (size_t i = 0; i < peers_var.datalen; i++) {
7092                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7093                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7094                 peers_arr_ptr[i] = peers_conv_8_arr;
7095         }
7096         
7097         FREE(peers_var.data);
7098         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7099         *destination_copy = destination;
7100         int64_t destination_ref = tag_ptr(destination_copy, true);
7101         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 45, (int64_t)sender_arr, (int64_t)peers_arr, destination_ref);
7102         void* ret_ptr = untag_ptr(ret);
7103         CHECK_ACCESS(ret_ptr);
7104         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
7105         FREE(untag_ptr(ret));
7106         return ret_conv;
7107 }
7108 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
7109         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7110         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7111         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7112         LDKCVec_PublicKeyZ peers_var = peers;
7113         ptrArray peers_arr = NULL;
7114         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7115         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7116         for (size_t i = 0; i < peers_var.datalen; i++) {
7117                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7118                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7119                 peers_arr_ptr[i] = peers_conv_8_arr;
7120         }
7121         
7122         FREE(peers_var.data);
7123         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 46, (int64_t)recipient_arr, (int64_t)peers_arr);
7124         void* ret_ptr = untag_ptr(ret);
7125         CHECK_ACCESS(ret_ptr);
7126         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
7127         FREE(untag_ptr(ret));
7128         return ret_conv;
7129 }
7130 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
7131         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
7132         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7133 }
7134 static inline LDKMessageRouter LDKMessageRouter_init (int64_t o) {
7135         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
7136         atomic_init(&calls->refcnt, 1);
7137         calls->instance_ptr = o;
7138
7139         LDKMessageRouter ret = {
7140                 .this_arg = (void*) calls,
7141                 .find_path = find_path_LDKMessageRouter_jcall,
7142                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
7143                 .free = LDKMessageRouter_JCalls_free,
7144         };
7145         return ret;
7146 }
7147 uint64_t  CS_LDK_LDKMessageRouter_new(int32_t o) {
7148         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
7149         *res_ptr = LDKMessageRouter_init(o);
7150         return tag_ptr(res_ptr, true);
7151 }
7152 int64_t  CS_LDK_MessageRouter_find_path(int64_t this_arg, int8_tArray sender, ptrArray peers, int64_t destination) {
7153         void* this_arg_ptr = untag_ptr(this_arg);
7154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7155         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7156         LDKPublicKey sender_ref;
7157         CHECK(sender->arr_len == 33);
7158         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
7159         LDKCVec_PublicKeyZ peers_constr;
7160         peers_constr.datalen = peers->arr_len;
7161         if (peers_constr.datalen > 0)
7162                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7163         else
7164                 peers_constr.data = NULL;
7165         int8_tArray* peers_vals = (void*) peers->elems;
7166         for (size_t i = 0; i < peers_constr.datalen; i++) {
7167                 int8_tArray peers_conv_8 = peers_vals[i];
7168                 LDKPublicKey peers_conv_8_ref;
7169                 CHECK(peers_conv_8->arr_len == 33);
7170                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7171                 peers_constr.data[i] = peers_conv_8_ref;
7172         }
7173         FREE(peers);
7174         void* destination_ptr = untag_ptr(destination);
7175         CHECK_ACCESS(destination_ptr);
7176         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
7177         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
7178         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
7179         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
7180         return tag_ptr(ret_conv, true);
7181 }
7182
7183 int64_t  CS_LDK_MessageRouter_create_blinded_paths(int64_t this_arg, int8_tArray recipient, ptrArray peers) {
7184         void* this_arg_ptr = untag_ptr(this_arg);
7185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7186         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7187         LDKPublicKey recipient_ref;
7188         CHECK(recipient->arr_len == 33);
7189         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7190         LDKCVec_PublicKeyZ peers_constr;
7191         peers_constr.datalen = peers->arr_len;
7192         if (peers_constr.datalen > 0)
7193                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7194         else
7195                 peers_constr.data = NULL;
7196         int8_tArray* peers_vals = (void*) peers->elems;
7197         for (size_t i = 0; i < peers_constr.datalen; i++) {
7198                 int8_tArray peers_conv_8 = peers_vals[i];
7199                 LDKPublicKey peers_conv_8_ref;
7200                 CHECK(peers_conv_8->arr_len == 33);
7201                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7202                 peers_constr.data[i] = peers_conv_8_ref;
7203         }
7204         FREE(peers);
7205         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
7206         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
7207         return tag_ptr(ret_conv, true);
7208 }
7209
7210 typedef struct LDKRouter_JCalls {
7211         atomic_size_t refcnt;
7212         uint32_t instance_ptr;
7213         LDKMessageRouter_JCalls* MessageRouter;
7214 } LDKRouter_JCalls;
7215 static void LDKRouter_JCalls_free(void* this_arg) {
7216         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7217         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7218                 FREE(j_calls);
7219         }
7220 }
7221 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7222         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7223         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7224         memcpy(payer_arr->elems, payer.compressed_form, 33);
7225         LDKRouteParameters route_params_var = *route_params;
7226         int64_t route_params_ref = 0;
7227         route_params_var = RouteParameters_clone(&route_params_var);
7228         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7229         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7230         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7231         int64_tArray first_hops_arr = NULL;
7232         if (first_hops != NULL) {
7233                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7234                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7235                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7236                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7237                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7238                         int64_t first_hops_conv_16_ref = 0;
7239                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7240                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7241                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7242                 }
7243         
7244         }
7245         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7246         int64_t inflight_htlcs_ref = 0;
7247         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7248         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7249         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 47, (int64_t)payer_arr, route_params_ref, (int64_t)first_hops_arr, inflight_htlcs_ref);
7250         void* ret_ptr = untag_ptr(ret);
7251         CHECK_ACCESS(ret_ptr);
7252         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7253         FREE(untag_ptr(ret));
7254         return ret_conv;
7255 }
7256 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
7257         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7258         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7259         memcpy(payer_arr->elems, payer.compressed_form, 33);
7260         LDKRouteParameters route_params_var = *route_params;
7261         int64_t route_params_ref = 0;
7262         route_params_var = RouteParameters_clone(&route_params_var);
7263         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7264         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7265         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7266         int64_tArray first_hops_arr = NULL;
7267         if (first_hops != NULL) {
7268                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7269                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7270                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7271                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7272                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7273                         int64_t first_hops_conv_16_ref = 0;
7274                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7275                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7276                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7277                 }
7278         
7279         }
7280         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7281         int64_t inflight_htlcs_ref = 0;
7282         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7283         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7284         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7285         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7286         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7287         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7288         uint64_t ret = js_invoke_function_l_llllll(j_calls->instance_ptr, 48, (int64_t)payer_arr, route_params_ref, (int64_t)first_hops_arr, inflight_htlcs_ref, (int64_t)_payment_hash_arr, (int64_t)_payment_id_arr);
7289         void* ret_ptr = untag_ptr(ret);
7290         CHECK_ACCESS(ret_ptr);
7291         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7292         FREE(untag_ptr(ret));
7293         return ret_conv;
7294 }
7295 LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ create_blinded_payment_paths_LDKRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_ChannelDetailsZ first_hops, LDKReceiveTlvs tlvs, uint64_t amount_msats) {
7296         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7297         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7298         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7299         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
7300         int64_tArray first_hops_arr = NULL;
7301         first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7302         int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7303         for (size_t q = 0; q < first_hops_var.datalen; q++) {
7304                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7305                 int64_t first_hops_conv_16_ref = 0;
7306                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7307                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7308                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7309         }
7310         
7311         FREE(first_hops_var.data);
7312         LDKReceiveTlvs tlvs_var = tlvs;
7313         int64_t tlvs_ref = 0;
7314         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
7315         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
7316         int64_t amount_msats_conv = amount_msats;
7317         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 49, (int64_t)recipient_arr, (int64_t)first_hops_arr, tlvs_ref, amount_msats_conv);
7318         void* ret_ptr = untag_ptr(ret);
7319         CHECK_ACCESS(ret_ptr);
7320         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
7321         FREE(untag_ptr(ret));
7322         return ret_conv;
7323 }
7324 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7325         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7326         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7327         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
7328 }
7329 static inline LDKRouter LDKRouter_init (int64_t o, int64_t MessageRouter) {
7330         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7331         atomic_init(&calls->refcnt, 1);
7332         calls->instance_ptr = o;
7333
7334         LDKRouter ret = {
7335                 .this_arg = (void*) calls,
7336                 .find_route = find_route_LDKRouter_jcall,
7337                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7338                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
7339                 .free = LDKRouter_JCalls_free,
7340                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
7341         };
7342         calls->MessageRouter = ret.MessageRouter.this_arg;
7343         return ret;
7344 }
7345 uint64_t  CS_LDK_LDKRouter_new(int32_t o, int32_t MessageRouter) {
7346         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7347         *res_ptr = LDKRouter_init(o, MessageRouter);
7348         return tag_ptr(res_ptr, true);
7349 }
7350 int64_t  CS_LDK_Router_find_route(int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) {
7351         void* this_arg_ptr = untag_ptr(this_arg);
7352         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7353         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7354         LDKPublicKey payer_ref;
7355         CHECK(payer->arr_len == 33);
7356         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7357         LDKRouteParameters route_params_conv;
7358         route_params_conv.inner = untag_ptr(route_params);
7359         route_params_conv.is_owned = ptr_is_owned(route_params);
7360         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7361         route_params_conv.is_owned = false;
7362         LDKCVec_ChannelDetailsZ first_hops_constr;
7363         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7364         if (first_hops != NULL) {
7365                 first_hops_constr.datalen = first_hops->arr_len;
7366                 if (first_hops_constr.datalen > 0)
7367                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7368                 else
7369                         first_hops_constr.data = NULL;
7370                 int64_t* first_hops_vals = first_hops->elems;
7371                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7372                         int64_t first_hops_conv_16 = first_hops_vals[q];
7373                         LDKChannelDetails first_hops_conv_16_conv;
7374                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7375                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7377                         first_hops_conv_16_conv.is_owned = false;
7378                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7379                 }
7380                 FREE(first_hops);
7381                 first_hops_ptr = &first_hops_constr;
7382         }
7383         LDKInFlightHtlcs inflight_htlcs_conv;
7384         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7385         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7386         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7387         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7388         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7389         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7390         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7391         return tag_ptr(ret_conv, true);
7392 }
7393
7394 int64_t  CS_LDK_Router_find_route_with_id(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) {
7395         void* this_arg_ptr = untag_ptr(this_arg);
7396         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7397         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7398         LDKPublicKey payer_ref;
7399         CHECK(payer->arr_len == 33);
7400         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7401         LDKRouteParameters route_params_conv;
7402         route_params_conv.inner = untag_ptr(route_params);
7403         route_params_conv.is_owned = ptr_is_owned(route_params);
7404         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7405         route_params_conv.is_owned = false;
7406         LDKCVec_ChannelDetailsZ first_hops_constr;
7407         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7408         if (first_hops != NULL) {
7409                 first_hops_constr.datalen = first_hops->arr_len;
7410                 if (first_hops_constr.datalen > 0)
7411                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7412                 else
7413                         first_hops_constr.data = NULL;
7414                 int64_t* first_hops_vals = first_hops->elems;
7415                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7416                         int64_t first_hops_conv_16 = first_hops_vals[q];
7417                         LDKChannelDetails first_hops_conv_16_conv;
7418                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7419                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7420                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7421                         first_hops_conv_16_conv.is_owned = false;
7422                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7423                 }
7424                 FREE(first_hops);
7425                 first_hops_ptr = &first_hops_constr;
7426         }
7427         LDKInFlightHtlcs inflight_htlcs_conv;
7428         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7429         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7430         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7431         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7432         LDKThirtyTwoBytes _payment_hash_ref;
7433         CHECK(_payment_hash->arr_len == 32);
7434         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7435         LDKThirtyTwoBytes _payment_id_ref;
7436         CHECK(_payment_id->arr_len == 32);
7437         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7438         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7439         *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);
7440         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7441         return tag_ptr(ret_conv, true);
7442 }
7443
7444 int64_t  CS_LDK_Router_create_blinded_payment_paths(int64_t this_arg, int8_tArray recipient, int64_tArray first_hops, int64_t tlvs, int64_t amount_msats) {
7445         void* this_arg_ptr = untag_ptr(this_arg);
7446         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7447         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7448         LDKPublicKey recipient_ref;
7449         CHECK(recipient->arr_len == 33);
7450         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7451         LDKCVec_ChannelDetailsZ first_hops_constr;
7452         first_hops_constr.datalen = first_hops->arr_len;
7453         if (first_hops_constr.datalen > 0)
7454                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7455         else
7456                 first_hops_constr.data = NULL;
7457         int64_t* first_hops_vals = first_hops->elems;
7458         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7459                 int64_t first_hops_conv_16 = first_hops_vals[q];
7460                 LDKChannelDetails first_hops_conv_16_conv;
7461                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7462                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7463                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7464                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
7465                 first_hops_constr.data[q] = first_hops_conv_16_conv;
7466         }
7467         FREE(first_hops);
7468         LDKReceiveTlvs tlvs_conv;
7469         tlvs_conv.inner = untag_ptr(tlvs);
7470         tlvs_conv.is_owned = ptr_is_owned(tlvs);
7471         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
7472         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
7473         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
7474         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
7475         return tag_ptr(ret_conv, true);
7476 }
7477
7478 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7479         return ThirtyTwoBytes_clone(&owner->a);
7480 }
7481 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(int64_t owner) {
7482         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7483         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7484         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
7485         return ret_arr;
7486 }
7487
7488 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7489         LDKChannelManager ret = owner->b;
7490         ret.is_owned = false;
7491         return ret;
7492 }
7493 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(int64_t owner) {
7494         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7495         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
7496         int64_t ret_ref = 0;
7497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7499         return ret_ref;
7500 }
7501
7502 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7503 CHECK(owner->result_ok);
7504         return &*owner->contents.result;
7505 }
7506 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(int64_t owner) {
7507         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7508         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7509         return ret_ret;
7510 }
7511
7512 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7513 CHECK(!owner->result_ok);
7514         return DecodeError_clone(&*owner->contents.err);
7515 }
7516 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(int64_t owner) {
7517         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7518         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7519         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
7520         int64_t ret_ref = tag_ptr(ret_copy, true);
7521         return ret_ref;
7522 }
7523
7524 uint32_t CS_LDK_LDKMaxDustHTLCExposure_ty_from_ptr(int64_t ptr) {
7525         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7526         switch(obj->tag) {
7527                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
7528                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
7529                 default: abort();
7530         }
7531 }
7532 int64_t CS_LDK_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(int64_t ptr) {
7533         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7534         CHECK(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
7535         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
7536         return fixed_limit_msat_conv;
7537 }
7538 int64_t CS_LDK_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(int64_t ptr) {
7539         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7540         CHECK(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
7541         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
7542         return fee_rate_multiplier_conv;
7543 }
7544 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7545 CHECK(owner->result_ok);
7546         return MaxDustHTLCExposure_clone(&*owner->contents.result);
7547 }
7548 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(int64_t owner) {
7549         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7550         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
7551         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
7552         int64_t ret_ref = tag_ptr(ret_copy, true);
7553         return ret_ref;
7554 }
7555
7556 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7557 CHECK(!owner->result_ok);
7558         return DecodeError_clone(&*owner->contents.err);
7559 }
7560 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(int64_t owner) {
7561         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7562         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7563         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
7564         int64_t ret_ref = tag_ptr(ret_copy, true);
7565         return ret_ref;
7566 }
7567
7568 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7569         LDKChannelConfig ret = *owner->contents.result;
7570         ret.is_owned = false;
7571         return ret;
7572 }
7573 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_ok(int64_t owner) {
7574         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7575         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7576         int64_t ret_ref = 0;
7577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7579         return ret_ref;
7580 }
7581
7582 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7583 CHECK(!owner->result_ok);
7584         return DecodeError_clone(&*owner->contents.err);
7585 }
7586 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_err(int64_t owner) {
7587         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7589         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7590         int64_t ret_ref = tag_ptr(ret_copy, true);
7591         return ret_ref;
7592 }
7593
7594 uint32_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(int64_t ptr) {
7595         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7596         switch(obj->tag) {
7597                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
7598                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
7599                 default: abort();
7600         }
7601 }
7602 int64_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(int64_t ptr) {
7603         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7604         CHECK(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
7605         int64_t some_ref = tag_ptr(&obj->some, false);
7606         return some_ref;
7607 }
7608 uint32_t CS_LDK_LDKCOption_APIErrorZ_ty_from_ptr(int64_t ptr) {
7609         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7610         switch(obj->tag) {
7611                 case LDKCOption_APIErrorZ_Some: return 0;
7612                 case LDKCOption_APIErrorZ_None: return 1;
7613                 default: abort();
7614         }
7615 }
7616 int64_t CS_LDK_LDKCOption_APIErrorZ_Some_get_some(int64_t ptr) {
7617         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7618         CHECK(obj->tag == LDKCOption_APIErrorZ_Some);
7619         int64_t some_ref = tag_ptr(&obj->some, false);
7620         return some_ref;
7621 }
7622 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7623 CHECK(owner->result_ok);
7624         return COption_APIErrorZ_clone(&*owner->contents.result);
7625 }
7626 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_ok(int64_t owner) {
7627         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7628         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
7629         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
7630         int64_t ret_ref = tag_ptr(ret_copy, true);
7631         return ret_ref;
7632 }
7633
7634 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7635 CHECK(!owner->result_ok);
7636         return DecodeError_clone(&*owner->contents.err);
7637 }
7638 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_err(int64_t owner) {
7639         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7640         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7641         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7642         int64_t ret_ref = tag_ptr(ret_copy, true);
7643         return ret_ref;
7644 }
7645
7646 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7647         LDKChannelMonitorUpdate ret = *owner->contents.result;
7648         ret.is_owned = false;
7649         return ret;
7650 }
7651 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(int64_t owner) {
7652         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7653         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7654         int64_t ret_ref = 0;
7655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7657         return ret_ref;
7658 }
7659
7660 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7661 CHECK(!owner->result_ok);
7662         return DecodeError_clone(&*owner->contents.err);
7663 }
7664 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(int64_t owner) {
7665         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7667         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7668         int64_t ret_ref = tag_ptr(ret_copy, true);
7669         return ret_ref;
7670 }
7671
7672 uint32_t CS_LDK_LDKCOption_MonitorEventZ_ty_from_ptr(int64_t ptr) {
7673         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7674         switch(obj->tag) {
7675                 case LDKCOption_MonitorEventZ_Some: return 0;
7676                 case LDKCOption_MonitorEventZ_None: return 1;
7677                 default: abort();
7678         }
7679 }
7680 int64_t CS_LDK_LDKCOption_MonitorEventZ_Some_get_some(int64_t ptr) {
7681         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7682         CHECK(obj->tag == LDKCOption_MonitorEventZ_Some);
7683         int64_t some_ref = tag_ptr(&obj->some, false);
7684         return some_ref;
7685 }
7686 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7687 CHECK(owner->result_ok);
7688         return COption_MonitorEventZ_clone(&*owner->contents.result);
7689 }
7690 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(int64_t owner) {
7691         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7692         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7693         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7694         int64_t ret_ref = tag_ptr(ret_copy, true);
7695         return ret_ref;
7696 }
7697
7698 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7699 CHECK(!owner->result_ok);
7700         return DecodeError_clone(&*owner->contents.err);
7701 }
7702 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_err(int64_t owner) {
7703         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7704         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7705         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7706         int64_t ret_ref = tag_ptr(ret_copy, true);
7707         return ret_ref;
7708 }
7709
7710 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7711         LDKHTLCUpdate ret = *owner->contents.result;
7712         ret.is_owned = false;
7713         return ret;
7714 }
7715 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_ok(int64_t owner) {
7716         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7717         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7718         int64_t ret_ref = 0;
7719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7721         return ret_ref;
7722 }
7723
7724 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7725 CHECK(!owner->result_ok);
7726         return DecodeError_clone(&*owner->contents.err);
7727 }
7728 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_err(int64_t owner) {
7729         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7730         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7731         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7732         int64_t ret_ref = tag_ptr(ret_copy, true);
7733         return ret_ref;
7734 }
7735
7736 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7737         LDKOutPoint ret = owner->a;
7738         ret.is_owned = false;
7739         return ret;
7740 }
7741 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_a(int64_t owner) {
7742         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7743         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
7744         int64_t ret_ref = 0;
7745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7747         return ret_ref;
7748 }
7749
7750 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7751         return CVec_u8Z_clone(&owner->b);
7752 }
7753 int8_tArray  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_b(int64_t owner) {
7754         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7755         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
7756         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7757         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7758         CVec_u8Z_free(ret_var);
7759         return ret_arr;
7760 }
7761
7762 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7763         return owner->a;
7764 }
7765 int32_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_a(int64_t owner) {
7766         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7767         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
7768         return ret_conv;
7769 }
7770
7771 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7772         return CVec_u8Z_clone(&owner->b);
7773 }
7774 int8_tArray  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_b(int64_t owner) {
7775         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7776         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
7777         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7778         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7779         CVec_u8Z_free(ret_var);
7780         return ret_arr;
7781 }
7782
7783 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
7784         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
7785         for (size_t i = 0; i < ret.datalen; i++) {
7786                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
7787         }
7788         return ret;
7789 }
7790 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7791         return ThirtyTwoBytes_clone(&owner->a);
7792 }
7793 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(int64_t owner) {
7794         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7795         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7796         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
7797         return ret_arr;
7798 }
7799
7800 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7801         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
7802 }
7803 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(int64_t owner) {
7804         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7805         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
7806         int64_tArray ret_arr = NULL;
7807         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
7808         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
7809         for (size_t x = 0; x < ret_var.datalen; x++) {
7810                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
7811                 *ret_conv_23_conv = ret_var.data[x];
7812                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
7813         }
7814         
7815         FREE(ret_var.data);
7816         return ret_arr;
7817 }
7818
7819 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
7820         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ clone bytes"), .datalen = orig->datalen };
7821         for (size_t i = 0; i < ret.datalen; i++) {
7822                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
7823         }
7824         return ret;
7825 }
7826 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
7827         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
7828         for (size_t i = 0; i < ret.datalen; i++) {
7829                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
7830         }
7831         return ret;
7832 }
7833 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7834         return owner->a;
7835 }
7836 int32_t  CS_LDK_C2Tuple_u32TxOutZ_get_a(int64_t owner) {
7837         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7838         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7839         return ret_conv;
7840 }
7841
7842 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7843         return TxOut_clone(&owner->b);
7844 }
7845 int64_t  CS_LDK_C2Tuple_u32TxOutZ_get_b(int64_t owner) {
7846         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7847         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7848         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7849         return tag_ptr(ret_ref, true);
7850 }
7851
7852 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7853         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7854         for (size_t i = 0; i < ret.datalen; i++) {
7855                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7856         }
7857         return ret;
7858 }
7859 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7860         return ThirtyTwoBytes_clone(&owner->a);
7861 }
7862 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(int64_t owner) {
7863         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7864         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7865         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
7866         return ret_arr;
7867 }
7868
7869 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7870         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7871 }
7872 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(int64_t owner) {
7873         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7874         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7875         int64_tArray ret_arr = NULL;
7876         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
7877         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
7878         for (size_t u = 0; u < ret_var.datalen; u++) {
7879                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7880                 *ret_conv_20_conv = ret_var.data[u];
7881                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7882         }
7883         
7884         FREE(ret_var.data);
7885         return ret_arr;
7886 }
7887
7888 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
7889         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
7890         for (size_t i = 0; i < ret.datalen; i++) {
7891                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7892         }
7893         return ret;
7894 }
7895 uint32_t CS_LDK_LDKBalance_ty_from_ptr(int64_t ptr) {
7896         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7897         switch(obj->tag) {
7898                 case LDKBalance_ClaimableOnChannelClose: return 0;
7899                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
7900                 case LDKBalance_ContentiousClaimable: return 2;
7901                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
7902                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
7903                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
7904                 default: abort();
7905         }
7906 }
7907 int64_t CS_LDK_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(int64_t ptr) {
7908         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7909         CHECK(obj->tag == LDKBalance_ClaimableOnChannelClose);
7910         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
7911         return amount_satoshis_conv;
7912 }
7913 int64_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(int64_t ptr) {
7914         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7915         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7916         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
7917         return amount_satoshis_conv;
7918 }
7919 int32_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(int64_t ptr) {
7920         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7921         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7922         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7923         return confirmation_height_conv;
7924 }
7925 int64_t CS_LDK_LDKBalance_ContentiousClaimable_get_amount_satoshis(int64_t ptr) {
7926         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7927         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7928         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
7929         return amount_satoshis_conv;
7930 }
7931 int32_t CS_LDK_LDKBalance_ContentiousClaimable_get_timeout_height(int64_t ptr) {
7932         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7933         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7934         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7935         return timeout_height_conv;
7936 }
7937 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_hash(int64_t ptr) {
7938         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7939         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7940         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7941         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
7942         return payment_hash_arr;
7943 }
7944 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_preimage(int64_t ptr) {
7945         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7946         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7947         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
7948         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
7949         return payment_preimage_arr;
7950 }
7951 int64_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(int64_t ptr) {
7952         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7953         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7954         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
7955         return amount_satoshis_conv;
7956 }
7957 int32_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(int64_t ptr) {
7958         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7959         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7960         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7961         return claimable_height_conv;
7962 }
7963 int8_tArray CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(int64_t ptr) {
7964         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7965         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7966         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7967         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
7968         return payment_hash_arr;
7969 }
7970 int64_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(int64_t ptr) {
7971         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7972         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7973         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
7974         return amount_satoshis_conv;
7975 }
7976 int32_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(int64_t ptr) {
7977         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7978         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7979         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7980         return expiry_height_conv;
7981 }
7982 int8_tArray CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(int64_t ptr) {
7983         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7984         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7985         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7986         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
7987         return payment_hash_arr;
7988 }
7989 int64_t CS_LDK_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(int64_t ptr) {
7990         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7991         CHECK(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7992         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
7993         return amount_satoshis_conv;
7994 }
7995 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7996         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7997         for (size_t i = 0; i < ret.datalen; i++) {
7998                 ret.data[i] = Balance_clone(&orig->data[i]);
7999         }
8000         return ret;
8001 }
8002 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
8003         return ThirtyTwoBytes_clone(&owner->a);
8004 }
8005 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(int64_t owner) {
8006         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8007         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8008         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
8009         return ret_arr;
8010 }
8011
8012 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
8013         LDKChannelMonitor ret = owner->b;
8014         ret.is_owned = false;
8015         return ret;
8016 }
8017 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(int64_t owner) {
8018         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8019         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
8020         int64_t ret_ref = 0;
8021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8023         return ret_ref;
8024 }
8025
8026 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8027 CHECK(owner->result_ok);
8028         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8029 }
8030 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(int64_t owner) {
8031         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8032         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8033         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8034         return tag_ptr(ret_conv, true);
8035 }
8036
8037 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8038 CHECK(!owner->result_ok);
8039         return DecodeError_clone(&*owner->contents.err);
8040 }
8041 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(int64_t owner) {
8042         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8043         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8044         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8045         int64_t ret_ref = tag_ptr(ret_copy, true);
8046         return ret_ref;
8047 }
8048
8049 typedef struct LDKType_JCalls {
8050         atomic_size_t refcnt;
8051         uint32_t instance_ptr;
8052 } LDKType_JCalls;
8053 static void LDKType_JCalls_free(void* this_arg) {
8054         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8055         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8056                 FREE(j_calls);
8057         }
8058 }
8059 uint16_t type_id_LDKType_jcall(const void* this_arg) {
8060         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8061         return js_invoke_function_s_(j_calls->instance_ptr, 50);
8062 }
8063 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
8064         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8065         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 51);
8066         LDKStr ret_conv = str_ref_to_owned_c(ret);
8067         return ret_conv;
8068 }
8069 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
8070         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8071         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 52);
8072         LDKCVec_u8Z ret_ref;
8073         ret_ref.datalen = ret->arr_len;
8074         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8075         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8076         return ret_ref;
8077 }
8078 static void LDKType_JCalls_cloned(LDKType* new_obj) {
8079         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
8080         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8081 }
8082 static inline LDKType LDKType_init (int64_t o) {
8083         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
8084         atomic_init(&calls->refcnt, 1);
8085         calls->instance_ptr = o;
8086
8087         LDKType ret = {
8088                 .this_arg = (void*) calls,
8089                 .type_id = type_id_LDKType_jcall,
8090                 .debug_str = debug_str_LDKType_jcall,
8091                 .write = write_LDKType_jcall,
8092                 .cloned = LDKType_JCalls_cloned,
8093                 .free = LDKType_JCalls_free,
8094         };
8095         return ret;
8096 }
8097 uint64_t  CS_LDK_LDKType_new(int32_t o) {
8098         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
8099         *res_ptr = LDKType_init(o);
8100         return tag_ptr(res_ptr, true);
8101 }
8102 int16_t  CS_LDK_Type_type_id(int64_t this_arg) {
8103         void* this_arg_ptr = untag_ptr(this_arg);
8104         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8105         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8106         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
8107         return ret_conv;
8108 }
8109
8110 jstring  CS_LDK_Type_debug_str(int64_t this_arg) {
8111         void* this_arg_ptr = untag_ptr(this_arg);
8112         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8113         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8114         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8115         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8116         Str_free(ret_str);
8117         return ret_conv;
8118 }
8119
8120 int8_tArray  CS_LDK_Type_write(int64_t this_arg) {
8121         void* this_arg_ptr = untag_ptr(this_arg);
8122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8123         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8124         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8125         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8126         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8127         CVec_u8Z_free(ret_var);
8128         return ret_arr;
8129 }
8130
8131 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8132         return owner->a;
8133 }
8134 int8_tArray  CS_LDK_C2Tuple_PublicKeyTypeZ_get_a(int64_t owner) {
8135         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8136         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8137         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8138         return ret_arr;
8139 }
8140
8141 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8142         return Type_clone(&owner->b);
8143 }
8144 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_get_b(int64_t owner) {
8145         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8146         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8147         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8148         return tag_ptr(ret_ret, true);
8149 }
8150
8151 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8152         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8153         for (size_t i = 0; i < ret.datalen; i++) {
8154                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8155         }
8156         return ret;
8157 }
8158 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8159         return owner->a;
8160 }
8161 int8_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(int64_t owner) {
8162         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8163         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8164         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8165         return ret_arr;
8166 }
8167
8168 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8169         return CVec_SocketAddressZ_clone(&owner->b);
8170 }
8171 int64_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(int64_t owner) {
8172         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8173         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
8174         int64_tArray ret_arr = NULL;
8175         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8176         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8177         for (size_t p = 0; p < ret_var.datalen; p++) {
8178                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8179                 *ret_conv_15_copy = ret_var.data[p];
8180                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
8181                 ret_arr_ptr[p] = ret_conv_15_ref;
8182         }
8183         
8184         FREE(ret_var.data);
8185         return ret_arr;
8186 }
8187
8188 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
8189         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8190         for (size_t i = 0; i < ret.datalen; i++) {
8191                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
8192         }
8193         return ret;
8194 }
8195 typedef struct LDKOnionMessageContents_JCalls {
8196         atomic_size_t refcnt;
8197         uint32_t instance_ptr;
8198 } LDKOnionMessageContents_JCalls;
8199 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
8200         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8201         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8202                 FREE(j_calls);
8203         }
8204 }
8205 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
8206         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8207         return js_invoke_function_l_(j_calls->instance_ptr, 53);
8208 }
8209 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
8210         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8211         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 54);
8212         LDKCVec_u8Z ret_ref;
8213         ret_ref.datalen = ret->arr_len;
8214         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8215         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8216         return ret_ref;
8217 }
8218 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
8219         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8220         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 55);
8221         LDKStr ret_conv = str_ref_to_owned_c(ret);
8222         return ret_conv;
8223 }
8224 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
8225         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
8226         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8227 }
8228 static inline LDKOnionMessageContents LDKOnionMessageContents_init (int64_t o) {
8229         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
8230         atomic_init(&calls->refcnt, 1);
8231         calls->instance_ptr = o;
8232
8233         LDKOnionMessageContents ret = {
8234                 .this_arg = (void*) calls,
8235                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
8236                 .write = write_LDKOnionMessageContents_jcall,
8237                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
8238                 .cloned = LDKOnionMessageContents_JCalls_cloned,
8239                 .free = LDKOnionMessageContents_JCalls_free,
8240         };
8241         return ret;
8242 }
8243 uint64_t  CS_LDK_LDKOnionMessageContents_new(int32_t o) {
8244         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8245         *res_ptr = LDKOnionMessageContents_init(o);
8246         return tag_ptr(res_ptr, true);
8247 }
8248 int64_t  CS_LDK_OnionMessageContents_tlv_type(int64_t this_arg) {
8249         void* this_arg_ptr = untag_ptr(this_arg);
8250         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8251         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8252         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8253         return ret_conv;
8254 }
8255
8256 int8_tArray  CS_LDK_OnionMessageContents_write(int64_t this_arg) {
8257         void* this_arg_ptr = untag_ptr(this_arg);
8258         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8259         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8260         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8263         CVec_u8Z_free(ret_var);
8264         return ret_arr;
8265 }
8266
8267 jstring  CS_LDK_OnionMessageContents_debug_str(int64_t this_arg) {
8268         void* this_arg_ptr = untag_ptr(this_arg);
8269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8270         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8271         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8272         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8273         Str_free(ret_str);
8274         return ret_conv;
8275 }
8276
8277 uint32_t CS_LDK_LDKCOption_OnionMessageContentsZ_ty_from_ptr(int64_t ptr) {
8278         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8279         switch(obj->tag) {
8280                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
8281                 case LDKCOption_OnionMessageContentsZ_None: return 1;
8282                 default: abort();
8283         }
8284 }
8285 int64_t CS_LDK_LDKCOption_OnionMessageContentsZ_Some_get_some(int64_t ptr) {
8286         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8287         CHECK(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
8288         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8289         *some_ret = OnionMessageContents_clone(&obj->some);
8290         return tag_ptr(some_ret, true);
8291 }
8292 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8293 CHECK(owner->result_ok);
8294         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
8295 }
8296 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(int64_t owner) {
8297         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8298         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
8299         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8300         int64_t ret_ref = tag_ptr(ret_copy, true);
8301         return ret_ref;
8302 }
8303
8304 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8305 CHECK(!owner->result_ok);
8306         return DecodeError_clone(&*owner->contents.err);
8307 }
8308 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(int64_t owner) {
8309         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8310         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8311         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8312         int64_t ret_ref = tag_ptr(ret_copy, true);
8313         return ret_ref;
8314 }
8315
8316 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8317         return OnionMessageContents_clone(&owner->a);
8318 }
8319 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(int64_t owner) {
8320         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8321         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8322         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
8323         return tag_ptr(ret_ret, true);
8324 }
8325
8326 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8327         return Destination_clone(&owner->b);
8328 }
8329 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(int64_t owner) {
8330         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8331         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8332         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
8333         int64_t ret_ref = tag_ptr(ret_copy, true);
8334         return ret_ref;
8335 }
8336
8337 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8338         LDKBlindedPath ret = owner->c;
8339         ret.is_owned = false;
8340         return ret;
8341 }
8342 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(int64_t owner) {
8343         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8344         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
8345         int64_t ret_ref = 0;
8346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8348         return ret_ref;
8349 }
8350
8351 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
8352         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8353         for (size_t i = 0; i < ret.datalen; i++) {
8354                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
8355         }
8356         return ret;
8357 }
8358 uint32_t CS_LDK_LDKCOption_TypeZ_ty_from_ptr(int64_t ptr) {
8359         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8360         switch(obj->tag) {
8361                 case LDKCOption_TypeZ_Some: return 0;
8362                 case LDKCOption_TypeZ_None: return 1;
8363                 default: abort();
8364         }
8365 }
8366 int64_t CS_LDK_LDKCOption_TypeZ_Some_get_some(int64_t ptr) {
8367         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8368         CHECK(obj->tag == LDKCOption_TypeZ_Some);
8369         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8370         *some_ret = Type_clone(&obj->some);
8371         return tag_ptr(some_ret, true);
8372 }
8373 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8374 CHECK(owner->result_ok);
8375         return COption_TypeZ_clone(&*owner->contents.result);
8376 }
8377 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_ok(int64_t owner) {
8378         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8379         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8380         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8381         int64_t ret_ref = tag_ptr(ret_copy, true);
8382         return ret_ref;
8383 }
8384
8385 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8386 CHECK(!owner->result_ok);
8387         return DecodeError_clone(&*owner->contents.err);
8388 }
8389 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_err(int64_t owner) {
8390         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8391         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8392         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8393         int64_t ret_ref = tag_ptr(ret_copy, true);
8394         return ret_ref;
8395 }
8396
8397 uint32_t CS_LDK_LDKCOption_SocketAddressZ_ty_from_ptr(int64_t ptr) {
8398         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8399         switch(obj->tag) {
8400                 case LDKCOption_SocketAddressZ_Some: return 0;
8401                 case LDKCOption_SocketAddressZ_None: return 1;
8402                 default: abort();
8403         }
8404 }
8405 int64_t CS_LDK_LDKCOption_SocketAddressZ_Some_get_some(int64_t ptr) {
8406         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8407         CHECK(obj->tag == LDKCOption_SocketAddressZ_Some);
8408         int64_t some_ref = tag_ptr(&obj->some, false);
8409         return some_ref;
8410 }
8411 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
8412         return owner->a;
8413 }
8414 int8_tArray  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(int64_t owner) {
8415         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
8416         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8417         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8418         return ret_arr;
8419 }
8420
8421 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
8422         return COption_SocketAddressZ_clone(&owner->b);
8423 }
8424 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(int64_t owner) {
8425         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
8426         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
8427         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
8428         int64_t ret_ref = tag_ptr(ret_copy, true);
8429         return ret_ref;
8430 }
8431
8432 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
8433         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8434         for (size_t i = 0; i < ret.datalen; i++) {
8435                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
8436         }
8437         return ret;
8438 }
8439 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8440 CHECK(owner->result_ok);
8441         return CVec_u8Z_clone(&*owner->contents.result);
8442 }
8443 int8_tArray  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(int64_t owner) {
8444         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8445         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8446         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8447         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8448         CVec_u8Z_free(ret_var);
8449         return ret_arr;
8450 }
8451
8452 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8453         LDKPeerHandleError ret = *owner->contents.err;
8454         ret.is_owned = false;
8455         return ret;
8456 }
8457 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_err(int64_t owner) {
8458         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8459         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8460         int64_t ret_ref = 0;
8461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8463         return ret_ref;
8464 }
8465
8466 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8467 CHECK(owner->result_ok);
8468         return *owner->contents.result;
8469 }
8470 void  CS_LDK_CResult_NonePeerHandleErrorZ_get_ok(int64_t owner) {
8471         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8472         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8473 }
8474
8475 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8476         LDKPeerHandleError ret = *owner->contents.err;
8477         ret.is_owned = false;
8478         return ret;
8479 }
8480 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_get_err(int64_t owner) {
8481         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8482         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8483         int64_t ret_ref = 0;
8484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8486         return ret_ref;
8487 }
8488
8489 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8490 CHECK(owner->result_ok);
8491         return *owner->contents.result;
8492 }
8493 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_get_ok(int64_t owner) {
8494         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8495         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8496         return ret_conv;
8497 }
8498
8499 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8500         LDKPeerHandleError ret = *owner->contents.err;
8501         ret.is_owned = false;
8502         return ret;
8503 }
8504 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_get_err(int64_t owner) {
8505         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8506         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8507         int64_t ret_ref = 0;
8508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8510         return ret_ref;
8511 }
8512
8513 uint32_t CS_LDK_LDKGraphSyncError_ty_from_ptr(int64_t ptr) {
8514         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8515         switch(obj->tag) {
8516                 case LDKGraphSyncError_DecodeError: return 0;
8517                 case LDKGraphSyncError_LightningError: return 1;
8518                 default: abort();
8519         }
8520 }
8521 int64_t CS_LDK_LDKGraphSyncError_DecodeError_get_decode_error(int64_t ptr) {
8522         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8523         CHECK(obj->tag == LDKGraphSyncError_DecodeError);
8524         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8525         return decode_error_ref;
8526 }
8527 int64_t CS_LDK_LDKGraphSyncError_LightningError_get_lightning_error(int64_t ptr) {
8528         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8529         CHECK(obj->tag == LDKGraphSyncError_LightningError);
8530         LDKLightningError lightning_error_var = obj->lightning_error;
8531                         int64_t lightning_error_ref = 0;
8532                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8533                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8534         return lightning_error_ref;
8535 }
8536 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8537 CHECK(owner->result_ok);
8538         return *owner->contents.result;
8539 }
8540 int32_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_ok(int64_t owner) {
8541         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8542         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8543         return ret_conv;
8544 }
8545
8546 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8547 CHECK(!owner->result_ok);
8548         return GraphSyncError_clone(&*owner->contents.err);
8549 }
8550 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_err(int64_t owner) {
8551         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8552         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8553         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8554         int64_t ret_ref = tag_ptr(ret_copy, true);
8555         return ret_ref;
8556 }
8557
8558 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8559 CHECK(owner->result_ok);
8560         return CVec_u8Z_clone(&*owner->contents.result);
8561 }
8562 int8_tArray  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_ok(int64_t owner) {
8563         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8564         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
8565         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8566         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8567         CVec_u8Z_free(ret_var);
8568         return ret_arr;
8569 }
8570
8571 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8572 CHECK(!owner->result_ok);
8573         return *owner->contents.err;
8574 }
8575 int32_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_err(int64_t owner) {
8576         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8577         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
8578         return ret_conv;
8579 }
8580
8581 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8582 CHECK(owner->result_ok);
8583         return *owner->contents.result;
8584 }
8585 ptrArray  CS_LDK_CResult_CVec_StrZIOErrorZ_get_ok(int64_t owner) {
8586         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8587         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
8588         ptrArray ret_arr = NULL;
8589         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8590         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
8591         for (size_t i = 0; i < ret_var.datalen; i++) {
8592                 LDKStr ret_conv_8_str = ret_var.data[i];
8593                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
8594                 ret_arr_ptr[i] = ret_conv_8_conv;
8595         }
8596         
8597         return ret_arr;
8598 }
8599
8600 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8601 CHECK(!owner->result_ok);
8602         return *owner->contents.err;
8603 }
8604 int32_t  CS_LDK_CResult_CVec_StrZIOErrorZ_get_err(int64_t owner) {
8605         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8606         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
8607         return ret_conv;
8608 }
8609
8610 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
8611         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
8612         for (size_t i = 0; i < ret.datalen; i++) {
8613                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
8614         }
8615         return ret;
8616 }
8617 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8618 CHECK(owner->result_ok);
8619         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
8620 }
8621 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(int64_t owner) {
8622         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8623         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
8624         int64_tArray ret_arr = NULL;
8625         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8626         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8627         for (size_t o = 0; o < ret_var.datalen; o++) {
8628                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8629                 *ret_conv_40_conv = ret_var.data[o];
8630                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8631         }
8632         
8633         FREE(ret_var.data);
8634         return ret_arr;
8635 }
8636
8637 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8638 CHECK(!owner->result_ok);
8639         return *owner->contents.err;
8640 }
8641 int32_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(int64_t owner) {
8642         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8643         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
8644         return ret_conv;
8645 }
8646
8647 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8648 CHECK(owner->result_ok);
8649         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8650 }
8651 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(int64_t owner) {
8652         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8653         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8654         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
8655         return tag_ptr(ret_conv, true);
8656 }
8657
8658 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8659 CHECK(!owner->result_ok);
8660         return *owner->contents.err;
8661 }
8662 int32_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(int64_t owner) {
8663         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8664         int32_t ret_conv = LDKIOError_to_cs(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
8665         return ret_conv;
8666 }
8667
8668 uint32_t CS_LDK_LDKCOption_SecretKeyZ_ty_from_ptr(int64_t ptr) {
8669         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8670         switch(obj->tag) {
8671                 case LDKCOption_SecretKeyZ_Some: return 0;
8672                 case LDKCOption_SecretKeyZ_None: return 1;
8673                 default: abort();
8674         }
8675 }
8676 int8_tArray CS_LDK_LDKCOption_SecretKeyZ_Some_get_some(int64_t ptr) {
8677         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8678         CHECK(obj->tag == LDKCOption_SecretKeyZ_Some);
8679         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8680         memcpy(some_arr->elems, obj->some.bytes, 32);
8681         return some_arr;
8682 }
8683 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8684         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
8685         ret.is_owned = false;
8686         return ret;
8687 }
8688 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_ok(int64_t owner) {
8689         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8690         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
8691         int64_t ret_ref = 0;
8692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8694         return ret_ref;
8695 }
8696
8697 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8698 CHECK(!owner->result_ok);
8699         return *owner->contents.err;
8700 }
8701 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_err(int64_t owner) {
8702         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8703         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
8704 }
8705
8706 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8707         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8708         for (size_t i = 0; i < ret.datalen; i++) {
8709                 ret.data[i] = Witness_clone(&orig->data[i]);
8710         }
8711         return ret;
8712 }
8713 uint32_t CS_LDK_LDKCOption_i64Z_ty_from_ptr(int64_t ptr) {
8714         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8715         switch(obj->tag) {
8716                 case LDKCOption_i64Z_Some: return 0;
8717                 case LDKCOption_i64Z_None: return 1;
8718                 default: abort();
8719         }
8720 }
8721 int64_t CS_LDK_LDKCOption_i64Z_Some_get_some(int64_t ptr) {
8722         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8723         CHECK(obj->tag == LDKCOption_i64Z_Some);
8724         int64_t some_conv = obj->some;
8725         return some_conv;
8726 }
8727 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8728 CHECK(owner->result_ok);
8729         return SocketAddress_clone(&*owner->contents.result);
8730 }
8731 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_ok(int64_t owner) {
8732         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8733         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8734         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
8735         int64_t ret_ref = tag_ptr(ret_copy, true);
8736         return ret_ref;
8737 }
8738
8739 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8740 CHECK(!owner->result_ok);
8741         return DecodeError_clone(&*owner->contents.err);
8742 }
8743 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_err(int64_t owner) {
8744         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8745         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8746         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
8747         int64_t ret_ref = tag_ptr(ret_copy, true);
8748         return ret_ref;
8749 }
8750
8751 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8752 CHECK(owner->result_ok);
8753         return SocketAddress_clone(&*owner->contents.result);
8754 }
8755 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(int64_t owner) {
8756         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8757         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8758         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
8759         int64_t ret_ref = tag_ptr(ret_copy, true);
8760         return ret_ref;
8761 }
8762
8763 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8764 CHECK(!owner->result_ok);
8765         return SocketAddressParseError_clone(&*owner->contents.err);
8766 }
8767 int32_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_err(int64_t owner) {
8768         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8769         int32_t ret_conv = LDKSocketAddressParseError_to_cs(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
8770         return ret_conv;
8771 }
8772
8773 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8774         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8775         for (size_t i = 0; i < ret.datalen; i++) {
8776                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8777         }
8778         return ret;
8779 }
8780 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8781         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8782         for (size_t i = 0; i < ret.datalen; i++) {
8783                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8784         }
8785         return ret;
8786 }
8787 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8788         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8789         for (size_t i = 0; i < ret.datalen; i++) {
8790                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8791         }
8792         return ret;
8793 }
8794 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8795         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8796         for (size_t i = 0; i < ret.datalen; i++) {
8797                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8798         }
8799         return ret;
8800 }
8801 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8802         LDKAcceptChannel ret = *owner->contents.result;
8803         ret.is_owned = false;
8804         return ret;
8805 }
8806 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_ok(int64_t owner) {
8807         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8808         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8809         int64_t ret_ref = 0;
8810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8812         return ret_ref;
8813 }
8814
8815 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8816 CHECK(!owner->result_ok);
8817         return DecodeError_clone(&*owner->contents.err);
8818 }
8819 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_err(int64_t owner) {
8820         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8821         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8822         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8823         int64_t ret_ref = tag_ptr(ret_copy, true);
8824         return ret_ref;
8825 }
8826
8827 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8828         LDKAcceptChannelV2 ret = *owner->contents.result;
8829         ret.is_owned = false;
8830         return ret;
8831 }
8832 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_ok(int64_t owner) {
8833         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8834         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8835         int64_t ret_ref = 0;
8836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8838         return ret_ref;
8839 }
8840
8841 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8842 CHECK(!owner->result_ok);
8843         return DecodeError_clone(&*owner->contents.err);
8844 }
8845 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_err(int64_t owner) {
8846         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8847         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8848         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8849         int64_t ret_ref = tag_ptr(ret_copy, true);
8850         return ret_ref;
8851 }
8852
8853 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8854         LDKStfu ret = *owner->contents.result;
8855         ret.is_owned = false;
8856         return ret;
8857 }
8858 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_ok(int64_t owner) {
8859         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8860         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
8861         int64_t ret_ref = 0;
8862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8864         return ret_ref;
8865 }
8866
8867 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8868 CHECK(!owner->result_ok);
8869         return DecodeError_clone(&*owner->contents.err);
8870 }
8871 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_err(int64_t owner) {
8872         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8873         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8874         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
8875         int64_t ret_ref = tag_ptr(ret_copy, true);
8876         return ret_ref;
8877 }
8878
8879 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8880         LDKSplice ret = *owner->contents.result;
8881         ret.is_owned = false;
8882         return ret;
8883 }
8884 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_ok(int64_t owner) {
8885         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8886         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
8887         int64_t ret_ref = 0;
8888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8890         return ret_ref;
8891 }
8892
8893 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8894 CHECK(!owner->result_ok);
8895         return DecodeError_clone(&*owner->contents.err);
8896 }
8897 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_err(int64_t owner) {
8898         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8899         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8900         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
8901         int64_t ret_ref = tag_ptr(ret_copy, true);
8902         return ret_ref;
8903 }
8904
8905 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8906         LDKSpliceAck ret = *owner->contents.result;
8907         ret.is_owned = false;
8908         return ret;
8909 }
8910 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_ok(int64_t owner) {
8911         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8912         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
8913         int64_t ret_ref = 0;
8914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8916         return ret_ref;
8917 }
8918
8919 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8920 CHECK(!owner->result_ok);
8921         return DecodeError_clone(&*owner->contents.err);
8922 }
8923 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_err(int64_t owner) {
8924         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8925         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8926         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
8927         int64_t ret_ref = tag_ptr(ret_copy, true);
8928         return ret_ref;
8929 }
8930
8931 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8932         LDKSpliceLocked ret = *owner->contents.result;
8933         ret.is_owned = false;
8934         return ret;
8935 }
8936 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_ok(int64_t owner) {
8937         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8938         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
8939         int64_t ret_ref = 0;
8940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8942         return ret_ref;
8943 }
8944
8945 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8946 CHECK(!owner->result_ok);
8947         return DecodeError_clone(&*owner->contents.err);
8948 }
8949 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_err(int64_t owner) {
8950         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8951         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8952         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
8953         int64_t ret_ref = tag_ptr(ret_copy, true);
8954         return ret_ref;
8955 }
8956
8957 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8958         LDKTxAddInput ret = *owner->contents.result;
8959         ret.is_owned = false;
8960         return ret;
8961 }
8962 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_ok(int64_t owner) {
8963         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8964         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
8965         int64_t ret_ref = 0;
8966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8968         return ret_ref;
8969 }
8970
8971 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8972 CHECK(!owner->result_ok);
8973         return DecodeError_clone(&*owner->contents.err);
8974 }
8975 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_err(int64_t owner) {
8976         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8977         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8978         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
8979         int64_t ret_ref = tag_ptr(ret_copy, true);
8980         return ret_ref;
8981 }
8982
8983 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8984         LDKTxAddOutput ret = *owner->contents.result;
8985         ret.is_owned = false;
8986         return ret;
8987 }
8988 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_ok(int64_t owner) {
8989         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8990         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
8991         int64_t ret_ref = 0;
8992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8994         return ret_ref;
8995 }
8996
8997 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8998 CHECK(!owner->result_ok);
8999         return DecodeError_clone(&*owner->contents.err);
9000 }
9001 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_err(int64_t owner) {
9002         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9003         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9004         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
9005         int64_t ret_ref = tag_ptr(ret_copy, true);
9006         return ret_ref;
9007 }
9008
9009 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9010         LDKTxRemoveInput ret = *owner->contents.result;
9011         ret.is_owned = false;
9012         return ret;
9013 }
9014 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_ok(int64_t owner) {
9015         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9016         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
9017         int64_t ret_ref = 0;
9018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9020         return ret_ref;
9021 }
9022
9023 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9024 CHECK(!owner->result_ok);
9025         return DecodeError_clone(&*owner->contents.err);
9026 }
9027 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_err(int64_t owner) {
9028         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9029         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9030         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
9031         int64_t ret_ref = tag_ptr(ret_copy, true);
9032         return ret_ref;
9033 }
9034
9035 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9036         LDKTxRemoveOutput ret = *owner->contents.result;
9037         ret.is_owned = false;
9038         return ret;
9039 }
9040 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_ok(int64_t owner) {
9041         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9042         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
9043         int64_t ret_ref = 0;
9044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9046         return ret_ref;
9047 }
9048
9049 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9050 CHECK(!owner->result_ok);
9051         return DecodeError_clone(&*owner->contents.err);
9052 }
9053 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_err(int64_t owner) {
9054         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9055         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9056         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
9057         int64_t ret_ref = tag_ptr(ret_copy, true);
9058         return ret_ref;
9059 }
9060
9061 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9062         LDKTxComplete ret = *owner->contents.result;
9063         ret.is_owned = false;
9064         return ret;
9065 }
9066 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_ok(int64_t owner) {
9067         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9068         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
9069         int64_t ret_ref = 0;
9070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9072         return ret_ref;
9073 }
9074
9075 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9076 CHECK(!owner->result_ok);
9077         return DecodeError_clone(&*owner->contents.err);
9078 }
9079 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_err(int64_t owner) {
9080         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9081         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9082         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
9083         int64_t ret_ref = tag_ptr(ret_copy, true);
9084         return ret_ref;
9085 }
9086
9087 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9088         LDKTxSignatures ret = *owner->contents.result;
9089         ret.is_owned = false;
9090         return ret;
9091 }
9092 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9093         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9094         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
9095         int64_t ret_ref = 0;
9096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9098         return ret_ref;
9099 }
9100
9101 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9102 CHECK(!owner->result_ok);
9103         return DecodeError_clone(&*owner->contents.err);
9104 }
9105 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_err(int64_t owner) {
9106         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9108         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
9109         int64_t ret_ref = tag_ptr(ret_copy, true);
9110         return ret_ref;
9111 }
9112
9113 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9114         LDKTxInitRbf ret = *owner->contents.result;
9115         ret.is_owned = false;
9116         return ret;
9117 }
9118 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_ok(int64_t owner) {
9119         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9120         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
9121         int64_t ret_ref = 0;
9122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9124         return ret_ref;
9125 }
9126
9127 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9128 CHECK(!owner->result_ok);
9129         return DecodeError_clone(&*owner->contents.err);
9130 }
9131 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_err(int64_t owner) {
9132         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9133         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9134         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9135         int64_t ret_ref = tag_ptr(ret_copy, true);
9136         return ret_ref;
9137 }
9138
9139 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9140         LDKTxAckRbf ret = *owner->contents.result;
9141         ret.is_owned = false;
9142         return ret;
9143 }
9144 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_ok(int64_t owner) {
9145         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9146         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9147         int64_t ret_ref = 0;
9148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9150         return ret_ref;
9151 }
9152
9153 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9154 CHECK(!owner->result_ok);
9155         return DecodeError_clone(&*owner->contents.err);
9156 }
9157 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_err(int64_t owner) {
9158         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9159         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9160         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9161         int64_t ret_ref = tag_ptr(ret_copy, true);
9162         return ret_ref;
9163 }
9164
9165 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9166         LDKTxAbort ret = *owner->contents.result;
9167         ret.is_owned = false;
9168         return ret;
9169 }
9170 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_ok(int64_t owner) {
9171         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9172         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9173         int64_t ret_ref = 0;
9174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9176         return ret_ref;
9177 }
9178
9179 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9180 CHECK(!owner->result_ok);
9181         return DecodeError_clone(&*owner->contents.err);
9182 }
9183 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_err(int64_t owner) {
9184         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9186         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9187         int64_t ret_ref = tag_ptr(ret_copy, true);
9188         return ret_ref;
9189 }
9190
9191 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9192         LDKAnnouncementSignatures ret = *owner->contents.result;
9193         ret.is_owned = false;
9194         return ret;
9195 }
9196 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9197         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9198         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9199         int64_t ret_ref = 0;
9200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9202         return ret_ref;
9203 }
9204
9205 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9206 CHECK(!owner->result_ok);
9207         return DecodeError_clone(&*owner->contents.err);
9208 }
9209 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(int64_t owner) {
9210         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9211         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9212         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9213         int64_t ret_ref = tag_ptr(ret_copy, true);
9214         return ret_ref;
9215 }
9216
9217 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9218         LDKChannelReestablish ret = *owner->contents.result;
9219         ret.is_owned = false;
9220         return ret;
9221 }
9222 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_ok(int64_t owner) {
9223         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9224         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9225         int64_t ret_ref = 0;
9226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9228         return ret_ref;
9229 }
9230
9231 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9232 CHECK(!owner->result_ok);
9233         return DecodeError_clone(&*owner->contents.err);
9234 }
9235 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_err(int64_t owner) {
9236         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9238         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9239         int64_t ret_ref = tag_ptr(ret_copy, true);
9240         return ret_ref;
9241 }
9242
9243 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9244         LDKClosingSigned ret = *owner->contents.result;
9245         ret.is_owned = false;
9246         return ret;
9247 }
9248 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_ok(int64_t owner) {
9249         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9250         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9251         int64_t ret_ref = 0;
9252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9254         return ret_ref;
9255 }
9256
9257 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9258 CHECK(!owner->result_ok);
9259         return DecodeError_clone(&*owner->contents.err);
9260 }
9261 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_err(int64_t owner) {
9262         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9263         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9264         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9265         int64_t ret_ref = tag_ptr(ret_copy, true);
9266         return ret_ref;
9267 }
9268
9269 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9270         LDKClosingSignedFeeRange ret = *owner->contents.result;
9271         ret.is_owned = false;
9272         return ret;
9273 }
9274 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(int64_t owner) {
9275         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9276         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9277         int64_t ret_ref = 0;
9278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9280         return ret_ref;
9281 }
9282
9283 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9284 CHECK(!owner->result_ok);
9285         return DecodeError_clone(&*owner->contents.err);
9286 }
9287 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(int64_t owner) {
9288         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9289         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9290         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9291         int64_t ret_ref = tag_ptr(ret_copy, true);
9292         return ret_ref;
9293 }
9294
9295 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9296         LDKCommitmentSigned ret = *owner->contents.result;
9297         ret.is_owned = false;
9298         return ret;
9299 }
9300 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_ok(int64_t owner) {
9301         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9302         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9303         int64_t ret_ref = 0;
9304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9306         return ret_ref;
9307 }
9308
9309 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9310 CHECK(!owner->result_ok);
9311         return DecodeError_clone(&*owner->contents.err);
9312 }
9313 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_err(int64_t owner) {
9314         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9315         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9316         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9317         int64_t ret_ref = tag_ptr(ret_copy, true);
9318         return ret_ref;
9319 }
9320
9321 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9322         LDKFundingCreated ret = *owner->contents.result;
9323         ret.is_owned = false;
9324         return ret;
9325 }
9326 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_ok(int64_t owner) {
9327         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9328         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9329         int64_t ret_ref = 0;
9330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9332         return ret_ref;
9333 }
9334
9335 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9336 CHECK(!owner->result_ok);
9337         return DecodeError_clone(&*owner->contents.err);
9338 }
9339 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_err(int64_t owner) {
9340         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9341         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9342         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9343         int64_t ret_ref = tag_ptr(ret_copy, true);
9344         return ret_ref;
9345 }
9346
9347 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9348         LDKFundingSigned ret = *owner->contents.result;
9349         ret.is_owned = false;
9350         return ret;
9351 }
9352 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_ok(int64_t owner) {
9353         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9354         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9355         int64_t ret_ref = 0;
9356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9358         return ret_ref;
9359 }
9360
9361 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9362 CHECK(!owner->result_ok);
9363         return DecodeError_clone(&*owner->contents.err);
9364 }
9365 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_err(int64_t owner) {
9366         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9367         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9368         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9369         int64_t ret_ref = tag_ptr(ret_copy, true);
9370         return ret_ref;
9371 }
9372
9373 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9374         LDKChannelReady ret = *owner->contents.result;
9375         ret.is_owned = false;
9376         return ret;
9377 }
9378 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_ok(int64_t owner) {
9379         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9380         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9381         int64_t ret_ref = 0;
9382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9384         return ret_ref;
9385 }
9386
9387 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9388 CHECK(!owner->result_ok);
9389         return DecodeError_clone(&*owner->contents.err);
9390 }
9391 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_err(int64_t owner) {
9392         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9393         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9394         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9395         int64_t ret_ref = tag_ptr(ret_copy, true);
9396         return ret_ref;
9397 }
9398
9399 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9400         LDKInit ret = *owner->contents.result;
9401         ret.is_owned = false;
9402         return ret;
9403 }
9404 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_ok(int64_t owner) {
9405         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9406         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9407         int64_t ret_ref = 0;
9408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9410         return ret_ref;
9411 }
9412
9413 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9414 CHECK(!owner->result_ok);
9415         return DecodeError_clone(&*owner->contents.err);
9416 }
9417 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_err(int64_t owner) {
9418         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9419         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9420         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
9421         int64_t ret_ref = tag_ptr(ret_copy, true);
9422         return ret_ref;
9423 }
9424
9425 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9426         LDKOpenChannel ret = *owner->contents.result;
9427         ret.is_owned = false;
9428         return ret;
9429 }
9430 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_ok(int64_t owner) {
9431         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9432         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9433         int64_t ret_ref = 0;
9434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9436         return ret_ref;
9437 }
9438
9439 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9440 CHECK(!owner->result_ok);
9441         return DecodeError_clone(&*owner->contents.err);
9442 }
9443 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_err(int64_t owner) {
9444         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9445         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9446         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9447         int64_t ret_ref = tag_ptr(ret_copy, true);
9448         return ret_ref;
9449 }
9450
9451 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9452         LDKOpenChannelV2 ret = *owner->contents.result;
9453         ret.is_owned = false;
9454         return ret;
9455 }
9456 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_ok(int64_t owner) {
9457         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9458         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
9459         int64_t ret_ref = 0;
9460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9462         return ret_ref;
9463 }
9464
9465 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9466 CHECK(!owner->result_ok);
9467         return DecodeError_clone(&*owner->contents.err);
9468 }
9469 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_err(int64_t owner) {
9470         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9471         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9472         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
9473         int64_t ret_ref = tag_ptr(ret_copy, true);
9474         return ret_ref;
9475 }
9476
9477 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9478         LDKRevokeAndACK ret = *owner->contents.result;
9479         ret.is_owned = false;
9480         return ret;
9481 }
9482 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_ok(int64_t owner) {
9483         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9484         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9485         int64_t ret_ref = 0;
9486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9488         return ret_ref;
9489 }
9490
9491 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9492 CHECK(!owner->result_ok);
9493         return DecodeError_clone(&*owner->contents.err);
9494 }
9495 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_err(int64_t owner) {
9496         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9498         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9499         int64_t ret_ref = tag_ptr(ret_copy, true);
9500         return ret_ref;
9501 }
9502
9503 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9504         LDKShutdown ret = *owner->contents.result;
9505         ret.is_owned = false;
9506         return ret;
9507 }
9508 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_ok(int64_t owner) {
9509         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9510         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9511         int64_t ret_ref = 0;
9512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9514         return ret_ref;
9515 }
9516
9517 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9518 CHECK(!owner->result_ok);
9519         return DecodeError_clone(&*owner->contents.err);
9520 }
9521 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_err(int64_t owner) {
9522         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9523         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9524         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9525         int64_t ret_ref = tag_ptr(ret_copy, true);
9526         return ret_ref;
9527 }
9528
9529 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9530         LDKUpdateFailHTLC ret = *owner->contents.result;
9531         ret.is_owned = false;
9532         return ret;
9533 }
9534 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(int64_t owner) {
9535         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9536         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9537         int64_t ret_ref = 0;
9538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9540         return ret_ref;
9541 }
9542
9543 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9544 CHECK(!owner->result_ok);
9545         return DecodeError_clone(&*owner->contents.err);
9546 }
9547 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_err(int64_t owner) {
9548         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9549         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9550         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9551         int64_t ret_ref = tag_ptr(ret_copy, true);
9552         return ret_ref;
9553 }
9554
9555 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9556         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9557         ret.is_owned = false;
9558         return ret;
9559 }
9560 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(int64_t owner) {
9561         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9562         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9563         int64_t ret_ref = 0;
9564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9566         return ret_ref;
9567 }
9568
9569 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9570 CHECK(!owner->result_ok);
9571         return DecodeError_clone(&*owner->contents.err);
9572 }
9573 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(int64_t owner) {
9574         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9576         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9577         int64_t ret_ref = tag_ptr(ret_copy, true);
9578         return ret_ref;
9579 }
9580
9581 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9582         LDKUpdateFee ret = *owner->contents.result;
9583         ret.is_owned = false;
9584         return ret;
9585 }
9586 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_ok(int64_t owner) {
9587         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9588         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9589         int64_t ret_ref = 0;
9590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9592         return ret_ref;
9593 }
9594
9595 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9596 CHECK(!owner->result_ok);
9597         return DecodeError_clone(&*owner->contents.err);
9598 }
9599 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_err(int64_t owner) {
9600         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9601         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9602         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9603         int64_t ret_ref = tag_ptr(ret_copy, true);
9604         return ret_ref;
9605 }
9606
9607 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9608         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9609         ret.is_owned = false;
9610         return ret;
9611 }
9612 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(int64_t owner) {
9613         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9614         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9615         int64_t ret_ref = 0;
9616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9618         return ret_ref;
9619 }
9620
9621 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9622 CHECK(!owner->result_ok);
9623         return DecodeError_clone(&*owner->contents.err);
9624 }
9625 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(int64_t owner) {
9626         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9627         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9628         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9629         int64_t ret_ref = tag_ptr(ret_copy, true);
9630         return ret_ref;
9631 }
9632
9633 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9634         LDKOnionPacket ret = *owner->contents.result;
9635         ret.is_owned = false;
9636         return ret;
9637 }
9638 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_ok(int64_t owner) {
9639         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9640         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
9641         int64_t ret_ref = 0;
9642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9644         return ret_ref;
9645 }
9646
9647 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9648 CHECK(!owner->result_ok);
9649         return DecodeError_clone(&*owner->contents.err);
9650 }
9651 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_err(int64_t owner) {
9652         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9653         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9654         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
9655         int64_t ret_ref = tag_ptr(ret_copy, true);
9656         return ret_ref;
9657 }
9658
9659 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9660         LDKUpdateAddHTLC ret = *owner->contents.result;
9661         ret.is_owned = false;
9662         return ret;
9663 }
9664 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(int64_t owner) {
9665         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9666         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9667         int64_t ret_ref = 0;
9668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9670         return ret_ref;
9671 }
9672
9673 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9674 CHECK(!owner->result_ok);
9675         return DecodeError_clone(&*owner->contents.err);
9676 }
9677 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_err(int64_t owner) {
9678         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9679         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9680         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9681         int64_t ret_ref = tag_ptr(ret_copy, true);
9682         return ret_ref;
9683 }
9684
9685 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9686         LDKOnionMessage ret = *owner->contents.result;
9687         ret.is_owned = false;
9688         return ret;
9689 }
9690 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_ok(int64_t owner) {
9691         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9692         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9693         int64_t ret_ref = 0;
9694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9696         return ret_ref;
9697 }
9698
9699 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9700 CHECK(!owner->result_ok);
9701         return DecodeError_clone(&*owner->contents.err);
9702 }
9703 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_err(int64_t owner) {
9704         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9705         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9706         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9707         int64_t ret_ref = tag_ptr(ret_copy, true);
9708         return ret_ref;
9709 }
9710
9711 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9712         LDKFinalOnionHopData ret = *owner->contents.result;
9713         ret.is_owned = false;
9714         return ret;
9715 }
9716 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(int64_t owner) {
9717         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9718         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
9719         int64_t ret_ref = 0;
9720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9722         return ret_ref;
9723 }
9724
9725 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9726 CHECK(!owner->result_ok);
9727         return DecodeError_clone(&*owner->contents.err);
9728 }
9729 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_err(int64_t owner) {
9730         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9731         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9732         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
9733         int64_t ret_ref = tag_ptr(ret_copy, true);
9734         return ret_ref;
9735 }
9736
9737 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9738         LDKPing ret = *owner->contents.result;
9739         ret.is_owned = false;
9740         return ret;
9741 }
9742 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_ok(int64_t owner) {
9743         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9744         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9745         int64_t ret_ref = 0;
9746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9748         return ret_ref;
9749 }
9750
9751 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9752 CHECK(!owner->result_ok);
9753         return DecodeError_clone(&*owner->contents.err);
9754 }
9755 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_err(int64_t owner) {
9756         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9758         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9759         int64_t ret_ref = tag_ptr(ret_copy, true);
9760         return ret_ref;
9761 }
9762
9763 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9764         LDKPong ret = *owner->contents.result;
9765         ret.is_owned = false;
9766         return ret;
9767 }
9768 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_ok(int64_t owner) {
9769         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9770         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9771         int64_t ret_ref = 0;
9772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9774         return ret_ref;
9775 }
9776
9777 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9778 CHECK(!owner->result_ok);
9779         return DecodeError_clone(&*owner->contents.err);
9780 }
9781 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_err(int64_t owner) {
9782         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9783         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9784         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9785         int64_t ret_ref = tag_ptr(ret_copy, true);
9786         return ret_ref;
9787 }
9788
9789 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9790         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9791         ret.is_owned = false;
9792         return ret;
9793 }
9794 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9795         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9796         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9797         int64_t ret_ref = 0;
9798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9800         return ret_ref;
9801 }
9802
9803 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9804 CHECK(!owner->result_ok);
9805         return DecodeError_clone(&*owner->contents.err);
9806 }
9807 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9808         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9809         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9810         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9811         int64_t ret_ref = tag_ptr(ret_copy, true);
9812         return ret_ref;
9813 }
9814
9815 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9816         LDKChannelAnnouncement ret = *owner->contents.result;
9817         ret.is_owned = false;
9818         return ret;
9819 }
9820 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9821         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9822         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9823         int64_t ret_ref = 0;
9824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9826         return ret_ref;
9827 }
9828
9829 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9830 CHECK(!owner->result_ok);
9831         return DecodeError_clone(&*owner->contents.err);
9832 }
9833 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9834         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9835         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9836         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9837         int64_t ret_ref = tag_ptr(ret_copy, true);
9838         return ret_ref;
9839 }
9840
9841 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9842         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9843         ret.is_owned = false;
9844         return ret;
9845 }
9846 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
9847         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9848         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9849         int64_t ret_ref = 0;
9850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9852         return ret_ref;
9853 }
9854
9855 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9856 CHECK(!owner->result_ok);
9857         return DecodeError_clone(&*owner->contents.err);
9858 }
9859 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
9860         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9861         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9862         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9863         int64_t ret_ref = tag_ptr(ret_copy, true);
9864         return ret_ref;
9865 }
9866
9867 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9868         LDKChannelUpdate ret = *owner->contents.result;
9869         ret.is_owned = false;
9870         return ret;
9871 }
9872 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
9873         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9874         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9875         int64_t ret_ref = 0;
9876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9878         return ret_ref;
9879 }
9880
9881 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9882 CHECK(!owner->result_ok);
9883         return DecodeError_clone(&*owner->contents.err);
9884 }
9885 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
9886         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9887         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9888         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9889         int64_t ret_ref = tag_ptr(ret_copy, true);
9890         return ret_ref;
9891 }
9892
9893 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9894         LDKErrorMessage ret = *owner->contents.result;
9895         ret.is_owned = false;
9896         return ret;
9897 }
9898 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_ok(int64_t owner) {
9899         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9900         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9901         int64_t ret_ref = 0;
9902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9904         return ret_ref;
9905 }
9906
9907 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9908 CHECK(!owner->result_ok);
9909         return DecodeError_clone(&*owner->contents.err);
9910 }
9911 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_err(int64_t owner) {
9912         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9914         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9915         int64_t ret_ref = tag_ptr(ret_copy, true);
9916         return ret_ref;
9917 }
9918
9919 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9920         LDKWarningMessage ret = *owner->contents.result;
9921         ret.is_owned = false;
9922         return ret;
9923 }
9924 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_ok(int64_t owner) {
9925         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9926         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9927         int64_t ret_ref = 0;
9928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9930         return ret_ref;
9931 }
9932
9933 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9934 CHECK(!owner->result_ok);
9935         return DecodeError_clone(&*owner->contents.err);
9936 }
9937 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_err(int64_t owner) {
9938         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9939         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9940         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9941         int64_t ret_ref = tag_ptr(ret_copy, true);
9942         return ret_ref;
9943 }
9944
9945 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9946         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9947         ret.is_owned = false;
9948         return ret;
9949 }
9950 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9951         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9952         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9953         int64_t ret_ref = 0;
9954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9956         return ret_ref;
9957 }
9958
9959 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9960 CHECK(!owner->result_ok);
9961         return DecodeError_clone(&*owner->contents.err);
9962 }
9963 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9964         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9965         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9966         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9967         int64_t ret_ref = tag_ptr(ret_copy, true);
9968         return ret_ref;
9969 }
9970
9971 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9972         LDKNodeAnnouncement ret = *owner->contents.result;
9973         ret.is_owned = false;
9974         return ret;
9975 }
9976 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9977         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9978         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9979         int64_t ret_ref = 0;
9980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9982         return ret_ref;
9983 }
9984
9985 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9986 CHECK(!owner->result_ok);
9987         return DecodeError_clone(&*owner->contents.err);
9988 }
9989 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9990         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9991         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9992         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9993         int64_t ret_ref = tag_ptr(ret_copy, true);
9994         return ret_ref;
9995 }
9996
9997 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9998         LDKQueryShortChannelIds ret = *owner->contents.result;
9999         ret.is_owned = false;
10000         return ret;
10001 }
10002 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(int64_t owner) {
10003         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10004         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
10005         int64_t ret_ref = 0;
10006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10008         return ret_ref;
10009 }
10010
10011 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10012 CHECK(!owner->result_ok);
10013         return DecodeError_clone(&*owner->contents.err);
10014 }
10015 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(int64_t owner) {
10016         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10017         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10018         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
10019         int64_t ret_ref = tag_ptr(ret_copy, true);
10020         return ret_ref;
10021 }
10022
10023 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10024         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
10025         ret.is_owned = false;
10026         return ret;
10027 }
10028 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(int64_t owner) {
10029         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10030         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
10031         int64_t ret_ref = 0;
10032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10034         return ret_ref;
10035 }
10036
10037 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10038 CHECK(!owner->result_ok);
10039         return DecodeError_clone(&*owner->contents.err);
10040 }
10041 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(int64_t owner) {
10042         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10043         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10044         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10045         int64_t ret_ref = tag_ptr(ret_copy, true);
10046         return ret_ref;
10047 }
10048
10049 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10050         LDKQueryChannelRange ret = *owner->contents.result;
10051         ret.is_owned = false;
10052         return ret;
10053 }
10054 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10055         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10056         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10057         int64_t ret_ref = 0;
10058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10060         return ret_ref;
10061 }
10062
10063 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10064 CHECK(!owner->result_ok);
10065         return DecodeError_clone(&*owner->contents.err);
10066 }
10067 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10068         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10069         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10070         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10071         int64_t ret_ref = tag_ptr(ret_copy, true);
10072         return ret_ref;
10073 }
10074
10075 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10076         LDKReplyChannelRange ret = *owner->contents.result;
10077         ret.is_owned = false;
10078         return ret;
10079 }
10080 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10081         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10082         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10083         int64_t ret_ref = 0;
10084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10086         return ret_ref;
10087 }
10088
10089 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10090 CHECK(!owner->result_ok);
10091         return DecodeError_clone(&*owner->contents.err);
10092 }
10093 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10094         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10095         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10096         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10097         int64_t ret_ref = tag_ptr(ret_copy, true);
10098         return ret_ref;
10099 }
10100
10101 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10102         LDKGossipTimestampFilter ret = *owner->contents.result;
10103         ret.is_owned = false;
10104         return ret;
10105 }
10106 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(int64_t owner) {
10107         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10108         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10109         int64_t ret_ref = 0;
10110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10112         return ret_ref;
10113 }
10114
10115 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10116 CHECK(!owner->result_ok);
10117         return DecodeError_clone(&*owner->contents.err);
10118 }
10119 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_err(int64_t owner) {
10120         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10121         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10122         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10123         int64_t ret_ref = tag_ptr(ret_copy, true);
10124         return ret_ref;
10125 }
10126
10127 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10128         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10129         for (size_t i = 0; i < ret.datalen; i++) {
10130                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10131         }
10132         return ret;
10133 }
10134 uint32_t CS_LDK_LDKSignOrCreationError_ty_from_ptr(int64_t ptr) {
10135         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10136         switch(obj->tag) {
10137                 case LDKSignOrCreationError_SignError: return 0;
10138                 case LDKSignOrCreationError_CreationError: return 1;
10139                 default: abort();
10140         }
10141 }
10142 int32_t CS_LDK_LDKSignOrCreationError_CreationError_get_creation_error(int64_t ptr) {
10143         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10144         CHECK(obj->tag == LDKSignOrCreationError_CreationError);
10145         int32_t creation_error_conv = LDKCreationError_to_cs(obj->creation_error);
10146         return creation_error_conv;
10147 }
10148 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10149         LDKBolt11Invoice ret = *owner->contents.result;
10150         ret.is_owned = false;
10151         return ret;
10152 }
10153 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(int64_t owner) {
10154         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10155         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10156         int64_t ret_ref = 0;
10157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10159         return ret_ref;
10160 }
10161
10162 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10163 CHECK(!owner->result_ok);
10164         return SignOrCreationError_clone(&*owner->contents.err);
10165 }
10166 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(int64_t owner) {
10167         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10168         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10169         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10170         int64_t ret_ref = tag_ptr(ret_copy, true);
10171         return ret_ref;
10172 }
10173
10174 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
10175         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
10176         for (size_t i = 0; i < ret.datalen; i++) {
10177                 ret.data[i] = Future_clone(&orig->data[i]);
10178         }
10179         return ret;
10180 }
10181 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10182 CHECK(owner->result_ok);
10183         return OffersMessage_clone(&*owner->contents.result);
10184 }
10185 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_ok(int64_t owner) {
10186         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10187         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
10188         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
10189         int64_t ret_ref = tag_ptr(ret_copy, true);
10190         return ret_ref;
10191 }
10192
10193 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10194 CHECK(!owner->result_ok);
10195         return DecodeError_clone(&*owner->contents.err);
10196 }
10197 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_err(int64_t owner) {
10198         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10199         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10200         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
10201         int64_t ret_ref = tag_ptr(ret_copy, true);
10202         return ret_ref;
10203 }
10204
10205 uint32_t CS_LDK_LDKCOption_HTLCClaimZ_ty_from_ptr(int64_t ptr) {
10206         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10207         switch(obj->tag) {
10208                 case LDKCOption_HTLCClaimZ_Some: return 0;
10209                 case LDKCOption_HTLCClaimZ_None: return 1;
10210                 default: abort();
10211         }
10212 }
10213 int32_t CS_LDK_LDKCOption_HTLCClaimZ_Some_get_some(int64_t ptr) {
10214         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10215         CHECK(obj->tag == LDKCOption_HTLCClaimZ_Some);
10216         int32_t some_conv = LDKHTLCClaim_to_cs(obj->some);
10217         return some_conv;
10218 }
10219 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10220         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
10221         ret.is_owned = false;
10222         return ret;
10223 }
10224 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(int64_t owner) {
10225         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10226         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
10227         int64_t ret_ref = 0;
10228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10230         return ret_ref;
10231 }
10232
10233 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10234 CHECK(!owner->result_ok);
10235         return DecodeError_clone(&*owner->contents.err);
10236 }
10237 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(int64_t owner) {
10238         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10239         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10240         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
10241         int64_t ret_ref = tag_ptr(ret_copy, true);
10242         return ret_ref;
10243 }
10244
10245 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10246         LDKTxCreationKeys ret = *owner->contents.result;
10247         ret.is_owned = false;
10248         return ret;
10249 }
10250 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_ok(int64_t owner) {
10251         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10252         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
10253         int64_t ret_ref = 0;
10254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10256         return ret_ref;
10257 }
10258
10259 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10260 CHECK(!owner->result_ok);
10261         return DecodeError_clone(&*owner->contents.err);
10262 }
10263 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_err(int64_t owner) {
10264         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10265         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10266         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
10267         int64_t ret_ref = tag_ptr(ret_copy, true);
10268         return ret_ref;
10269 }
10270
10271 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10272         LDKChannelPublicKeys ret = *owner->contents.result;
10273         ret.is_owned = false;
10274         return ret;
10275 }
10276 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(int64_t owner) {
10277         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10278         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
10279         int64_t ret_ref = 0;
10280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10282         return ret_ref;
10283 }
10284
10285 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10286 CHECK(!owner->result_ok);
10287         return DecodeError_clone(&*owner->contents.err);
10288 }
10289 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_err(int64_t owner) {
10290         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10291         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10292         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
10293         int64_t ret_ref = tag_ptr(ret_copy, true);
10294         return ret_ref;
10295 }
10296
10297 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10298         LDKHTLCOutputInCommitment ret = *owner->contents.result;
10299         ret.is_owned = false;
10300         return ret;
10301 }
10302 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(int64_t owner) {
10303         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10304         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
10305         int64_t ret_ref = 0;
10306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10308         return ret_ref;
10309 }
10310
10311 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10312 CHECK(!owner->result_ok);
10313         return DecodeError_clone(&*owner->contents.err);
10314 }
10315 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(int64_t owner) {
10316         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10317         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10318         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
10319         int64_t ret_ref = tag_ptr(ret_copy, true);
10320         return ret_ref;
10321 }
10322
10323 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10324         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
10325         ret.is_owned = false;
10326         return ret;
10327 }
10328 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
10329         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10330         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10331         int64_t ret_ref = 0;
10332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10334         return ret_ref;
10335 }
10336
10337 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10338 CHECK(!owner->result_ok);
10339         return DecodeError_clone(&*owner->contents.err);
10340 }
10341 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
10342         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10343         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10344         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10345         int64_t ret_ref = tag_ptr(ret_copy, true);
10346         return ret_ref;
10347 }
10348
10349 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10350         LDKChannelTransactionParameters ret = *owner->contents.result;
10351         ret.is_owned = false;
10352         return ret;
10353 }
10354 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
10355         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10356         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10357         int64_t ret_ref = 0;
10358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10360         return ret_ref;
10361 }
10362
10363 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10364 CHECK(!owner->result_ok);
10365         return DecodeError_clone(&*owner->contents.err);
10366 }
10367 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
10368         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10369         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10370         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10371         int64_t ret_ref = tag_ptr(ret_copy, true);
10372         return ret_ref;
10373 }
10374
10375 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10376         LDKHolderCommitmentTransaction ret = *owner->contents.result;
10377         ret.is_owned = false;
10378         return ret;
10379 }
10380 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
10381         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10382         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10383         int64_t ret_ref = 0;
10384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10386         return ret_ref;
10387 }
10388
10389 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10390 CHECK(!owner->result_ok);
10391         return DecodeError_clone(&*owner->contents.err);
10392 }
10393 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
10394         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10395         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10396         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10397         int64_t ret_ref = tag_ptr(ret_copy, true);
10398         return ret_ref;
10399 }
10400
10401 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10402         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
10403         ret.is_owned = false;
10404         return ret;
10405 }
10406 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
10407         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10408         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10409         int64_t ret_ref = 0;
10410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10412         return ret_ref;
10413 }
10414
10415 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10416 CHECK(!owner->result_ok);
10417         return DecodeError_clone(&*owner->contents.err);
10418 }
10419 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
10420         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10421         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10422         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10423         int64_t ret_ref = tag_ptr(ret_copy, true);
10424         return ret_ref;
10425 }
10426
10427 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10428         LDKTrustedClosingTransaction ret = *owner->contents.result;
10429         ret.is_owned = false;
10430         return ret;
10431 }
10432 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_ok(int64_t owner) {
10433         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10434         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
10435         int64_t ret_ref = 0;
10436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10438         return ret_ref;
10439 }
10440
10441 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10442 CHECK(!owner->result_ok);
10443         return *owner->contents.err;
10444 }
10445 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_err(int64_t owner) {
10446         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10447         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
10448 }
10449
10450 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10451         LDKCommitmentTransaction ret = *owner->contents.result;
10452         ret.is_owned = false;
10453         return ret;
10454 }
10455 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
10456         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10457         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10458         int64_t ret_ref = 0;
10459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10461         return ret_ref;
10462 }
10463
10464 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10465 CHECK(!owner->result_ok);
10466         return DecodeError_clone(&*owner->contents.err);
10467 }
10468 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
10469         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10471         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10472         int64_t ret_ref = tag_ptr(ret_copy, true);
10473         return ret_ref;
10474 }
10475
10476 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10477         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
10478         ret.is_owned = false;
10479         return ret;
10480 }
10481 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_ok(int64_t owner) {
10482         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10483         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
10484         int64_t ret_ref = 0;
10485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10487         return ret_ref;
10488 }
10489
10490 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10491 CHECK(!owner->result_ok);
10492         return *owner->contents.err;
10493 }
10494 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_err(int64_t owner) {
10495         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10496         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
10497 }
10498
10499 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10500 CHECK(owner->result_ok);
10501         return *owner->contents.result;
10502 }
10503 ptrArray  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_ok(int64_t owner) {
10504         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10505         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
10506         ptrArray ret_arr = NULL;
10507         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
10508         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
10509         for (size_t i = 0; i < ret_var.datalen; i++) {
10510                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
10511                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
10512                 ret_arr_ptr[i] = ret_conv_8_arr;
10513         }
10514         
10515         return ret_arr;
10516 }
10517
10518 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10519 CHECK(!owner->result_ok);
10520         return *owner->contents.err;
10521 }
10522 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_err(int64_t owner) {
10523         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10524         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
10525 }
10526
10527 uint32_t CS_LDK_LDKCOption_usizeZ_ty_from_ptr(int64_t ptr) {
10528         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10529         switch(obj->tag) {
10530                 case LDKCOption_usizeZ_Some: return 0;
10531                 case LDKCOption_usizeZ_None: return 1;
10532                 default: abort();
10533         }
10534 }
10535 int64_t CS_LDK_LDKCOption_usizeZ_Some_get_some(int64_t ptr) {
10536         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10537         CHECK(obj->tag == LDKCOption_usizeZ_Some);
10538         int64_t some_conv = obj->some;
10539         return some_conv;
10540 }
10541 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10542         LDKShutdownScript ret = *owner->contents.result;
10543         ret.is_owned = false;
10544         return ret;
10545 }
10546 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_ok(int64_t owner) {
10547         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10548         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
10549         int64_t ret_ref = 0;
10550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10552         return ret_ref;
10553 }
10554
10555 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10556 CHECK(!owner->result_ok);
10557         return DecodeError_clone(&*owner->contents.err);
10558 }
10559 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_err(int64_t owner) {
10560         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10561         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10562         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
10563         int64_t ret_ref = tag_ptr(ret_copy, true);
10564         return ret_ref;
10565 }
10566
10567 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10568         LDKShutdownScript ret = *owner->contents.result;
10569         ret.is_owned = false;
10570         return ret;
10571 }
10572 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(int64_t owner) {
10573         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10574         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
10575         int64_t ret_ref = 0;
10576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10578         return ret_ref;
10579 }
10580
10581 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10582         LDKInvalidShutdownScript ret = *owner->contents.err;
10583         ret.is_owned = false;
10584         return ret;
10585 }
10586 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(int64_t owner) {
10587         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10588         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
10589         int64_t ret_ref = 0;
10590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10592         return ret_ref;
10593 }
10594
10595 uint32_t CS_LDK_LDKPaymentPurpose_ty_from_ptr(int64_t ptr) {
10596         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10597         switch(obj->tag) {
10598                 case LDKPaymentPurpose_InvoicePayment: return 0;
10599                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
10600                 default: abort();
10601         }
10602 }
10603 int64_t CS_LDK_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(int64_t ptr) {
10604         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10605         CHECK(obj->tag == LDKPaymentPurpose_InvoicePayment);
10606         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
10607         return payment_preimage_ref;
10608 }
10609 int8_tArray CS_LDK_LDKPaymentPurpose_InvoicePayment_get_payment_secret(int64_t ptr) {
10610         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10611         CHECK(obj->tag == LDKPaymentPurpose_InvoicePayment);
10612         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10613         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
10614         return payment_secret_arr;
10615 }
10616 int8_tArray CS_LDK_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(int64_t ptr) {
10617         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10618         CHECK(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
10619         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
10620         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
10621         return spontaneous_payment_arr;
10622 }
10623 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10624 CHECK(owner->result_ok);
10625         return PaymentPurpose_clone(&*owner->contents.result);
10626 }
10627 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_ok(int64_t owner) {
10628         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10629         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10630         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
10631         int64_t ret_ref = tag_ptr(ret_copy, true);
10632         return ret_ref;
10633 }
10634
10635 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10636 CHECK(!owner->result_ok);
10637         return DecodeError_clone(&*owner->contents.err);
10638 }
10639 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_err(int64_t owner) {
10640         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10642         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
10643         int64_t ret_ref = tag_ptr(ret_copy, true);
10644         return ret_ref;
10645 }
10646
10647 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10648         LDKClaimedHTLC ret = *owner->contents.result;
10649         ret.is_owned = false;
10650         return ret;
10651 }
10652 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_ok(int64_t owner) {
10653         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10654         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
10655         int64_t ret_ref = 0;
10656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10658         return ret_ref;
10659 }
10660
10661 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10662 CHECK(!owner->result_ok);
10663         return DecodeError_clone(&*owner->contents.err);
10664 }
10665 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_err(int64_t owner) {
10666         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10667         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10668         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
10669         int64_t ret_ref = tag_ptr(ret_copy, true);
10670         return ret_ref;
10671 }
10672
10673 uint32_t CS_LDK_LDKPathFailure_ty_from_ptr(int64_t ptr) {
10674         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10675         switch(obj->tag) {
10676                 case LDKPathFailure_InitialSend: return 0;
10677                 case LDKPathFailure_OnPath: return 1;
10678                 default: abort();
10679         }
10680 }
10681 int64_t CS_LDK_LDKPathFailure_InitialSend_get_err(int64_t ptr) {
10682         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10683         CHECK(obj->tag == LDKPathFailure_InitialSend);
10684         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
10685         return err_ref;
10686 }
10687 int64_t CS_LDK_LDKPathFailure_OnPath_get_network_update(int64_t ptr) {
10688         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10689         CHECK(obj->tag == LDKPathFailure_OnPath);
10690         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
10691         return network_update_ref;
10692 }
10693 uint32_t CS_LDK_LDKCOption_PathFailureZ_ty_from_ptr(int64_t ptr) {
10694         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10695         switch(obj->tag) {
10696                 case LDKCOption_PathFailureZ_Some: return 0;
10697                 case LDKCOption_PathFailureZ_None: return 1;
10698                 default: abort();
10699         }
10700 }
10701 int64_t CS_LDK_LDKCOption_PathFailureZ_Some_get_some(int64_t ptr) {
10702         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10703         CHECK(obj->tag == LDKCOption_PathFailureZ_Some);
10704         int64_t some_ref = tag_ptr(&obj->some, false);
10705         return some_ref;
10706 }
10707 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10708 CHECK(owner->result_ok);
10709         return COption_PathFailureZ_clone(&*owner->contents.result);
10710 }
10711 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_ok(int64_t owner) {
10712         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10713         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
10714         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
10715         int64_t ret_ref = tag_ptr(ret_copy, true);
10716         return ret_ref;
10717 }
10718
10719 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10720 CHECK(!owner->result_ok);
10721         return DecodeError_clone(&*owner->contents.err);
10722 }
10723 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_err(int64_t owner) {
10724         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10725         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10726         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
10727         int64_t ret_ref = tag_ptr(ret_copy, true);
10728         return ret_ref;
10729 }
10730
10731 uint32_t CS_LDK_LDKClosureReason_ty_from_ptr(int64_t ptr) {
10732         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10733         switch(obj->tag) {
10734                 case LDKClosureReason_CounterpartyForceClosed: return 0;
10735                 case LDKClosureReason_HolderForceClosed: return 1;
10736                 case LDKClosureReason_CooperativeClosure: return 2;
10737                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
10738                 case LDKClosureReason_FundingTimedOut: return 4;
10739                 case LDKClosureReason_ProcessingError: return 5;
10740                 case LDKClosureReason_DisconnectedPeer: return 6;
10741                 case LDKClosureReason_OutdatedChannelManager: return 7;
10742                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
10743                 case LDKClosureReason_FundingBatchClosure: return 9;
10744                 default: abort();
10745         }
10746 }
10747 int64_t CS_LDK_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(int64_t ptr) {
10748         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10749         CHECK(obj->tag == LDKClosureReason_CounterpartyForceClosed);
10750         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
10751                         int64_t peer_msg_ref = 0;
10752                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
10753                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
10754         return peer_msg_ref;
10755 }
10756 jstring CS_LDK_LDKClosureReason_ProcessingError_get_err(int64_t ptr) {
10757         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10758         CHECK(obj->tag == LDKClosureReason_ProcessingError);
10759         LDKStr err_str = obj->processing_error.err;
10760                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
10761         return err_conv;
10762 }
10763 uint32_t CS_LDK_LDKCOption_ClosureReasonZ_ty_from_ptr(int64_t ptr) {
10764         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10765         switch(obj->tag) {
10766                 case LDKCOption_ClosureReasonZ_Some: return 0;
10767                 case LDKCOption_ClosureReasonZ_None: return 1;
10768                 default: abort();
10769         }
10770 }
10771 int64_t CS_LDK_LDKCOption_ClosureReasonZ_Some_get_some(int64_t ptr) {
10772         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10773         CHECK(obj->tag == LDKCOption_ClosureReasonZ_Some);
10774         int64_t some_ref = tag_ptr(&obj->some, false);
10775         return some_ref;
10776 }
10777 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10778 CHECK(owner->result_ok);
10779         return COption_ClosureReasonZ_clone(&*owner->contents.result);
10780 }
10781 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(int64_t owner) {
10782         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10783         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
10784         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
10785         int64_t ret_ref = tag_ptr(ret_copy, true);
10786         return ret_ref;
10787 }
10788
10789 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10790 CHECK(!owner->result_ok);
10791         return DecodeError_clone(&*owner->contents.err);
10792 }
10793 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(int64_t owner) {
10794         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10795         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10796         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
10797         int64_t ret_ref = tag_ptr(ret_copy, true);
10798         return ret_ref;
10799 }
10800
10801 uint32_t CS_LDK_LDKHTLCDestination_ty_from_ptr(int64_t ptr) {
10802         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10803         switch(obj->tag) {
10804                 case LDKHTLCDestination_NextHopChannel: return 0;
10805                 case LDKHTLCDestination_UnknownNextHop: return 1;
10806                 case LDKHTLCDestination_InvalidForward: return 2;
10807                 case LDKHTLCDestination_FailedPayment: return 3;
10808                 default: abort();
10809         }
10810 }
10811 int8_tArray CS_LDK_LDKHTLCDestination_NextHopChannel_get_node_id(int64_t ptr) {
10812         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10813         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
10814         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10815         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
10816         return node_id_arr;
10817 }
10818 int8_tArray CS_LDK_LDKHTLCDestination_NextHopChannel_get_channel_id(int64_t ptr) {
10819         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10820         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
10821         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10822         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
10823         return channel_id_arr;
10824 }
10825 int64_t CS_LDK_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(int64_t ptr) {
10826         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10827         CHECK(obj->tag == LDKHTLCDestination_UnknownNextHop);
10828         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
10829         return requested_forward_scid_conv;
10830 }
10831 int64_t CS_LDK_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(int64_t ptr) {
10832         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10833         CHECK(obj->tag == LDKHTLCDestination_InvalidForward);
10834         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
10835         return requested_forward_scid_conv;
10836 }
10837 int8_tArray CS_LDK_LDKHTLCDestination_FailedPayment_get_payment_hash(int64_t ptr) {
10838         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10839         CHECK(obj->tag == LDKHTLCDestination_FailedPayment);
10840         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10841         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
10842         return payment_hash_arr;
10843 }
10844 uint32_t CS_LDK_LDKCOption_HTLCDestinationZ_ty_from_ptr(int64_t ptr) {
10845         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10846         switch(obj->tag) {
10847                 case LDKCOption_HTLCDestinationZ_Some: return 0;
10848                 case LDKCOption_HTLCDestinationZ_None: return 1;
10849                 default: abort();
10850         }
10851 }
10852 int64_t CS_LDK_LDKCOption_HTLCDestinationZ_Some_get_some(int64_t ptr) {
10853         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10854         CHECK(obj->tag == LDKCOption_HTLCDestinationZ_Some);
10855         int64_t some_ref = tag_ptr(&obj->some, false);
10856         return some_ref;
10857 }
10858 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10859 CHECK(owner->result_ok);
10860         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
10861 }
10862 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(int64_t owner) {
10863         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10864         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
10865         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
10866         int64_t ret_ref = tag_ptr(ret_copy, true);
10867         return ret_ref;
10868 }
10869
10870 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10871 CHECK(!owner->result_ok);
10872         return DecodeError_clone(&*owner->contents.err);
10873 }
10874 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(int64_t owner) {
10875         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10876         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10877         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
10878         int64_t ret_ref = tag_ptr(ret_copy, true);
10879         return ret_ref;
10880 }
10881
10882 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10883 CHECK(owner->result_ok);
10884         return PaymentFailureReason_clone(&*owner->contents.result);
10885 }
10886 int32_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(int64_t owner) {
10887         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10888         int32_t ret_conv = LDKPaymentFailureReason_to_cs(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
10889         return ret_conv;
10890 }
10891
10892 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10893 CHECK(!owner->result_ok);
10894         return DecodeError_clone(&*owner->contents.err);
10895 }
10896 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_err(int64_t owner) {
10897         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10898         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10899         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
10900         int64_t ret_ref = tag_ptr(ret_copy, true);
10901         return ret_ref;
10902 }
10903
10904 uint32_t CS_LDK_LDKCOption_U128Z_ty_from_ptr(int64_t ptr) {
10905         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10906         switch(obj->tag) {
10907                 case LDKCOption_U128Z_Some: return 0;
10908                 case LDKCOption_U128Z_None: return 1;
10909                 default: abort();
10910         }
10911 }
10912 int8_tArray CS_LDK_LDKCOption_U128Z_Some_get_some(int64_t ptr) {
10913         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10914         CHECK(obj->tag == LDKCOption_U128Z_Some);
10915         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
10916         memcpy(some_arr->elems, obj->some.le_bytes, 16);
10917         return some_arr;
10918 }
10919 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
10920         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
10921         for (size_t i = 0; i < ret.datalen; i++) {
10922                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
10923         }
10924         return ret;
10925 }
10926 uint32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(int64_t ptr) {
10927         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10928         switch(obj->tag) {
10929                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
10930                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
10931                 default: abort();
10932         }
10933 }
10934 int32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_Some_get_some(int64_t ptr) {
10935         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10936         CHECK(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
10937         int32_t some_conv = LDKPaymentFailureReason_to_cs(obj->some);
10938         return some_conv;
10939 }
10940 uint32_t CS_LDK_LDKBumpTransactionEvent_ty_from_ptr(int64_t ptr) {
10941         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10942         switch(obj->tag) {
10943                 case LDKBumpTransactionEvent_ChannelClose: return 0;
10944                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
10945                 default: abort();
10946         }
10947 }
10948 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_claim_id(int64_t ptr) {
10949         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10950         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10951         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
10952         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
10953         return claim_id_arr;
10954 }
10955 int32_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_package_target_feerate_sat_per_1000_weight(int64_t ptr) {
10956         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10957         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10958         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
10959         return package_target_feerate_sat_per_1000_weight_conv;
10960 }
10961 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(int64_t ptr) {
10962         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10963         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10964         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
10965                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
10966                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
10967         return commitment_tx_arr;
10968 }
10969 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(int64_t ptr) {
10970         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10971         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10972         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
10973         return commitment_tx_fee_satoshis_conv;
10974 }
10975 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(int64_t ptr) {
10976         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10977         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10978         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
10979                         int64_t anchor_descriptor_ref = 0;
10980                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
10981                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
10982         return anchor_descriptor_ref;
10983 }
10984 int64_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(int64_t ptr) {
10985         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10986         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10987         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
10988                         int64_tArray pending_htlcs_arr = NULL;
10989                         pending_htlcs_arr = init_int64_tArray(pending_htlcs_var.datalen, __LINE__);
10990                         int64_t *pending_htlcs_arr_ptr = (int64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
10991                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
10992                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
10993                                 int64_t pending_htlcs_conv_24_ref = 0;
10994                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
10995                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
10996                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
10997                         }
10998                         
10999         return pending_htlcs_arr;
11000 }
11001 int8_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(int64_t ptr) {
11002         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11003         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11004         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11005         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
11006         return claim_id_arr;
11007 }
11008 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_target_feerate_sat_per_1000_weight(int64_t ptr) {
11009         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11010         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11011         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
11012         return target_feerate_sat_per_1000_weight_conv;
11013 }
11014 int64_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(int64_t ptr) {
11015         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11016         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11017         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
11018                         int64_tArray htlc_descriptors_arr = NULL;
11019                         htlc_descriptors_arr = init_int64_tArray(htlc_descriptors_var.datalen, __LINE__);
11020                         int64_t *htlc_descriptors_arr_ptr = (int64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
11021                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
11022                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
11023                                 int64_t htlc_descriptors_conv_16_ref = 0;
11024                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
11025                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
11026                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
11027                         }
11028                         
11029         return htlc_descriptors_arr;
11030 }
11031 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(int64_t ptr) {
11032         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11033         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11034         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
11035         return tx_lock_time_conv;
11036 }
11037 uint32_t CS_LDK_LDKEvent_ty_from_ptr(int64_t ptr) {
11038         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11039         switch(obj->tag) {
11040                 case LDKEvent_FundingGenerationReady: return 0;
11041                 case LDKEvent_PaymentClaimable: return 1;
11042                 case LDKEvent_PaymentClaimed: return 2;
11043                 case LDKEvent_ConnectionNeeded: return 3;
11044                 case LDKEvent_InvoiceRequestFailed: return 4;
11045                 case LDKEvent_PaymentSent: return 5;
11046                 case LDKEvent_PaymentFailed: return 6;
11047                 case LDKEvent_PaymentPathSuccessful: return 7;
11048                 case LDKEvent_PaymentPathFailed: return 8;
11049                 case LDKEvent_ProbeSuccessful: return 9;
11050                 case LDKEvent_ProbeFailed: return 10;
11051                 case LDKEvent_PendingHTLCsForwardable: return 11;
11052                 case LDKEvent_HTLCIntercepted: return 12;
11053                 case LDKEvent_SpendableOutputs: return 13;
11054                 case LDKEvent_PaymentForwarded: return 14;
11055                 case LDKEvent_ChannelPending: return 15;
11056                 case LDKEvent_ChannelReady: return 16;
11057                 case LDKEvent_ChannelClosed: return 17;
11058                 case LDKEvent_DiscardFunding: return 18;
11059                 case LDKEvent_OpenChannelRequest: return 19;
11060                 case LDKEvent_HTLCHandlingFailed: return 20;
11061                 case LDKEvent_BumpTransaction: return 21;
11062                 default: abort();
11063         }
11064 }
11065 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_temporary_channel_id(int64_t ptr) {
11066         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11067         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11068         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
11069         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
11070         return temporary_channel_id_arr;
11071 }
11072 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_counterparty_node_id(int64_t ptr) {
11073         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11074         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11075         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11076         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
11077         return counterparty_node_id_arr;
11078 }
11079 int64_t CS_LDK_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(int64_t ptr) {
11080         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11081         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11082         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
11083         return channel_value_satoshis_conv;
11084 }
11085 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_output_script(int64_t ptr) {
11086         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11087         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11088         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
11089                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
11090                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
11091         return output_script_arr;
11092 }
11093 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_user_channel_id(int64_t ptr) {
11094         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11095         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11096         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11097         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
11098         return user_channel_id_arr;
11099 }
11100 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_receiver_node_id(int64_t ptr) {
11101         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11102         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11103         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11104         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
11105         return receiver_node_id_arr;
11106 }
11107 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_payment_hash(int64_t ptr) {
11108         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11109         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11110         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11111         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
11112         return payment_hash_arr;
11113 }
11114 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_onion_fields(int64_t ptr) {
11115         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11116         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11117         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
11118                         int64_t onion_fields_ref = 0;
11119                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
11120                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
11121         return onion_fields_ref;
11122 }
11123 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_amount_msat(int64_t ptr) {
11124         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11125         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11126         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
11127         return amount_msat_conv;
11128 }
11129 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(int64_t ptr) {
11130         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11131         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11132         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
11133         return counterparty_skimmed_fee_msat_conv;
11134 }
11135 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_purpose(int64_t ptr) {
11136         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11137         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11138         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
11139         return purpose_ref;
11140 }
11141 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_channel_id(int64_t ptr) {
11142         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11143         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11144         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
11145         return via_channel_id_ref;
11146 }
11147 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_user_channel_id(int64_t ptr) {
11148         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11149         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11150         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
11151         return via_user_channel_id_ref;
11152 }
11153 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_claim_deadline(int64_t ptr) {
11154         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11155         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11156         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
11157         return claim_deadline_ref;
11158 }
11159 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_receiver_node_id(int64_t ptr) {
11160         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11161         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11162         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11163         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
11164         return receiver_node_id_arr;
11165 }
11166 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_payment_hash(int64_t ptr) {
11167         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11168         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11169         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11170         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
11171         return payment_hash_arr;
11172 }
11173 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_amount_msat(int64_t ptr) {
11174         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11175         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11176         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
11177         return amount_msat_conv;
11178 }
11179 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_purpose(int64_t ptr) {
11180         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11181         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11182         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
11183         return purpose_ref;
11184 }
11185 int64_tArray CS_LDK_LDKEvent_PaymentClaimed_get_htlcs(int64_t ptr) {
11186         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11187         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11188         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
11189                         int64_tArray htlcs_arr = NULL;
11190                         htlcs_arr = init_int64_tArray(htlcs_var.datalen, __LINE__);
11191                         int64_t *htlcs_arr_ptr = (int64_t*)(((uint8_t*)htlcs_arr) + 8);
11192                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
11193                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
11194                                 int64_t htlcs_conv_13_ref = 0;
11195                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
11196                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
11197                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
11198                         }
11199                         
11200         return htlcs_arr;
11201 }
11202 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(int64_t ptr) {
11203         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11204         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11205         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
11206         return sender_intended_total_msat_ref;
11207 }
11208 int8_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_node_id(int64_t ptr) {
11209         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11210         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
11211         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11212         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
11213         return node_id_arr;
11214 }
11215 int64_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_addresses(int64_t ptr) {
11216         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11217         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
11218         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
11219                         int64_tArray addresses_arr = NULL;
11220                         addresses_arr = init_int64_tArray(addresses_var.datalen, __LINE__);
11221                         int64_t *addresses_arr_ptr = (int64_t*)(((uint8_t*)addresses_arr) + 8);
11222                         for (size_t p = 0; p < addresses_var.datalen; p++) {
11223                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
11224                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
11225                         }
11226                         
11227         return addresses_arr;
11228 }
11229 int8_tArray CS_LDK_LDKEvent_InvoiceRequestFailed_get_payment_id(int64_t ptr) {
11230         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11231         CHECK(obj->tag == LDKEvent_InvoiceRequestFailed);
11232         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11233         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
11234         return payment_id_arr;
11235 }
11236 int64_t CS_LDK_LDKEvent_PaymentSent_get_payment_id(int64_t ptr) {
11237         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11238         CHECK(obj->tag == LDKEvent_PaymentSent);
11239         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
11240         return payment_id_ref;
11241 }
11242 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_preimage(int64_t ptr) {
11243         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11244         CHECK(obj->tag == LDKEvent_PaymentSent);
11245         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11246         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
11247         return payment_preimage_arr;
11248 }
11249 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_hash(int64_t ptr) {
11250         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11251         CHECK(obj->tag == LDKEvent_PaymentSent);
11252         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11253         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
11254         return payment_hash_arr;
11255 }
11256 int64_t CS_LDK_LDKEvent_PaymentSent_get_fee_paid_msat(int64_t ptr) {
11257         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11258         CHECK(obj->tag == LDKEvent_PaymentSent);
11259         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
11260         return fee_paid_msat_ref;
11261 }
11262 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_id(int64_t ptr) {
11263         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11264         CHECK(obj->tag == LDKEvent_PaymentFailed);
11265         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11266         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
11267         return payment_id_arr;
11268 }
11269 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_hash(int64_t ptr) {
11270         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11271         CHECK(obj->tag == LDKEvent_PaymentFailed);
11272         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11273         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
11274         return payment_hash_arr;
11275 }
11276 int64_t CS_LDK_LDKEvent_PaymentFailed_get_reason(int64_t ptr) {
11277         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11278         CHECK(obj->tag == LDKEvent_PaymentFailed);
11279         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
11280         return reason_ref;
11281 }
11282 int8_tArray CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_id(int64_t ptr) {
11283         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11284         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
11285         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11286         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
11287         return payment_id_arr;
11288 }
11289 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_hash(int64_t ptr) {
11290         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11291         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
11292         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
11293         return payment_hash_ref;
11294 }
11295 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_path(int64_t ptr) {
11296         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11297         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
11298         LDKPath path_var = obj->payment_path_successful.path;
11299                         int64_t path_ref = 0;
11300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11301                         path_ref = tag_ptr(path_var.inner, false);
11302         return path_ref;
11303 }
11304 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_payment_id(int64_t ptr) {
11305         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11306         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11307         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
11308         return payment_id_ref;
11309 }
11310 int8_tArray CS_LDK_LDKEvent_PaymentPathFailed_get_payment_hash(int64_t ptr) {
11311         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11312         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11313         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11314         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
11315         return payment_hash_arr;
11316 }
11317 jboolean CS_LDK_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(int64_t ptr) {
11318         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11319         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11320         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
11321         return payment_failed_permanently_conv;
11322 }
11323 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_failure(int64_t ptr) {
11324         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11325         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11326         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
11327         return failure_ref;
11328 }
11329 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_path(int64_t ptr) {
11330         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11331         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11332         LDKPath path_var = obj->payment_path_failed.path;
11333                         int64_t path_ref = 0;
11334                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11335                         path_ref = tag_ptr(path_var.inner, false);
11336         return path_ref;
11337 }
11338 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_short_channel_id(int64_t ptr) {
11339         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11340         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11341         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
11342         return short_channel_id_ref;
11343 }
11344 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_id(int64_t ptr) {
11345         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11346         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
11347         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11348         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
11349         return payment_id_arr;
11350 }
11351 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_hash(int64_t ptr) {
11352         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11353         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
11354         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11355         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
11356         return payment_hash_arr;
11357 }
11358 int64_t CS_LDK_LDKEvent_ProbeSuccessful_get_path(int64_t ptr) {
11359         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11360         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
11361         LDKPath path_var = obj->probe_successful.path;
11362                         int64_t path_ref = 0;
11363                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11364                         path_ref = tag_ptr(path_var.inner, false);
11365         return path_ref;
11366 }
11367 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_id(int64_t ptr) {
11368         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11369         CHECK(obj->tag == LDKEvent_ProbeFailed);
11370         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11371         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
11372         return payment_id_arr;
11373 }
11374 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_hash(int64_t ptr) {
11375         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11376         CHECK(obj->tag == LDKEvent_ProbeFailed);
11377         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11378         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
11379         return payment_hash_arr;
11380 }
11381 int64_t CS_LDK_LDKEvent_ProbeFailed_get_path(int64_t ptr) {
11382         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11383         CHECK(obj->tag == LDKEvent_ProbeFailed);
11384         LDKPath path_var = obj->probe_failed.path;
11385                         int64_t path_ref = 0;
11386                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11387                         path_ref = tag_ptr(path_var.inner, false);
11388         return path_ref;
11389 }
11390 int64_t CS_LDK_LDKEvent_ProbeFailed_get_short_channel_id(int64_t ptr) {
11391         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11392         CHECK(obj->tag == LDKEvent_ProbeFailed);
11393         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
11394         return short_channel_id_ref;
11395 }
11396 int64_t CS_LDK_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(int64_t ptr) {
11397         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11398         CHECK(obj->tag == LDKEvent_PendingHTLCsForwardable);
11399         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
11400         return time_forwardable_conv;
11401 }
11402 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_intercept_id(int64_t ptr) {
11403         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11404         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11405         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
11406         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
11407         return intercept_id_arr;
11408 }
11409 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(int64_t ptr) {
11410         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11411         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11412         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
11413         return requested_next_hop_scid_conv;
11414 }
11415 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_payment_hash(int64_t ptr) {
11416         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11417         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11418         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11419         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
11420         return payment_hash_arr;
11421 }
11422 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(int64_t ptr) {
11423         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11424         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11425         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
11426         return inbound_amount_msat_conv;
11427 }
11428 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(int64_t ptr) {
11429         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11430         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11431         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
11432         return expected_outbound_amount_msat_conv;
11433 }
11434 int64_tArray CS_LDK_LDKEvent_SpendableOutputs_get_outputs(int64_t ptr) {
11435         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11436         CHECK(obj->tag == LDKEvent_SpendableOutputs);
11437         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
11438                         int64_tArray outputs_arr = NULL;
11439                         outputs_arr = init_int64_tArray(outputs_var.datalen, __LINE__);
11440                         int64_t *outputs_arr_ptr = (int64_t*)(((uint8_t*)outputs_arr) + 8);
11441                         for (size_t b = 0; b < outputs_var.datalen; b++) {
11442                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
11443                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
11444                         }
11445                         
11446         return outputs_arr;
11447 }
11448 int64_t CS_LDK_LDKEvent_SpendableOutputs_get_channel_id(int64_t ptr) {
11449         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11450         CHECK(obj->tag == LDKEvent_SpendableOutputs);
11451         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
11452         return channel_id_ref;
11453 }
11454 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_prev_channel_id(int64_t ptr) {
11455         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11456         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11457         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
11458         return prev_channel_id_ref;
11459 }
11460 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_next_channel_id(int64_t ptr) {
11461         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11462         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11463         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
11464         return next_channel_id_ref;
11465 }
11466 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_fee_earned_msat(int64_t ptr) {
11467         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11468         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11469         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
11470         return fee_earned_msat_ref;
11471 }
11472 jboolean CS_LDK_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(int64_t ptr) {
11473         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11474         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11475         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
11476         return claim_from_onchain_tx_conv;
11477 }
11478 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(int64_t ptr) {
11479         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11480         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11481         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
11482         return outbound_amount_forwarded_msat_ref;
11483 }
11484 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_channel_id(int64_t ptr) {
11485         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11486         CHECK(obj->tag == LDKEvent_ChannelPending);
11487         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11488         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
11489         return channel_id_arr;
11490 }
11491 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_user_channel_id(int64_t ptr) {
11492         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11493         CHECK(obj->tag == LDKEvent_ChannelPending);
11494         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11495         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
11496         return user_channel_id_arr;
11497 }
11498 int64_t CS_LDK_LDKEvent_ChannelPending_get_former_temporary_channel_id(int64_t ptr) {
11499         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11500         CHECK(obj->tag == LDKEvent_ChannelPending);
11501         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
11502         return former_temporary_channel_id_ref;
11503 }
11504 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_counterparty_node_id(int64_t ptr) {
11505         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11506         CHECK(obj->tag == LDKEvent_ChannelPending);
11507         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11508         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
11509         return counterparty_node_id_arr;
11510 }
11511 int64_t CS_LDK_LDKEvent_ChannelPending_get_funding_txo(int64_t ptr) {
11512         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11513         CHECK(obj->tag == LDKEvent_ChannelPending);
11514         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
11515                         int64_t funding_txo_ref = 0;
11516                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
11517                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
11518         return funding_txo_ref;
11519 }
11520 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_channel_id(int64_t ptr) {
11521         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11522         CHECK(obj->tag == LDKEvent_ChannelReady);
11523         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11524         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
11525         return channel_id_arr;
11526 }
11527 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_user_channel_id(int64_t ptr) {
11528         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11529         CHECK(obj->tag == LDKEvent_ChannelReady);
11530         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11531         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
11532         return user_channel_id_arr;
11533 }
11534 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_counterparty_node_id(int64_t ptr) {
11535         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11536         CHECK(obj->tag == LDKEvent_ChannelReady);
11537         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11538         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
11539         return counterparty_node_id_arr;
11540 }
11541 int64_t CS_LDK_LDKEvent_ChannelReady_get_channel_type(int64_t ptr) {
11542         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11543         CHECK(obj->tag == LDKEvent_ChannelReady);
11544         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
11545                         int64_t channel_type_ref = 0;
11546                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11547                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11548         return channel_type_ref;
11549 }
11550 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_channel_id(int64_t ptr) {
11551         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11552         CHECK(obj->tag == LDKEvent_ChannelClosed);
11553         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11554         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
11555         return channel_id_arr;
11556 }
11557 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_user_channel_id(int64_t ptr) {
11558         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11559         CHECK(obj->tag == LDKEvent_ChannelClosed);
11560         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11561         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
11562         return user_channel_id_arr;
11563 }
11564 int64_t CS_LDK_LDKEvent_ChannelClosed_get_reason(int64_t ptr) {
11565         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11566         CHECK(obj->tag == LDKEvent_ChannelClosed);
11567         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
11568         return reason_ref;
11569 }
11570 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_counterparty_node_id(int64_t ptr) {
11571         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11572         CHECK(obj->tag == LDKEvent_ChannelClosed);
11573         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11574         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
11575         return counterparty_node_id_arr;
11576 }
11577 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_capacity_sats(int64_t ptr) {
11578         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11579         CHECK(obj->tag == LDKEvent_ChannelClosed);
11580         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
11581         return channel_capacity_sats_ref;
11582 }
11583 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_funding_txo(int64_t ptr) {
11584         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11585         CHECK(obj->tag == LDKEvent_ChannelClosed);
11586         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
11587                         int64_t channel_funding_txo_ref = 0;
11588                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
11589                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
11590         return channel_funding_txo_ref;
11591 }
11592 int8_tArray CS_LDK_LDKEvent_DiscardFunding_get_channel_id(int64_t ptr) {
11593         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11594         CHECK(obj->tag == LDKEvent_DiscardFunding);
11595         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11596         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
11597         return channel_id_arr;
11598 }
11599 int8_tArray CS_LDK_LDKEvent_DiscardFunding_get_transaction(int64_t ptr) {
11600         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11601         CHECK(obj->tag == LDKEvent_DiscardFunding);
11602         LDKTransaction transaction_var = obj->discard_funding.transaction;
11603                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
11604                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
11605         return transaction_arr;
11606 }
11607 int8_tArray CS_LDK_LDKEvent_OpenChannelRequest_get_temporary_channel_id(int64_t ptr) {
11608         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11609         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11610         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
11611         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
11612         return temporary_channel_id_arr;
11613 }
11614 int8_tArray CS_LDK_LDKEvent_OpenChannelRequest_get_counterparty_node_id(int64_t ptr) {
11615         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11616         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11617         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11618         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
11619         return counterparty_node_id_arr;
11620 }
11621 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_funding_satoshis(int64_t ptr) {
11622         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11623         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11624         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
11625         return funding_satoshis_conv;
11626 }
11627 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_push_msat(int64_t ptr) {
11628         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11629         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11630         int64_t push_msat_conv = obj->open_channel_request.push_msat;
11631         return push_msat_conv;
11632 }
11633 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_channel_type(int64_t ptr) {
11634         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11635         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11636         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
11637                         int64_t channel_type_ref = 0;
11638                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11639                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11640         return channel_type_ref;
11641 }
11642 int8_tArray CS_LDK_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(int64_t ptr) {
11643         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11644         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
11645         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
11646         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
11647         return prev_channel_id_arr;
11648 }
11649 int64_t CS_LDK_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(int64_t ptr) {
11650         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11651         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
11652         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
11653         return failed_next_destination_ref;
11654 }
11655 int64_t CS_LDK_LDKEvent_BumpTransaction_get_bump_transaction(int64_t ptr) {
11656         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11657         CHECK(obj->tag == LDKEvent_BumpTransaction);
11658         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
11659         return bump_transaction_ref;
11660 }
11661 uint32_t CS_LDK_LDKCOption_EventZ_ty_from_ptr(int64_t ptr) {
11662         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11663         switch(obj->tag) {
11664                 case LDKCOption_EventZ_Some: return 0;
11665                 case LDKCOption_EventZ_None: return 1;
11666                 default: abort();
11667         }
11668 }
11669 int64_t CS_LDK_LDKCOption_EventZ_Some_get_some(int64_t ptr) {
11670         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11671         CHECK(obj->tag == LDKCOption_EventZ_Some);
11672         int64_t some_ref = tag_ptr(&obj->some, false);
11673         return some_ref;
11674 }
11675 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11676 CHECK(owner->result_ok);
11677         return COption_EventZ_clone(&*owner->contents.result);
11678 }
11679 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_ok(int64_t owner) {
11680         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11681         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11682         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
11683         int64_t ret_ref = tag_ptr(ret_copy, true);
11684         return ret_ref;
11685 }
11686
11687 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11688 CHECK(!owner->result_ok);
11689         return DecodeError_clone(&*owner->contents.err);
11690 }
11691 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_err(int64_t owner) {
11692         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11693         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11694         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
11695         int64_t ret_ref = tag_ptr(ret_copy, true);
11696         return ret_ref;
11697 }
11698
11699 uint32_t CS_LDK_LDKBolt11ParseError_ty_from_ptr(int64_t ptr) {
11700         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11701         switch(obj->tag) {
11702                 case LDKBolt11ParseError_Bech32Error: return 0;
11703                 case LDKBolt11ParseError_ParseAmountError: return 1;
11704                 case LDKBolt11ParseError_MalformedSignature: return 2;
11705                 case LDKBolt11ParseError_BadPrefix: return 3;
11706                 case LDKBolt11ParseError_UnknownCurrency: return 4;
11707                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
11708                 case LDKBolt11ParseError_MalformedHRP: return 6;
11709                 case LDKBolt11ParseError_TooShortDataPart: return 7;
11710                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
11711                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
11712                 case LDKBolt11ParseError_PaddingError: return 10;
11713                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
11714                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
11715                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
11716                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
11717                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
11718                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
11719                 case LDKBolt11ParseError_Skip: return 17;
11720                 default: abort();
11721         }
11722 }
11723 int64_t CS_LDK_LDKBolt11ParseError_Bech32Error_get_bech32_error(int64_t ptr) {
11724         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11725         CHECK(obj->tag == LDKBolt11ParseError_Bech32Error);
11726         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
11727         return bech32_error_ref;
11728 }
11729 int32_t CS_LDK_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(int64_t ptr) {
11730         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11731         CHECK(obj->tag == LDKBolt11ParseError_ParseAmountError);
11732         /*obj->parse_amount_error*/
11733         return 0;
11734 }
11735 int32_t CS_LDK_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(int64_t ptr) {
11736         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11737         CHECK(obj->tag == LDKBolt11ParseError_MalformedSignature);
11738         int32_t malformed_signature_conv = LDKSecp256k1Error_to_cs(obj->malformed_signature);
11739         return malformed_signature_conv;
11740 }
11741 int32_t CS_LDK_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(int64_t ptr) {
11742         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11743         CHECK(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
11744         /*obj->description_decode_error*/
11745         return 0;
11746 }
11747 jstring CS_LDK_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(int64_t ptr) {
11748         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11749         CHECK(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
11750         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
11751                         jstring invalid_slice_length_conv = str_ref_to_cs(invalid_slice_length_str.chars, invalid_slice_length_str.len);
11752         return invalid_slice_length_conv;
11753 }
11754 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11755 CHECK(owner->result_ok);
11756         return SiPrefix_clone(&*owner->contents.result);
11757 }
11758 int32_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_ok(int64_t owner) {
11759         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11760         int32_t ret_conv = LDKSiPrefix_to_cs(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
11761         return ret_conv;
11762 }
11763
11764 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11765 CHECK(!owner->result_ok);
11766         return Bolt11ParseError_clone(&*owner->contents.err);
11767 }
11768 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_err(int64_t owner) {
11769         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11770         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11771         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
11772         int64_t ret_ref = tag_ptr(ret_copy, true);
11773         return ret_ref;
11774 }
11775
11776 uint32_t CS_LDK_LDKParseOrSemanticError_ty_from_ptr(int64_t ptr) {
11777         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11778         switch(obj->tag) {
11779                 case LDKParseOrSemanticError_ParseError: return 0;
11780                 case LDKParseOrSemanticError_SemanticError: return 1;
11781                 default: abort();
11782         }
11783 }
11784 int64_t CS_LDK_LDKParseOrSemanticError_ParseError_get_parse_error(int64_t ptr) {
11785         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11786         CHECK(obj->tag == LDKParseOrSemanticError_ParseError);
11787         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
11788         return parse_error_ref;
11789 }
11790 int32_t CS_LDK_LDKParseOrSemanticError_SemanticError_get_semantic_error(int64_t ptr) {
11791         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11792         CHECK(obj->tag == LDKParseOrSemanticError_SemanticError);
11793         int32_t semantic_error_conv = LDKBolt11SemanticError_to_cs(obj->semantic_error);
11794         return semantic_error_conv;
11795 }
11796 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11797         LDKBolt11Invoice ret = *owner->contents.result;
11798         ret.is_owned = false;
11799         return ret;
11800 }
11801 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(int64_t owner) {
11802         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11803         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
11804         int64_t ret_ref = 0;
11805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11807         return ret_ref;
11808 }
11809
11810 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11811 CHECK(!owner->result_ok);
11812         return ParseOrSemanticError_clone(&*owner->contents.err);
11813 }
11814 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(int64_t owner) {
11815         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11816         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
11817         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
11818         int64_t ret_ref = tag_ptr(ret_copy, true);
11819         return ret_ref;
11820 }
11821
11822 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11823         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
11824         ret.is_owned = false;
11825         return ret;
11826 }
11827 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(int64_t owner) {
11828         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11829         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
11830         int64_t ret_ref = 0;
11831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11833         return ret_ref;
11834 }
11835
11836 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11837 CHECK(!owner->result_ok);
11838         return Bolt11ParseError_clone(&*owner->contents.err);
11839 }
11840 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(int64_t owner) {
11841         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11842         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11843         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
11844         int64_t ret_ref = tag_ptr(ret_copy, true);
11845         return ret_ref;
11846 }
11847
11848 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11849         LDKRawBolt11Invoice ret = owner->a;
11850         ret.is_owned = false;
11851         return ret;
11852 }
11853 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(int64_t owner) {
11854         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11855         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
11856         int64_t ret_ref = 0;
11857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11859         return ret_ref;
11860 }
11861
11862 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11863         return ThirtyTwoBytes_clone(&owner->b);
11864 }
11865 int8_tArray  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(int64_t owner) {
11866         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11867         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11868         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
11869         return ret_arr;
11870 }
11871
11872 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11873         LDKBolt11InvoiceSignature ret = owner->c;
11874         ret.is_owned = false;
11875         return ret;
11876 }
11877 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(int64_t owner) {
11878         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11879         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
11880         int64_t ret_ref = 0;
11881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11883         return ret_ref;
11884 }
11885
11886 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11887         LDKPayeePubKey ret = *owner->contents.result;
11888         ret.is_owned = false;
11889         return ret;
11890 }
11891 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(int64_t owner) {
11892         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11893         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
11894         int64_t ret_ref = 0;
11895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11897         return ret_ref;
11898 }
11899
11900 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11901 CHECK(!owner->result_ok);
11902         return *owner->contents.err;
11903 }
11904 int32_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_err(int64_t owner) {
11905         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11906         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
11907         return ret_conv;
11908 }
11909
11910 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
11911         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
11912         for (size_t i = 0; i < ret.datalen; i++) {
11913                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
11914         }
11915         return ret;
11916 }
11917 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11918         LDKPositiveTimestamp ret = *owner->contents.result;
11919         ret.is_owned = false;
11920         return ret;
11921 }
11922 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_ok(int64_t owner) {
11923         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11924         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
11925         int64_t ret_ref = 0;
11926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11928         return ret_ref;
11929 }
11930
11931 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11932 CHECK(!owner->result_ok);
11933         return CreationError_clone(&*owner->contents.err);
11934 }
11935 int32_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_err(int64_t owner) {
11936         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11937         int32_t ret_conv = LDKCreationError_to_cs(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
11938         return ret_conv;
11939 }
11940
11941 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11942 CHECK(owner->result_ok);
11943         return *owner->contents.result;
11944 }
11945 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_ok(int64_t owner) {
11946         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11947         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
11948 }
11949
11950 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11951 CHECK(!owner->result_ok);
11952         return Bolt11SemanticError_clone(&*owner->contents.err);
11953 }
11954 int32_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_err(int64_t owner) {
11955         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11956         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
11957         return ret_conv;
11958 }
11959
11960 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11961         LDKBolt11Invoice ret = *owner->contents.result;
11962         ret.is_owned = false;
11963         return ret;
11964 }
11965 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(int64_t owner) {
11966         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11967         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
11968         int64_t ret_ref = 0;
11969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11971         return ret_ref;
11972 }
11973
11974 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11975 CHECK(!owner->result_ok);
11976         return Bolt11SemanticError_clone(&*owner->contents.err);
11977 }
11978 int32_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(int64_t owner) {
11979         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11980         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
11981         return ret_conv;
11982 }
11983
11984 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11985         LDKDescription ret = *owner->contents.result;
11986         ret.is_owned = false;
11987         return ret;
11988 }
11989 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_ok(int64_t owner) {
11990         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
11991         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
11992         int64_t ret_ref = 0;
11993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11995         return ret_ref;
11996 }
11997
11998 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11999 CHECK(!owner->result_ok);
12000         return CreationError_clone(&*owner->contents.err);
12001 }
12002 int32_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_err(int64_t owner) {
12003         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12004         int32_t ret_conv = LDKCreationError_to_cs(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
12005         return ret_conv;
12006 }
12007
12008 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12009         LDKPrivateRoute ret = *owner->contents.result;
12010         ret.is_owned = false;
12011         return ret;
12012 }
12013 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_ok(int64_t owner) {
12014         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12015         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
12016         int64_t ret_ref = 0;
12017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12019         return ret_ref;
12020 }
12021
12022 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12023 CHECK(!owner->result_ok);
12024         return CreationError_clone(&*owner->contents.err);
12025 }
12026 int32_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_err(int64_t owner) {
12027         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12028         int32_t ret_conv = LDKCreationError_to_cs(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
12029         return ret_conv;
12030 }
12031
12032 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12033         LDKOutPoint ret = *owner->contents.result;
12034         ret.is_owned = false;
12035         return ret;
12036 }
12037 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_ok(int64_t owner) {
12038         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12039         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
12040         int64_t ret_ref = 0;
12041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12043         return ret_ref;
12044 }
12045
12046 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12047 CHECK(!owner->result_ok);
12048         return DecodeError_clone(&*owner->contents.err);
12049 }
12050 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_err(int64_t owner) {
12051         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12052         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12053         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
12054         int64_t ret_ref = tag_ptr(ret_copy, true);
12055         return ret_ref;
12056 }
12057
12058 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12059         LDKBigSize ret = *owner->contents.result;
12060         ret.is_owned = false;
12061         return ret;
12062 }
12063 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_ok(int64_t owner) {
12064         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12065         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
12066         int64_t ret_ref = 0;
12067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12069         return ret_ref;
12070 }
12071
12072 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12073 CHECK(!owner->result_ok);
12074         return DecodeError_clone(&*owner->contents.err);
12075 }
12076 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_err(int64_t owner) {
12077         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12078         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12079         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
12080         int64_t ret_ref = tag_ptr(ret_copy, true);
12081         return ret_ref;
12082 }
12083
12084 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12085         LDKHostname ret = *owner->contents.result;
12086         ret.is_owned = false;
12087         return ret;
12088 }
12089 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_ok(int64_t owner) {
12090         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12091         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
12092         int64_t ret_ref = 0;
12093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12095         return ret_ref;
12096 }
12097
12098 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12099 CHECK(!owner->result_ok);
12100         return DecodeError_clone(&*owner->contents.err);
12101 }
12102 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_err(int64_t owner) {
12103         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12104         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12105         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
12106         int64_t ret_ref = tag_ptr(ret_copy, true);
12107         return ret_ref;
12108 }
12109
12110 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12111         LDKTransactionU16LenLimited ret = *owner->contents.result;
12112         ret.is_owned = false;
12113         return ret;
12114 }
12115 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_ok(int64_t owner) {
12116         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12117         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
12118         int64_t ret_ref = 0;
12119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12121         return ret_ref;
12122 }
12123
12124 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12125 CHECK(!owner->result_ok);
12126         return *owner->contents.err;
12127 }
12128 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_err(int64_t owner) {
12129         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12130         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
12131 }
12132
12133 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12134         LDKTransactionU16LenLimited ret = *owner->contents.result;
12135         ret.is_owned = false;
12136         return ret;
12137 }
12138 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(int64_t owner) {
12139         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12140         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
12141         int64_t ret_ref = 0;
12142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12144         return ret_ref;
12145 }
12146
12147 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12148 CHECK(!owner->result_ok);
12149         return DecodeError_clone(&*owner->contents.err);
12150 }
12151 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(int64_t owner) {
12152         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12153         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12154         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
12155         int64_t ret_ref = tag_ptr(ret_copy, true);
12156         return ret_ref;
12157 }
12158
12159 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12160         LDKUntrustedString ret = *owner->contents.result;
12161         ret.is_owned = false;
12162         return ret;
12163 }
12164 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_ok(int64_t owner) {
12165         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12166         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
12167         int64_t ret_ref = 0;
12168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12170         return ret_ref;
12171 }
12172
12173 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12174 CHECK(!owner->result_ok);
12175         return DecodeError_clone(&*owner->contents.err);
12176 }
12177 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_err(int64_t owner) {
12178         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12179         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12180         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
12181         int64_t ret_ref = tag_ptr(ret_copy, true);
12182         return ret_ref;
12183 }
12184
12185 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12186         return ThirtyTwoBytes_clone(&owner->a);
12187 }
12188 int8_tArray  CS_LDK_C2Tuple__u832u16Z_get_a(int64_t owner) {
12189         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12190         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12191         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
12192         return ret_arr;
12193 }
12194
12195 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12196         return owner->b;
12197 }
12198 int16_t  CS_LDK_C2Tuple__u832u16Z_get_b(int64_t owner) {
12199         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12200         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
12201         return ret_conv;
12202 }
12203
12204 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12205         LDKPaymentRelay ret = *owner->contents.result;
12206         ret.is_owned = false;
12207         return ret;
12208 }
12209 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_ok(int64_t owner) {
12210         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12211         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
12212         int64_t ret_ref = 0;
12213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12215         return ret_ref;
12216 }
12217
12218 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12219 CHECK(!owner->result_ok);
12220         return DecodeError_clone(&*owner->contents.err);
12221 }
12222 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_err(int64_t owner) {
12223         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12224         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12225         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
12226         int64_t ret_ref = tag_ptr(ret_copy, true);
12227         return ret_ref;
12228 }
12229
12230 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12231         LDKPaymentConstraints ret = *owner->contents.result;
12232         ret.is_owned = false;
12233         return ret;
12234 }
12235 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_ok(int64_t owner) {
12236         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12237         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
12238         int64_t ret_ref = 0;
12239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12241         return ret_ref;
12242 }
12243
12244 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12245 CHECK(!owner->result_ok);
12246         return DecodeError_clone(&*owner->contents.err);
12247 }
12248 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_err(int64_t owner) {
12249         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12251         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
12252         int64_t ret_ref = tag_ptr(ret_copy, true);
12253         return ret_ref;
12254 }
12255
12256 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12257         return ThirtyTwoBytes_clone(&owner->a);
12258 }
12259 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(int64_t owner) {
12260         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12261         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12262         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
12263         return ret_arr;
12264 }
12265
12266 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12267         LDKRecipientOnionFields ret = owner->b;
12268         ret.is_owned = false;
12269         return ret;
12270 }
12271 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(int64_t owner) {
12272         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12273         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
12274         int64_t ret_ref = 0;
12275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12277         return ret_ref;
12278 }
12279
12280 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12281         LDKRouteParameters ret = owner->c;
12282         ret.is_owned = false;
12283         return ret;
12284 }
12285 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(int64_t owner) {
12286         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12287         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
12288         int64_t ret_ref = 0;
12289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12291         return ret_ref;
12292 }
12293
12294 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12295 CHECK(owner->result_ok);
12296         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
12297 }
12298 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(int64_t owner) {
12299         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12300         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
12301         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
12302         return tag_ptr(ret_conv, true);
12303 }
12304
12305 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12306 CHECK(!owner->result_ok);
12307         return *owner->contents.err;
12308 }
12309 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(int64_t owner) {
12310         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12311         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
12312 }
12313
12314 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12315 CHECK(owner->result_ok);
12316         return *owner->contents.result;
12317 }
12318 jstring  CS_LDK_CResult_StrSecp256k1ErrorZ_get_ok(int64_t owner) {
12319         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12320         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
12321         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
12322         return ret_conv;
12323 }
12324
12325 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12326 CHECK(!owner->result_ok);
12327         return *owner->contents.err;
12328 }
12329 int32_t  CS_LDK_CResult_StrSecp256k1ErrorZ_get_err(int64_t owner) {
12330         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12331         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
12332         return ret_conv;
12333 }
12334
12335 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12336         return owner->a;
12337 }
12338 int8_tArray  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(int64_t owner) {
12339         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12340         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
12341         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
12342         return ret_arr;
12343 }
12344
12345 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12346         LDKOnionMessage ret = owner->b;
12347         ret.is_owned = false;
12348         return ret;
12349 }
12350 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(int64_t owner) {
12351         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12352         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
12353         int64_t ret_ref = 0;
12354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12356         return ret_ref;
12357 }
12358
12359 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12360         return COption_CVec_SocketAddressZZ_clone(&owner->c);
12361 }
12362 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(int64_t owner) {
12363         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12364         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
12365         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
12366         int64_t ret_ref = tag_ptr(ret_copy, true);
12367         return ret_ref;
12368 }
12369
12370 uint32_t CS_LDK_LDKSendError_ty_from_ptr(int64_t ptr) {
12371         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12372         switch(obj->tag) {
12373                 case LDKSendError_Secp256k1: return 0;
12374                 case LDKSendError_TooBigPacket: return 1;
12375                 case LDKSendError_TooFewBlindedHops: return 2;
12376                 case LDKSendError_InvalidFirstHop: return 3;
12377                 case LDKSendError_PathNotFound: return 4;
12378                 case LDKSendError_InvalidMessage: return 5;
12379                 case LDKSendError_BufferFull: return 6;
12380                 case LDKSendError_GetNodeIdFailed: return 7;
12381                 case LDKSendError_BlindedPathAdvanceFailed: return 8;
12382                 default: abort();
12383         }
12384 }
12385 int32_t CS_LDK_LDKSendError_Secp256k1_get_secp256k1(int64_t ptr) {
12386         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12387         CHECK(obj->tag == LDKSendError_Secp256k1);
12388         int32_t secp256k1_conv = LDKSecp256k1Error_to_cs(obj->secp256k1);
12389         return secp256k1_conv;
12390 }
12391 int8_tArray CS_LDK_LDKSendError_InvalidFirstHop_get_invalid_first_hop(int64_t ptr) {
12392         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12393         CHECK(obj->tag == LDKSendError_InvalidFirstHop);
12394         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
12395         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
12396         return invalid_first_hop_arr;
12397 }
12398 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12399 CHECK(owner->result_ok);
12400         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
12401 }
12402 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(int64_t owner) {
12403         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12404         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
12405         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
12406         return tag_ptr(ret_conv, true);
12407 }
12408
12409 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12410 CHECK(!owner->result_ok);
12411         return SendError_clone(&*owner->contents.err);
12412 }
12413 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(int64_t owner) {
12414         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12415         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12416         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
12417         int64_t ret_ref = tag_ptr(ret_copy, true);
12418         return ret_ref;
12419 }
12420
12421 uint32_t CS_LDK_LDKParsedOnionMessageContents_ty_from_ptr(int64_t ptr) {
12422         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12423         switch(obj->tag) {
12424                 case LDKParsedOnionMessageContents_Offers: return 0;
12425                 case LDKParsedOnionMessageContents_Custom: return 1;
12426                 default: abort();
12427         }
12428 }
12429 int64_t CS_LDK_LDKParsedOnionMessageContents_Offers_get_offers(int64_t ptr) {
12430         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12431         CHECK(obj->tag == LDKParsedOnionMessageContents_Offers);
12432         int64_t offers_ref = tag_ptr(&obj->offers, false);
12433         return offers_ref;
12434 }
12435 int64_t CS_LDK_LDKParsedOnionMessageContents_Custom_get_custom(int64_t ptr) {
12436         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12437         CHECK(obj->tag == LDKParsedOnionMessageContents_Custom);
12438         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
12439         *custom_ret = OnionMessageContents_clone(&obj->custom);
12440         return tag_ptr(custom_ret, true);
12441 }
12442 uint32_t CS_LDK_LDKPeeledOnion_ty_from_ptr(int64_t ptr) {
12443         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12444         switch(obj->tag) {
12445                 case LDKPeeledOnion_Forward: return 0;
12446                 case LDKPeeledOnion_Receive: return 1;
12447                 default: abort();
12448         }
12449 }
12450 int8_tArray CS_LDK_LDKPeeledOnion_Forward_get__0(int64_t ptr) {
12451         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12452         CHECK(obj->tag == LDKPeeledOnion_Forward);
12453         int8_tArray _0_arr = init_int8_tArray(33, __LINE__);
12454         memcpy(_0_arr->elems, obj->forward._0.compressed_form, 33);
12455         return _0_arr;
12456 }
12457 int64_t CS_LDK_LDKPeeledOnion_Forward_get__1(int64_t ptr) {
12458         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12459         CHECK(obj->tag == LDKPeeledOnion_Forward);
12460         LDKOnionMessage _1_var = obj->forward._1;
12461                         int64_t _1_ref = 0;
12462                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
12463                         _1_ref = tag_ptr(_1_var.inner, false);
12464         return _1_ref;
12465 }
12466 int64_t CS_LDK_LDKPeeledOnion_Receive_get__0(int64_t ptr) {
12467         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12468         CHECK(obj->tag == LDKPeeledOnion_Receive);
12469         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
12470         return _0_ref;
12471 }
12472 int8_tArray CS_LDK_LDKPeeledOnion_Receive_get__1(int64_t ptr) {
12473         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12474         CHECK(obj->tag == LDKPeeledOnion_Receive);
12475         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
12476         memcpy(_1_arr->elems, obj->receive._1.data, 32);
12477         return _1_arr;
12478 }
12479 int64_t CS_LDK_LDKPeeledOnion_Receive_get__2(int64_t ptr) {
12480         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12481         CHECK(obj->tag == LDKPeeledOnion_Receive);
12482         LDKBlindedPath _2_var = obj->receive._2;
12483                         int64_t _2_ref = 0;
12484                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
12485                         _2_ref = tag_ptr(_2_var.inner, false);
12486         return _2_ref;
12487 }
12488 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12489 CHECK(owner->result_ok);
12490         return PeeledOnion_clone(&*owner->contents.result);
12491 }
12492 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_get_ok(int64_t owner) {
12493         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12494         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
12495         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
12496         int64_t ret_ref = tag_ptr(ret_copy, true);
12497         return ret_ref;
12498 }
12499
12500 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12501 CHECK(!owner->result_ok);
12502         return *owner->contents.err;
12503 }
12504 void  CS_LDK_CResult_PeeledOnionNoneZ_get_err(int64_t owner) {
12505         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12506         CResult_PeeledOnionNoneZ_get_err(owner_conv);
12507 }
12508
12509 uint32_t CS_LDK_LDKSendSuccess_ty_from_ptr(int64_t ptr) {
12510         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12511         switch(obj->tag) {
12512                 case LDKSendSuccess_Buffered: return 0;
12513                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
12514                 default: abort();
12515         }
12516 }
12517 int8_tArray CS_LDK_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(int64_t ptr) {
12518         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12519         CHECK(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
12520         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
12521         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
12522         return buffered_awaiting_connection_arr;
12523 }
12524 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12525 CHECK(owner->result_ok);
12526         return SendSuccess_clone(&*owner->contents.result);
12527 }
12528 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_ok(int64_t owner) {
12529         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12530         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
12531         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
12532         int64_t ret_ref = tag_ptr(ret_copy, true);
12533         return ret_ref;
12534 }
12535
12536 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12537 CHECK(!owner->result_ok);
12538         return SendError_clone(&*owner->contents.err);
12539 }
12540 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_err(int64_t owner) {
12541         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12542         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12543         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
12544         int64_t ret_ref = tag_ptr(ret_copy, true);
12545         return ret_ref;
12546 }
12547
12548 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12549         LDKBlindedPath ret = *owner->contents.result;
12550         ret.is_owned = false;
12551         return ret;
12552 }
12553 int64_t  CS_LDK_CResult_BlindedPathNoneZ_get_ok(int64_t owner) {
12554         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12555         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
12556         int64_t ret_ref = 0;
12557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12559         return ret_ref;
12560 }
12561
12562 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12563 CHECK(!owner->result_ok);
12564         return *owner->contents.err;
12565 }
12566 void  CS_LDK_CResult_BlindedPathNoneZ_get_err(int64_t owner) {
12567         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12568         CResult_BlindedPathNoneZ_get_err(owner_conv);
12569 }
12570
12571 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12572 CHECK(owner->result_ok);
12573         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
12574 }
12575 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(int64_t owner) {
12576         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12577         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
12578         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
12579         return tag_ptr(ret_conv, true);
12580 }
12581
12582 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12583 CHECK(!owner->result_ok);
12584         return *owner->contents.err;
12585 }
12586 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(int64_t owner) {
12587         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12588         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
12589 }
12590
12591 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
12592         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
12593         for (size_t i = 0; i < ret.datalen; i++) {
12594                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
12595         }
12596         return ret;
12597 }
12598 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12599         LDKBlindedPath ret = *owner->contents.result;
12600         ret.is_owned = false;
12601         return ret;
12602 }
12603 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_ok(int64_t owner) {
12604         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12605         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
12606         int64_t ret_ref = 0;
12607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12609         return ret_ref;
12610 }
12611
12612 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12613 CHECK(!owner->result_ok);
12614         return DecodeError_clone(&*owner->contents.err);
12615 }
12616 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_err(int64_t owner) {
12617         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12619         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
12620         int64_t ret_ref = tag_ptr(ret_copy, true);
12621         return ret_ref;
12622 }
12623
12624 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12625         LDKBlindedHop ret = *owner->contents.result;
12626         ret.is_owned = false;
12627         return ret;
12628 }
12629 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_ok(int64_t owner) {
12630         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12631         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
12632         int64_t ret_ref = 0;
12633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12635         return ret_ref;
12636 }
12637
12638 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12639 CHECK(!owner->result_ok);
12640         return DecodeError_clone(&*owner->contents.err);
12641 }
12642 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_err(int64_t owner) {
12643         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12645         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
12646         int64_t ret_ref = tag_ptr(ret_copy, true);
12647         return ret_ref;
12648 }
12649
12650 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12651         LDKInvoiceError ret = *owner->contents.result;
12652         ret.is_owned = false;
12653         return ret;
12654 }
12655 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_ok(int64_t owner) {
12656         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12657         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
12658         int64_t ret_ref = 0;
12659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12661         return ret_ref;
12662 }
12663
12664 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12665 CHECK(!owner->result_ok);
12666         return DecodeError_clone(&*owner->contents.err);
12667 }
12668 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_err(int64_t owner) {
12669         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12670         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12671         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
12672         int64_t ret_ref = tag_ptr(ret_copy, true);
12673         return ret_ref;
12674 }
12675
12676 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12677         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
12678         ret.is_owned = false;
12679         return ret;
12680 }
12681 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(int64_t owner) {
12682         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12683         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
12684         int64_t ret_ref = 0;
12685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12687         return ret_ref;
12688 }
12689
12690 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12691 CHECK(!owner->result_ok);
12692         return DecodeError_clone(&*owner->contents.err);
12693 }
12694 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(int64_t owner) {
12695         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12696         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12697         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
12698         int64_t ret_ref = tag_ptr(ret_copy, true);
12699         return ret_ref;
12700 }
12701
12702 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12703         LDKDelayedPaymentKey ret = *owner->contents.result;
12704         ret.is_owned = false;
12705         return ret;
12706 }
12707 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(int64_t owner) {
12708         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12709         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
12710         int64_t ret_ref = 0;
12711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12713         return ret_ref;
12714 }
12715
12716 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12717 CHECK(!owner->result_ok);
12718         return DecodeError_clone(&*owner->contents.err);
12719 }
12720 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(int64_t owner) {
12721         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12722         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12723         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
12724         int64_t ret_ref = tag_ptr(ret_copy, true);
12725         return ret_ref;
12726 }
12727
12728 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12729         LDKHtlcBasepoint ret = *owner->contents.result;
12730         ret.is_owned = false;
12731         return ret;
12732 }
12733 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_ok(int64_t owner) {
12734         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12735         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
12736         int64_t ret_ref = 0;
12737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12739         return ret_ref;
12740 }
12741
12742 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12743 CHECK(!owner->result_ok);
12744         return DecodeError_clone(&*owner->contents.err);
12745 }
12746 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_err(int64_t owner) {
12747         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12748         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12749         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
12750         int64_t ret_ref = tag_ptr(ret_copy, true);
12751         return ret_ref;
12752 }
12753
12754 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12755         LDKHtlcKey ret = *owner->contents.result;
12756         ret.is_owned = false;
12757         return ret;
12758 }
12759 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_ok(int64_t owner) {
12760         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12761         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
12762         int64_t ret_ref = 0;
12763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12765         return ret_ref;
12766 }
12767
12768 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12769 CHECK(!owner->result_ok);
12770         return DecodeError_clone(&*owner->contents.err);
12771 }
12772 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_err(int64_t owner) {
12773         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12775         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
12776         int64_t ret_ref = tag_ptr(ret_copy, true);
12777         return ret_ref;
12778 }
12779
12780 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12781         LDKRevocationBasepoint ret = *owner->contents.result;
12782         ret.is_owned = false;
12783         return ret;
12784 }
12785 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_ok(int64_t owner) {
12786         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12787         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
12788         int64_t ret_ref = 0;
12789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12791         return ret_ref;
12792 }
12793
12794 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12795 CHECK(!owner->result_ok);
12796         return DecodeError_clone(&*owner->contents.err);
12797 }
12798 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_err(int64_t owner) {
12799         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12801         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
12802         int64_t ret_ref = tag_ptr(ret_copy, true);
12803         return ret_ref;
12804 }
12805
12806 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12807         LDKRevocationKey ret = *owner->contents.result;
12808         ret.is_owned = false;
12809         return ret;
12810 }
12811 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_ok(int64_t owner) {
12812         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12813         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
12814         int64_t ret_ref = 0;
12815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12817         return ret_ref;
12818 }
12819
12820 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12821 CHECK(!owner->result_ok);
12822         return DecodeError_clone(&*owner->contents.err);
12823 }
12824 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_err(int64_t owner) {
12825         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12827         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
12828         int64_t ret_ref = tag_ptr(ret_copy, true);
12829         return ret_ref;
12830 }
12831
12832 typedef struct LDKFilter_JCalls {
12833         atomic_size_t refcnt;
12834         uint32_t instance_ptr;
12835 } LDKFilter_JCalls;
12836 static void LDKFilter_JCalls_free(void* this_arg) {
12837         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12838         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12839                 FREE(j_calls);
12840         }
12841 }
12842 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
12843         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12844         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12845         memcpy(txid_arr->elems, *txid, 32);
12846         LDKu8slice script_pubkey_var = script_pubkey;
12847         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
12848         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
12849         js_invoke_function_void_ll(j_calls->instance_ptr, 56, (int64_t)txid_arr, (int64_t)script_pubkey_arr);
12850 }
12851 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
12852         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12853         LDKWatchedOutput output_var = output;
12854         int64_t output_ref = 0;
12855         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
12856         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
12857         js_invoke_function_void_l(j_calls->instance_ptr, 57, output_ref);
12858 }
12859 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
12860         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
12861         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12862 }
12863 static inline LDKFilter LDKFilter_init (int64_t o) {
12864         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
12865         atomic_init(&calls->refcnt, 1);
12866         calls->instance_ptr = o;
12867
12868         LDKFilter ret = {
12869                 .this_arg = (void*) calls,
12870                 .register_tx = register_tx_LDKFilter_jcall,
12871                 .register_output = register_output_LDKFilter_jcall,
12872                 .free = LDKFilter_JCalls_free,
12873         };
12874         return ret;
12875 }
12876 uint64_t  CS_LDK_LDKFilter_new(int32_t o) {
12877         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
12878         *res_ptr = LDKFilter_init(o);
12879         return tag_ptr(res_ptr, true);
12880 }
12881 void  CS_LDK_Filter_register_tx(int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
12882         void* this_arg_ptr = untag_ptr(this_arg);
12883         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12884         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12885         uint8_t txid_arr[32];
12886         CHECK(txid->arr_len == 32);
12887         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12888         uint8_t (*txid_ref)[32] = &txid_arr;
12889         LDKu8slice script_pubkey_ref;
12890         script_pubkey_ref.datalen = script_pubkey->arr_len;
12891         script_pubkey_ref.data = script_pubkey->elems;
12892         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
12893         FREE(script_pubkey);
12894 }
12895
12896 void  CS_LDK_Filter_register_output(int64_t this_arg, int64_t output) {
12897         void* this_arg_ptr = untag_ptr(this_arg);
12898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12899         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12900         LDKWatchedOutput output_conv;
12901         output_conv.inner = untag_ptr(output);
12902         output_conv.is_owned = ptr_is_owned(output);
12903         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
12904         output_conv = WatchedOutput_clone(&output_conv);
12905         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
12906 }
12907
12908 uint32_t CS_LDK_LDKCOption_FilterZ_ty_from_ptr(int64_t ptr) {
12909         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12910         switch(obj->tag) {
12911                 case LDKCOption_FilterZ_Some: return 0;
12912                 case LDKCOption_FilterZ_None: return 1;
12913                 default: abort();
12914         }
12915 }
12916 int64_t CS_LDK_LDKCOption_FilterZ_Some_get_some(int64_t ptr) {
12917         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12918         CHECK(obj->tag == LDKCOption_FilterZ_Some);
12919         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
12920         *some_ret = obj->some;
12921                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
12922                         if ((*some_ret).free == LDKFilter_JCalls_free) {
12923                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12924                                 LDKFilter_JCalls_cloned(&(*some_ret));
12925                         }
12926         return tag_ptr(some_ret, true);
12927 }
12928 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12929         LDKLockedChannelMonitor ret = *owner->contents.result;
12930         ret.is_owned = false;
12931         return ret;
12932 }
12933 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_ok(int64_t owner) {
12934         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12935         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
12936         int64_t ret_ref = 0;
12937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12939         return ret_ref;
12940 }
12941
12942 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12943 CHECK(!owner->result_ok);
12944         return *owner->contents.err;
12945 }
12946 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_err(int64_t owner) {
12947         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12948         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
12949 }
12950
12951 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
12952         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
12953         for (size_t i = 0; i < ret.datalen; i++) {
12954                 ret.data[i] = OutPoint_clone(&orig->data[i]);
12955         }
12956         return ret;
12957 }
12958 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
12959         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
12960         for (size_t i = 0; i < ret.datalen; i++) {
12961                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
12962         }
12963         return ret;
12964 }
12965 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12966         LDKOutPoint ret = owner->a;
12967         ret.is_owned = false;
12968         return ret;
12969 }
12970 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(int64_t owner) {
12971         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12972         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
12973         int64_t ret_ref = 0;
12974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12976         return ret_ref;
12977 }
12978
12979 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12980         return CVec_MonitorUpdateIdZ_clone(&owner->b);
12981 }
12982 int64_tArray  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(int64_t owner) {
12983         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12984         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
12985         int64_tArray ret_arr = NULL;
12986         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
12987         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
12988         for (size_t r = 0; r < ret_var.datalen; r++) {
12989                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
12990                 int64_t ret_conv_17_ref = 0;
12991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
12992                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
12993                 ret_arr_ptr[r] = ret_conv_17_ref;
12994         }
12995         
12996         FREE(ret_var.data);
12997         return ret_arr;
12998 }
12999
13000 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
13001         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
13002         for (size_t i = 0; i < ret.datalen; i++) {
13003                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
13004         }
13005         return ret;
13006 }
13007 typedef struct LDKKVStore_JCalls {
13008         atomic_size_t refcnt;
13009         uint32_t instance_ptr;
13010 } LDKKVStore_JCalls;
13011 static void LDKKVStore_JCalls_free(void* this_arg) {
13012         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13013         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13014                 FREE(j_calls);
13015         }
13016 }
13017 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
13018         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13019         LDKStr primary_namespace_str = primary_namespace;
13020         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13021         Str_free(primary_namespace_str);
13022         LDKStr secondary_namespace_str = secondary_namespace;
13023         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13024         Str_free(secondary_namespace_str);
13025         LDKStr key_str = key;
13026         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13027         Str_free(key_str);
13028         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 58, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv);
13029         void* ret_ptr = untag_ptr(ret);
13030         CHECK_ACCESS(ret_ptr);
13031         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
13032         FREE(untag_ptr(ret));
13033         return ret_conv;
13034 }
13035 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
13036         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13037         LDKStr primary_namespace_str = primary_namespace;
13038         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13039         Str_free(primary_namespace_str);
13040         LDKStr secondary_namespace_str = secondary_namespace;
13041         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13042         Str_free(secondary_namespace_str);
13043         LDKStr key_str = key;
13044         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13045         Str_free(key_str);
13046         LDKu8slice buf_var = buf;
13047         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
13048         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
13049         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 59, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, (int64_t)buf_arr);
13050         void* ret_ptr = untag_ptr(ret);
13051         CHECK_ACCESS(ret_ptr);
13052         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13053         FREE(untag_ptr(ret));
13054         return ret_conv;
13055 }
13056 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
13057         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13058         LDKStr primary_namespace_str = primary_namespace;
13059         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13060         Str_free(primary_namespace_str);
13061         LDKStr secondary_namespace_str = secondary_namespace;
13062         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13063         Str_free(secondary_namespace_str);
13064         LDKStr key_str = key;
13065         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13066         Str_free(key_str);
13067         jboolean lazy_conv = lazy;
13068         uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 60, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, lazy_conv);
13069         void* ret_ptr = untag_ptr(ret);
13070         CHECK_ACCESS(ret_ptr);
13071         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13072         FREE(untag_ptr(ret));
13073         return ret_conv;
13074 }
13075 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
13076         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13077         LDKStr primary_namespace_str = primary_namespace;
13078         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13079         Str_free(primary_namespace_str);
13080         LDKStr secondary_namespace_str = secondary_namespace;
13081         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13082         Str_free(secondary_namespace_str);
13083         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 61, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv);
13084         void* ret_ptr = untag_ptr(ret);
13085         CHECK_ACCESS(ret_ptr);
13086         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
13087         FREE(untag_ptr(ret));
13088         return ret_conv;
13089 }
13090 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
13091         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
13092         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13093 }
13094 static inline LDKKVStore LDKKVStore_init (int64_t o) {
13095         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
13096         atomic_init(&calls->refcnt, 1);
13097         calls->instance_ptr = o;
13098
13099         LDKKVStore ret = {
13100                 .this_arg = (void*) calls,
13101                 .read = read_LDKKVStore_jcall,
13102                 .write = write_LDKKVStore_jcall,
13103                 .remove = remove_LDKKVStore_jcall,
13104                 .list = list_LDKKVStore_jcall,
13105                 .free = LDKKVStore_JCalls_free,
13106         };
13107         return ret;
13108 }
13109 uint64_t  CS_LDK_LDKKVStore_new(int32_t o) {
13110         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
13111         *res_ptr = LDKKVStore_init(o);
13112         return tag_ptr(res_ptr, true);
13113 }
13114 int64_t  CS_LDK_KVStore_read(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
13115         void* this_arg_ptr = untag_ptr(this_arg);
13116         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13117         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13118         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13119         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13120         LDKStr key_conv = str_ref_to_owned_c(key);
13121         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
13122         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
13123         return tag_ptr(ret_conv, true);
13124 }
13125
13126 int64_t  CS_LDK_KVStore_write(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
13127         void* this_arg_ptr = untag_ptr(this_arg);
13128         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13129         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13130         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13131         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13132         LDKStr key_conv = str_ref_to_owned_c(key);
13133         LDKu8slice buf_ref;
13134         buf_ref.datalen = buf->arr_len;
13135         buf_ref.data = buf->elems;
13136         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13137         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
13138         FREE(buf);
13139         return tag_ptr(ret_conv, true);
13140 }
13141
13142 int64_t  CS_LDK_KVStore_remove(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
13143         void* this_arg_ptr = untag_ptr(this_arg);
13144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13145         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13146         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13147         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13148         LDKStr key_conv = str_ref_to_owned_c(key);
13149         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13150         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
13151         return tag_ptr(ret_conv, true);
13152 }
13153
13154 int64_t  CS_LDK_KVStore_list(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
13155         void* this_arg_ptr = untag_ptr(this_arg);
13156         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13157         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13158         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13159         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13160         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
13161         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
13162         return tag_ptr(ret_conv, true);
13163 }
13164
13165 typedef struct LDKPersister_JCalls {
13166         atomic_size_t refcnt;
13167         uint32_t instance_ptr;
13168 } LDKPersister_JCalls;
13169 static void LDKPersister_JCalls_free(void* this_arg) {
13170         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13171         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13172                 FREE(j_calls);
13173         }
13174 }
13175 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
13176         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13177         LDKChannelManager channel_manager_var = *channel_manager;
13178         int64_t channel_manager_ref = 0;
13179         // WARNING: we may need a move here but no clone is available for LDKChannelManager
13180         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
13181         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
13182         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 62, channel_manager_ref);
13183         void* ret_ptr = untag_ptr(ret);
13184         CHECK_ACCESS(ret_ptr);
13185         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13186         FREE(untag_ptr(ret));
13187         return ret_conv;
13188 }
13189 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
13190         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13191         LDKNetworkGraph network_graph_var = *network_graph;
13192         int64_t network_graph_ref = 0;
13193         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
13194         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
13195         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
13196         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 63, network_graph_ref);
13197         void* ret_ptr = untag_ptr(ret);
13198         CHECK_ACCESS(ret_ptr);
13199         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13200         FREE(untag_ptr(ret));
13201         return ret_conv;
13202 }
13203 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
13204         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13205         // WARNING: This object doesn't live past this scope, needs clone!
13206         int64_t ret_scorer = tag_ptr(scorer, false);
13207         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 64, ret_scorer);
13208         void* ret_ptr = untag_ptr(ret);
13209         CHECK_ACCESS(ret_ptr);
13210         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13211         FREE(untag_ptr(ret));
13212         return ret_conv;
13213 }
13214 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
13215         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
13216         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13217 }
13218 static inline LDKPersister LDKPersister_init (int64_t o) {
13219         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
13220         atomic_init(&calls->refcnt, 1);
13221         calls->instance_ptr = o;
13222
13223         LDKPersister ret = {
13224                 .this_arg = (void*) calls,
13225                 .persist_manager = persist_manager_LDKPersister_jcall,
13226                 .persist_graph = persist_graph_LDKPersister_jcall,
13227                 .persist_scorer = persist_scorer_LDKPersister_jcall,
13228                 .free = LDKPersister_JCalls_free,
13229         };
13230         return ret;
13231 }
13232 uint64_t  CS_LDK_LDKPersister_new(int32_t o) {
13233         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
13234         *res_ptr = LDKPersister_init(o);
13235         return tag_ptr(res_ptr, true);
13236 }
13237 int64_t  CS_LDK_Persister_persist_manager(int64_t this_arg, int64_t channel_manager) {
13238         void* this_arg_ptr = untag_ptr(this_arg);
13239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13240         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13241         LDKChannelManager channel_manager_conv;
13242         channel_manager_conv.inner = untag_ptr(channel_manager);
13243         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
13244         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13245         channel_manager_conv.is_owned = false;
13246         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13247         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13248         return tag_ptr(ret_conv, true);
13249 }
13250
13251 int64_t  CS_LDK_Persister_persist_graph(int64_t this_arg, int64_t network_graph) {
13252         void* this_arg_ptr = untag_ptr(this_arg);
13253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13254         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13255         LDKNetworkGraph network_graph_conv;
13256         network_graph_conv.inner = untag_ptr(network_graph);
13257         network_graph_conv.is_owned = ptr_is_owned(network_graph);
13258         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
13259         network_graph_conv.is_owned = false;
13260         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13261         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
13262         return tag_ptr(ret_conv, true);
13263 }
13264
13265 int64_t  CS_LDK_Persister_persist_scorer(int64_t this_arg, int64_t scorer) {
13266         void* this_arg_ptr = untag_ptr(this_arg);
13267         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13268         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13269         void* scorer_ptr = untag_ptr(scorer);
13270         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
13271         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
13272         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13273         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
13274         return tag_ptr(ret_conv, true);
13275 }
13276
13277 typedef struct LDKPersist_JCalls {
13278         atomic_size_t refcnt;
13279         uint32_t instance_ptr;
13280 } LDKPersist_JCalls;
13281 static void LDKPersist_JCalls_free(void* this_arg) {
13282         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13283         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13284                 FREE(j_calls);
13285         }
13286 }
13287 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13288         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13289         LDKOutPoint channel_id_var = channel_id;
13290         int64_t channel_id_ref = 0;
13291         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13292         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13293         LDKChannelMonitor data_var = *data;
13294         int64_t data_ref = 0;
13295         data_var = ChannelMonitor_clone(&data_var);
13296         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13297         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13298         LDKMonitorUpdateId update_id_var = update_id;
13299         int64_t update_id_ref = 0;
13300         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13301         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13302         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_lll(j_calls->instance_ptr, 65, channel_id_ref, data_ref, update_id_ref);
13303         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
13304         return ret_conv;
13305 }
13306 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13307         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13308         LDKOutPoint channel_id_var = channel_id;
13309         int64_t channel_id_ref = 0;
13310         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13311         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13312         LDKChannelMonitorUpdate update_var = update;
13313         int64_t update_ref = 0;
13314         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
13315         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
13316         LDKChannelMonitor data_var = *data;
13317         int64_t data_ref = 0;
13318         data_var = ChannelMonitor_clone(&data_var);
13319         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13320         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13321         LDKMonitorUpdateId update_id_var = update_id;
13322         int64_t update_id_ref = 0;
13323         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13324         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13325         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_llll(j_calls->instance_ptr, 66, channel_id_ref, update_ref, data_ref, update_id_ref);
13326         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
13327         return ret_conv;
13328 }
13329 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
13330         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
13331         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13332 }
13333 static inline LDKPersist LDKPersist_init (int64_t o) {
13334         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
13335         atomic_init(&calls->refcnt, 1);
13336         calls->instance_ptr = o;
13337
13338         LDKPersist ret = {
13339                 .this_arg = (void*) calls,
13340                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
13341                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
13342                 .free = LDKPersist_JCalls_free,
13343         };
13344         return ret;
13345 }
13346 uint64_t  CS_LDK_LDKPersist_new(int32_t o) {
13347         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
13348         *res_ptr = LDKPersist_init(o);
13349         return tag_ptr(res_ptr, true);
13350 }
13351 int32_t  CS_LDK_Persist_persist_new_channel(int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
13352         void* this_arg_ptr = untag_ptr(this_arg);
13353         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13354         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13355         LDKOutPoint channel_id_conv;
13356         channel_id_conv.inner = untag_ptr(channel_id);
13357         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13358         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13359         channel_id_conv = OutPoint_clone(&channel_id_conv);
13360         LDKChannelMonitor data_conv;
13361         data_conv.inner = untag_ptr(data);
13362         data_conv.is_owned = ptr_is_owned(data);
13363         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13364         data_conv.is_owned = false;
13365         LDKMonitorUpdateId update_id_conv;
13366         update_id_conv.inner = untag_ptr(update_id);
13367         update_id_conv.is_owned = ptr_is_owned(update_id);
13368         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13369         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13370         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
13371         return ret_conv;
13372 }
13373
13374 int32_t  CS_LDK_Persist_update_persisted_channel(int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
13375         void* this_arg_ptr = untag_ptr(this_arg);
13376         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13377         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13378         LDKOutPoint channel_id_conv;
13379         channel_id_conv.inner = untag_ptr(channel_id);
13380         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13381         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13382         channel_id_conv = OutPoint_clone(&channel_id_conv);
13383         LDKChannelMonitorUpdate update_conv;
13384         update_conv.inner = untag_ptr(update);
13385         update_conv.is_owned = ptr_is_owned(update);
13386         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
13387         update_conv = ChannelMonitorUpdate_clone(&update_conv);
13388         LDKChannelMonitor data_conv;
13389         data_conv.inner = untag_ptr(data);
13390         data_conv.is_owned = ptr_is_owned(data);
13391         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13392         data_conv.is_owned = false;
13393         LDKMonitorUpdateId update_id_conv;
13394         update_id_conv.inner = untag_ptr(update_id);
13395         update_id_conv.is_owned = ptr_is_owned(update_id);
13396         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13397         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13398         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
13399         return ret_conv;
13400 }
13401
13402 typedef struct LDKFutureCallback_JCalls {
13403         atomic_size_t refcnt;
13404         uint32_t instance_ptr;
13405 } LDKFutureCallback_JCalls;
13406 static void LDKFutureCallback_JCalls_free(void* this_arg) {
13407         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13408         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13409                 FREE(j_calls);
13410         }
13411 }
13412 void call_LDKFutureCallback_jcall(const void* this_arg) {
13413         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13414         js_invoke_function_void_(j_calls->instance_ptr, 67);
13415 }
13416 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
13417         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
13418         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13419 }
13420 static inline LDKFutureCallback LDKFutureCallback_init (int64_t o) {
13421         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
13422         atomic_init(&calls->refcnt, 1);
13423         calls->instance_ptr = o;
13424
13425         LDKFutureCallback ret = {
13426                 .this_arg = (void*) calls,
13427                 .call = call_LDKFutureCallback_jcall,
13428                 .free = LDKFutureCallback_JCalls_free,
13429         };
13430         return ret;
13431 }
13432 uint64_t  CS_LDK_LDKFutureCallback_new(int32_t o) {
13433         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
13434         *res_ptr = LDKFutureCallback_init(o);
13435         return tag_ptr(res_ptr, true);
13436 }
13437 void  CS_LDK_FutureCallback_call(int64_t this_arg) {
13438         void* this_arg_ptr = untag_ptr(this_arg);
13439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13440         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
13441         (this_arg_conv->call)(this_arg_conv->this_arg);
13442 }
13443
13444 typedef struct LDKListen_JCalls {
13445         atomic_size_t refcnt;
13446         uint32_t instance_ptr;
13447 } LDKListen_JCalls;
13448 static void LDKListen_JCalls_free(void* this_arg) {
13449         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13450         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13451                 FREE(j_calls);
13452         }
13453 }
13454 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13455         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13456         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13457         memcpy(header_arr->elems, *header, 80);
13458         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13459         int64_tArray txdata_arr = NULL;
13460         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
13461         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
13462         for (size_t c = 0; c < txdata_var.datalen; c++) {
13463                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13464                 *txdata_conv_28_conv = txdata_var.data[c];
13465                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13466         }
13467         
13468         FREE(txdata_var.data);
13469         int32_t height_conv = height;
13470         js_invoke_function_void_lli(j_calls->instance_ptr, 68, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
13471 }
13472 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
13473         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13474         LDKu8slice block_var = block;
13475         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
13476         memcpy(block_arr->elems, block_var.data, block_var.datalen);
13477         int32_t height_conv = height;
13478         js_invoke_function_void_li(j_calls->instance_ptr, 69, (int64_t)block_arr, height_conv);
13479 }
13480 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13481         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13482         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13483         memcpy(header_arr->elems, *header, 80);
13484         int32_t height_conv = height;
13485         js_invoke_function_void_li(j_calls->instance_ptr, 70, (int64_t)header_arr, height_conv);
13486 }
13487 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
13488         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
13489         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13490 }
13491 static inline LDKListen LDKListen_init (int64_t o) {
13492         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
13493         atomic_init(&calls->refcnt, 1);
13494         calls->instance_ptr = o;
13495
13496         LDKListen ret = {
13497                 .this_arg = (void*) calls,
13498                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
13499                 .block_connected = block_connected_LDKListen_jcall,
13500                 .block_disconnected = block_disconnected_LDKListen_jcall,
13501                 .free = LDKListen_JCalls_free,
13502         };
13503         return ret;
13504 }
13505 uint64_t  CS_LDK_LDKListen_new(int32_t o) {
13506         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
13507         *res_ptr = LDKListen_init(o);
13508         return tag_ptr(res_ptr, true);
13509 }
13510 void  CS_LDK_Listen_filtered_block_connected(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
13511         void* this_arg_ptr = untag_ptr(this_arg);
13512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13513         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13514         uint8_t header_arr[80];
13515         CHECK(header->arr_len == 80);
13516         memcpy(header_arr, header->elems, 80); FREE(header);
13517         uint8_t (*header_ref)[80] = &header_arr;
13518         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13519         txdata_constr.datalen = txdata->arr_len;
13520         if (txdata_constr.datalen > 0)
13521                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13522         else
13523                 txdata_constr.data = NULL;
13524         int64_t* txdata_vals = txdata->elems;
13525         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13526                 int64_t txdata_conv_28 = txdata_vals[c];
13527                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13528                 CHECK_ACCESS(txdata_conv_28_ptr);
13529                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13530                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13531                 txdata_constr.data[c] = txdata_conv_28_conv;
13532         }
13533         FREE(txdata);
13534         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13535 }
13536
13537 void  CS_LDK_Listen_block_connected(int64_t this_arg, int8_tArray block, int32_t height) {
13538         void* this_arg_ptr = untag_ptr(this_arg);
13539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13540         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13541         LDKu8slice block_ref;
13542         block_ref.datalen = block->arr_len;
13543         block_ref.data = block->elems;
13544         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
13545         FREE(block);
13546 }
13547
13548 void  CS_LDK_Listen_block_disconnected(int64_t this_arg, int8_tArray header, int32_t height) {
13549         void* this_arg_ptr = untag_ptr(this_arg);
13550         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13551         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13552         uint8_t header_arr[80];
13553         CHECK(header->arr_len == 80);
13554         memcpy(header_arr, header->elems, 80); FREE(header);
13555         uint8_t (*header_ref)[80] = &header_arr;
13556         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
13557 }
13558
13559 typedef struct LDKConfirm_JCalls {
13560         atomic_size_t refcnt;
13561         uint32_t instance_ptr;
13562 } LDKConfirm_JCalls;
13563 static void LDKConfirm_JCalls_free(void* this_arg) {
13564         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13565         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13566                 FREE(j_calls);
13567         }
13568 }
13569 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13570         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13571         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13572         memcpy(header_arr->elems, *header, 80);
13573         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13574         int64_tArray txdata_arr = NULL;
13575         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
13576         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
13577         for (size_t c = 0; c < txdata_var.datalen; c++) {
13578                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13579                 *txdata_conv_28_conv = txdata_var.data[c];
13580                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13581         }
13582         
13583         FREE(txdata_var.data);
13584         int32_t height_conv = height;
13585         js_invoke_function_void_lli(j_calls->instance_ptr, 71, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
13586 }
13587 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
13588         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13589         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13590         memcpy(txid_arr->elems, *txid, 32);
13591         js_invoke_function_void_l(j_calls->instance_ptr, 72, (int64_t)txid_arr);
13592 }
13593 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13594         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13595         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13596         memcpy(header_arr->elems, *header, 80);
13597         int32_t height_conv = height;
13598         js_invoke_function_void_li(j_calls->instance_ptr, 73, (int64_t)header_arr, height_conv);
13599 }
13600 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
13601         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13602         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 74);
13603         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
13604         ret_constr.datalen = ret->arr_len;
13605         if (ret_constr.datalen > 0)
13606                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
13607         else
13608                 ret_constr.data = NULL;
13609         int64_t* ret_vals = ret->elems;
13610         for (size_t c = 0; c < ret_constr.datalen; c++) {
13611                 int64_t ret_conv_54 = ret_vals[c];
13612                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
13613                 CHECK_ACCESS(ret_conv_54_ptr);
13614                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
13615                 FREE(untag_ptr(ret_conv_54));
13616                 ret_constr.data[c] = ret_conv_54_conv;
13617         }
13618         FREE(ret);
13619         return ret_constr;
13620 }
13621 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
13622         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
13623         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13624 }
13625 static inline LDKConfirm LDKConfirm_init (int64_t o) {
13626         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
13627         atomic_init(&calls->refcnt, 1);
13628         calls->instance_ptr = o;
13629
13630         LDKConfirm ret = {
13631                 .this_arg = (void*) calls,
13632                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
13633                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
13634                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
13635                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
13636                 .free = LDKConfirm_JCalls_free,
13637         };
13638         return ret;
13639 }
13640 uint64_t  CS_LDK_LDKConfirm_new(int32_t o) {
13641         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13642         *res_ptr = LDKConfirm_init(o);
13643         return tag_ptr(res_ptr, true);
13644 }
13645 void  CS_LDK_Confirm_transactions_confirmed(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
13646         void* this_arg_ptr = untag_ptr(this_arg);
13647         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13648         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13649         uint8_t header_arr[80];
13650         CHECK(header->arr_len == 80);
13651         memcpy(header_arr, header->elems, 80); FREE(header);
13652         uint8_t (*header_ref)[80] = &header_arr;
13653         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13654         txdata_constr.datalen = txdata->arr_len;
13655         if (txdata_constr.datalen > 0)
13656                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13657         else
13658                 txdata_constr.data = NULL;
13659         int64_t* txdata_vals = txdata->elems;
13660         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13661                 int64_t txdata_conv_28 = txdata_vals[c];
13662                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13663                 CHECK_ACCESS(txdata_conv_28_ptr);
13664                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13665                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13666                 txdata_constr.data[c] = txdata_conv_28_conv;
13667         }
13668         FREE(txdata);
13669         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13670 }
13671
13672 void  CS_LDK_Confirm_transaction_unconfirmed(int64_t this_arg, int8_tArray txid) {
13673         void* this_arg_ptr = untag_ptr(this_arg);
13674         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13675         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13676         uint8_t txid_arr[32];
13677         CHECK(txid->arr_len == 32);
13678         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13679         uint8_t (*txid_ref)[32] = &txid_arr;
13680         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
13681 }
13682
13683 void  CS_LDK_Confirm_best_block_updated(int64_t this_arg, int8_tArray header, int32_t height) {
13684         void* this_arg_ptr = untag_ptr(this_arg);
13685         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13686         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13687         uint8_t header_arr[80];
13688         CHECK(header->arr_len == 80);
13689         memcpy(header_arr, header->elems, 80); FREE(header);
13690         uint8_t (*header_ref)[80] = &header_arr;
13691         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
13692 }
13693
13694 int64_tArray  CS_LDK_Confirm_get_relevant_txids(int64_t this_arg) {
13695         void* this_arg_ptr = untag_ptr(this_arg);
13696         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13697         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13698         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
13699         int64_tArray ret_arr = NULL;
13700         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
13701         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
13702         for (size_t c = 0; c < ret_var.datalen; c++) {
13703                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
13704                 *ret_conv_54_conv = ret_var.data[c];
13705                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
13706         }
13707         
13708         FREE(ret_var.data);
13709         return ret_arr;
13710 }
13711
13712 typedef struct LDKEventHandler_JCalls {
13713         atomic_size_t refcnt;
13714         uint32_t instance_ptr;
13715 } LDKEventHandler_JCalls;
13716 static void LDKEventHandler_JCalls_free(void* this_arg) {
13717         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13718         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13719                 FREE(j_calls);
13720         }
13721 }
13722 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
13723         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13724         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13725         *event_copy = event;
13726         int64_t event_ref = tag_ptr(event_copy, true);
13727         js_invoke_function_void_l(j_calls->instance_ptr, 75, event_ref);
13728 }
13729 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
13730         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
13731         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13732 }
13733 static inline LDKEventHandler LDKEventHandler_init (int64_t o) {
13734         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
13735         atomic_init(&calls->refcnt, 1);
13736         calls->instance_ptr = o;
13737
13738         LDKEventHandler ret = {
13739                 .this_arg = (void*) calls,
13740                 .handle_event = handle_event_LDKEventHandler_jcall,
13741                 .free = LDKEventHandler_JCalls_free,
13742         };
13743         return ret;
13744 }
13745 uint64_t  CS_LDK_LDKEventHandler_new(int32_t o) {
13746         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13747         *res_ptr = LDKEventHandler_init(o);
13748         return tag_ptr(res_ptr, true);
13749 }
13750 void  CS_LDK_EventHandler_handle_event(int64_t this_arg, int64_t event) {
13751         void* this_arg_ptr = untag_ptr(this_arg);
13752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13753         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
13754         void* event_ptr = untag_ptr(event);
13755         CHECK_ACCESS(event_ptr);
13756         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
13757         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
13758         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
13759 }
13760
13761 typedef struct LDKEventsProvider_JCalls {
13762         atomic_size_t refcnt;
13763         uint32_t instance_ptr;
13764 } LDKEventsProvider_JCalls;
13765 static void LDKEventsProvider_JCalls_free(void* this_arg) {
13766         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13767         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13768                 FREE(j_calls);
13769         }
13770 }
13771 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
13772         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13773         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13774         *handler_ret = handler;
13775         js_invoke_function_void_l(j_calls->instance_ptr, 76, tag_ptr(handler_ret, true));
13776 }
13777 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
13778         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
13779         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13780 }
13781 static inline LDKEventsProvider LDKEventsProvider_init (int64_t o) {
13782         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
13783         atomic_init(&calls->refcnt, 1);
13784         calls->instance_ptr = o;
13785
13786         LDKEventsProvider ret = {
13787                 .this_arg = (void*) calls,
13788                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
13789                 .free = LDKEventsProvider_JCalls_free,
13790         };
13791         return ret;
13792 }
13793 uint64_t  CS_LDK_LDKEventsProvider_new(int32_t o) {
13794         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13795         *res_ptr = LDKEventsProvider_init(o);
13796         return tag_ptr(res_ptr, true);
13797 }
13798 void  CS_LDK_EventsProvider_process_pending_events(int64_t this_arg, int64_t handler) {
13799         void* this_arg_ptr = untag_ptr(this_arg);
13800         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13801         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
13802         void* handler_ptr = untag_ptr(handler);
13803         CHECK_ACCESS(handler_ptr);
13804         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
13805         if (handler_conv.free == LDKEventHandler_JCalls_free) {
13806                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13807                 LDKEventHandler_JCalls_cloned(&handler_conv);
13808         }
13809         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
13810 }
13811
13812 uint32_t CS_LDK_LDKFailureCode_ty_from_ptr(int64_t ptr) {
13813         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13814         switch(obj->tag) {
13815                 case LDKFailureCode_TemporaryNodeFailure: return 0;
13816                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
13817                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
13818                 case LDKFailureCode_InvalidOnionPayload: return 3;
13819                 default: abort();
13820         }
13821 }
13822 int64_t CS_LDK_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(int64_t ptr) {
13823         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13824         CHECK(obj->tag == LDKFailureCode_InvalidOnionPayload);
13825         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
13826         return invalid_onion_payload_ref;
13827 }
13828 typedef struct LDKMessageSendEventsProvider_JCalls {
13829         atomic_size_t refcnt;
13830         uint32_t instance_ptr;
13831 } LDKMessageSendEventsProvider_JCalls;
13832 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
13833         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13834         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13835                 FREE(j_calls);
13836         }
13837 }
13838 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
13839         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13840         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 77);
13841         LDKCVec_MessageSendEventZ ret_constr;
13842         ret_constr.datalen = ret->arr_len;
13843         if (ret_constr.datalen > 0)
13844                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13845         else
13846                 ret_constr.data = NULL;
13847         int64_t* ret_vals = ret->elems;
13848         for (size_t s = 0; s < ret_constr.datalen; s++) {
13849                 int64_t ret_conv_18 = ret_vals[s];
13850                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
13851                 CHECK_ACCESS(ret_conv_18_ptr);
13852                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
13853                 FREE(untag_ptr(ret_conv_18));
13854                 ret_constr.data[s] = ret_conv_18_conv;
13855         }
13856         FREE(ret);
13857         return ret_constr;
13858 }
13859 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
13860         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
13861         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13862 }
13863 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (int64_t o) {
13864         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
13865         atomic_init(&calls->refcnt, 1);
13866         calls->instance_ptr = o;
13867
13868         LDKMessageSendEventsProvider ret = {
13869                 .this_arg = (void*) calls,
13870                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
13871                 .free = LDKMessageSendEventsProvider_JCalls_free,
13872         };
13873         return ret;
13874 }
13875 uint64_t  CS_LDK_LDKMessageSendEventsProvider_new(int32_t o) {
13876         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
13877         *res_ptr = LDKMessageSendEventsProvider_init(o);
13878         return tag_ptr(res_ptr, true);
13879 }
13880 int64_tArray  CS_LDK_MessageSendEventsProvider_get_and_clear_pending_msg_events(int64_t this_arg) {
13881         void* this_arg_ptr = untag_ptr(this_arg);
13882         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13883         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
13884         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
13885         int64_tArray ret_arr = NULL;
13886         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
13887         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
13888         for (size_t s = 0; s < ret_var.datalen; s++) {
13889                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13890                 *ret_conv_18_copy = ret_var.data[s];
13891                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
13892                 ret_arr_ptr[s] = ret_conv_18_ref;
13893         }
13894         
13895         FREE(ret_var.data);
13896         return ret_arr;
13897 }
13898
13899 typedef struct LDKChannelMessageHandler_JCalls {
13900         atomic_size_t refcnt;
13901         uint32_t instance_ptr;
13902         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13903 } LDKChannelMessageHandler_JCalls;
13904 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
13905         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13906         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13907                 FREE(j_calls);
13908         }
13909 }
13910 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
13911         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13912         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13913         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13914         LDKOpenChannel msg_var = *msg;
13915         int64_t msg_ref = 0;
13916         msg_var = OpenChannel_clone(&msg_var);
13917         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13918         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13919         js_invoke_function_void_ll(j_calls->instance_ptr, 78, (int64_t)their_node_id_arr, msg_ref);
13920 }
13921 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
13922         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13923         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13924         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13925         LDKOpenChannelV2 msg_var = *msg;
13926         int64_t msg_ref = 0;
13927         msg_var = OpenChannelV2_clone(&msg_var);
13928         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13929         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13930         js_invoke_function_void_ll(j_calls->instance_ptr, 79, (int64_t)their_node_id_arr, msg_ref);
13931 }
13932 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
13933         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13934         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13935         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13936         LDKAcceptChannel msg_var = *msg;
13937         int64_t msg_ref = 0;
13938         msg_var = AcceptChannel_clone(&msg_var);
13939         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13940         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13941         js_invoke_function_void_ll(j_calls->instance_ptr, 80, (int64_t)their_node_id_arr, msg_ref);
13942 }
13943 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
13944         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13945         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13946         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13947         LDKAcceptChannelV2 msg_var = *msg;
13948         int64_t msg_ref = 0;
13949         msg_var = AcceptChannelV2_clone(&msg_var);
13950         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13951         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13952         js_invoke_function_void_ll(j_calls->instance_ptr, 81, (int64_t)their_node_id_arr, msg_ref);
13953 }
13954 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
13955         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13956         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13957         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13958         LDKFundingCreated msg_var = *msg;
13959         int64_t msg_ref = 0;
13960         msg_var = FundingCreated_clone(&msg_var);
13961         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13962         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13963         js_invoke_function_void_ll(j_calls->instance_ptr, 82, (int64_t)their_node_id_arr, msg_ref);
13964 }
13965 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
13966         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13967         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13968         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13969         LDKFundingSigned msg_var = *msg;
13970         int64_t msg_ref = 0;
13971         msg_var = FundingSigned_clone(&msg_var);
13972         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13973         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13974         js_invoke_function_void_ll(j_calls->instance_ptr, 83, (int64_t)their_node_id_arr, msg_ref);
13975 }
13976 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
13977         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13978         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13979         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13980         LDKChannelReady msg_var = *msg;
13981         int64_t msg_ref = 0;
13982         msg_var = ChannelReady_clone(&msg_var);
13983         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13984         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13985         js_invoke_function_void_ll(j_calls->instance_ptr, 84, (int64_t)their_node_id_arr, msg_ref);
13986 }
13987 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
13988         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13989         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13990         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13991         LDKShutdown msg_var = *msg;
13992         int64_t msg_ref = 0;
13993         msg_var = Shutdown_clone(&msg_var);
13994         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13995         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13996         js_invoke_function_void_ll(j_calls->instance_ptr, 85, (int64_t)their_node_id_arr, msg_ref);
13997 }
13998 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
13999         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14000         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14001         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14002         LDKClosingSigned msg_var = *msg;
14003         int64_t msg_ref = 0;
14004         msg_var = ClosingSigned_clone(&msg_var);
14005         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14006         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14007         js_invoke_function_void_ll(j_calls->instance_ptr, 86, (int64_t)their_node_id_arr, msg_ref);
14008 }
14009 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
14010         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14011         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14012         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14013         LDKStfu msg_var = *msg;
14014         int64_t msg_ref = 0;
14015         msg_var = Stfu_clone(&msg_var);
14016         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14017         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14018         js_invoke_function_void_ll(j_calls->instance_ptr, 87, (int64_t)their_node_id_arr, msg_ref);
14019 }
14020 void handle_splice_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSplice * msg) {
14021         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14022         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14023         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14024         LDKSplice msg_var = *msg;
14025         int64_t msg_ref = 0;
14026         msg_var = Splice_clone(&msg_var);
14027         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14028         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14029         js_invoke_function_void_ll(j_calls->instance_ptr, 88, (int64_t)their_node_id_arr, msg_ref);
14030 }
14031 void handle_splice_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceAck * msg) {
14032         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14033         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14034         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14035         LDKSpliceAck msg_var = *msg;
14036         int64_t msg_ref = 0;
14037         msg_var = SpliceAck_clone(&msg_var);
14038         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14039         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14040         js_invoke_function_void_ll(j_calls->instance_ptr, 89, (int64_t)their_node_id_arr, msg_ref);
14041 }
14042 void handle_splice_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceLocked * msg) {
14043         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14044         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14045         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14046         LDKSpliceLocked msg_var = *msg;
14047         int64_t msg_ref = 0;
14048         msg_var = SpliceLocked_clone(&msg_var);
14049         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14050         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14051         js_invoke_function_void_ll(j_calls->instance_ptr, 90, (int64_t)their_node_id_arr, msg_ref);
14052 }
14053 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
14054         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14055         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14056         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14057         LDKTxAddInput msg_var = *msg;
14058         int64_t msg_ref = 0;
14059         msg_var = TxAddInput_clone(&msg_var);
14060         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14061         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14062         js_invoke_function_void_ll(j_calls->instance_ptr, 91, (int64_t)their_node_id_arr, msg_ref);
14063 }
14064 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
14065         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14066         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14067         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14068         LDKTxAddOutput msg_var = *msg;
14069         int64_t msg_ref = 0;
14070         msg_var = TxAddOutput_clone(&msg_var);
14071         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14072         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14073         js_invoke_function_void_ll(j_calls->instance_ptr, 92, (int64_t)their_node_id_arr, msg_ref);
14074 }
14075 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
14076         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14077         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14078         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14079         LDKTxRemoveInput msg_var = *msg;
14080         int64_t msg_ref = 0;
14081         msg_var = TxRemoveInput_clone(&msg_var);
14082         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14083         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14084         js_invoke_function_void_ll(j_calls->instance_ptr, 93, (int64_t)their_node_id_arr, msg_ref);
14085 }
14086 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
14087         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14088         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14089         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14090         LDKTxRemoveOutput msg_var = *msg;
14091         int64_t msg_ref = 0;
14092         msg_var = TxRemoveOutput_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         js_invoke_function_void_ll(j_calls->instance_ptr, 94, (int64_t)their_node_id_arr, msg_ref);
14096 }
14097 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
14098         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14099         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14100         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14101         LDKTxComplete msg_var = *msg;
14102         int64_t msg_ref = 0;
14103         msg_var = TxComplete_clone(&msg_var);
14104         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14105         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14106         js_invoke_function_void_ll(j_calls->instance_ptr, 95, (int64_t)their_node_id_arr, msg_ref);
14107 }
14108 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
14109         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14110         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14111         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14112         LDKTxSignatures msg_var = *msg;
14113         int64_t msg_ref = 0;
14114         msg_var = TxSignatures_clone(&msg_var);
14115         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14116         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14117         js_invoke_function_void_ll(j_calls->instance_ptr, 96, (int64_t)their_node_id_arr, msg_ref);
14118 }
14119 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
14120         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14121         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14122         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14123         LDKTxInitRbf msg_var = *msg;
14124         int64_t msg_ref = 0;
14125         msg_var = TxInitRbf_clone(&msg_var);
14126         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14127         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14128         js_invoke_function_void_ll(j_calls->instance_ptr, 97, (int64_t)their_node_id_arr, msg_ref);
14129 }
14130 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
14131         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14132         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14133         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14134         LDKTxAckRbf msg_var = *msg;
14135         int64_t msg_ref = 0;
14136         msg_var = TxAckRbf_clone(&msg_var);
14137         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14138         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14139         js_invoke_function_void_ll(j_calls->instance_ptr, 98, (int64_t)their_node_id_arr, msg_ref);
14140 }
14141 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
14142         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14143         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14144         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14145         LDKTxAbort msg_var = *msg;
14146         int64_t msg_ref = 0;
14147         msg_var = TxAbort_clone(&msg_var);
14148         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14149         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14150         js_invoke_function_void_ll(j_calls->instance_ptr, 99, (int64_t)their_node_id_arr, msg_ref);
14151 }
14152 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
14153         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14154         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14155         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14156         LDKUpdateAddHTLC msg_var = *msg;
14157         int64_t msg_ref = 0;
14158         msg_var = UpdateAddHTLC_clone(&msg_var);
14159         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14160         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14161         js_invoke_function_void_ll(j_calls->instance_ptr, 100, (int64_t)their_node_id_arr, msg_ref);
14162 }
14163 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
14164         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14165         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14166         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14167         LDKUpdateFulfillHTLC msg_var = *msg;
14168         int64_t msg_ref = 0;
14169         msg_var = UpdateFulfillHTLC_clone(&msg_var);
14170         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14171         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14172         js_invoke_function_void_ll(j_calls->instance_ptr, 101, (int64_t)their_node_id_arr, msg_ref);
14173 }
14174 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
14175         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14176         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14177         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14178         LDKUpdateFailHTLC msg_var = *msg;
14179         int64_t msg_ref = 0;
14180         msg_var = UpdateFailHTLC_clone(&msg_var);
14181         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14182         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14183         js_invoke_function_void_ll(j_calls->instance_ptr, 102, (int64_t)their_node_id_arr, msg_ref);
14184 }
14185 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
14186         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14187         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14188         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14189         LDKUpdateFailMalformedHTLC msg_var = *msg;
14190         int64_t msg_ref = 0;
14191         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
14192         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14193         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14194         js_invoke_function_void_ll(j_calls->instance_ptr, 103, (int64_t)their_node_id_arr, msg_ref);
14195 }
14196 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
14197         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14198         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14199         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14200         LDKCommitmentSigned msg_var = *msg;
14201         int64_t msg_ref = 0;
14202         msg_var = CommitmentSigned_clone(&msg_var);
14203         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14204         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14205         js_invoke_function_void_ll(j_calls->instance_ptr, 104, (int64_t)their_node_id_arr, msg_ref);
14206 }
14207 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
14208         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14209         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14210         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14211         LDKRevokeAndACK msg_var = *msg;
14212         int64_t msg_ref = 0;
14213         msg_var = RevokeAndACK_clone(&msg_var);
14214         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14215         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14216         js_invoke_function_void_ll(j_calls->instance_ptr, 105, (int64_t)their_node_id_arr, msg_ref);
14217 }
14218 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
14219         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14220         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14221         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14222         LDKUpdateFee msg_var = *msg;
14223         int64_t msg_ref = 0;
14224         msg_var = UpdateFee_clone(&msg_var);
14225         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14226         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14227         js_invoke_function_void_ll(j_calls->instance_ptr, 106, (int64_t)their_node_id_arr, msg_ref);
14228 }
14229 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
14230         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14231         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14232         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14233         LDKAnnouncementSignatures msg_var = *msg;
14234         int64_t msg_ref = 0;
14235         msg_var = AnnouncementSignatures_clone(&msg_var);
14236         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14237         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14238         js_invoke_function_void_ll(j_calls->instance_ptr, 107, (int64_t)their_node_id_arr, msg_ref);
14239 }
14240 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14241         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14242         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14243         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14244         js_invoke_function_void_l(j_calls->instance_ptr, 108, (int64_t)their_node_id_arr);
14245 }
14246 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
14247         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14248         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14249         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14250         LDKInit msg_var = *msg;
14251         int64_t msg_ref = 0;
14252         msg_var = Init_clone(&msg_var);
14253         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14254         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14255         jboolean inbound_conv = inbound;
14256         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 109, (int64_t)their_node_id_arr, msg_ref, inbound_conv);
14257         void* ret_ptr = untag_ptr(ret);
14258         CHECK_ACCESS(ret_ptr);
14259         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14260         FREE(untag_ptr(ret));
14261         return ret_conv;
14262 }
14263 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
14264         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14265         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14266         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14267         LDKChannelReestablish msg_var = *msg;
14268         int64_t msg_ref = 0;
14269         msg_var = ChannelReestablish_clone(&msg_var);
14270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14271         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14272         js_invoke_function_void_ll(j_calls->instance_ptr, 110, (int64_t)their_node_id_arr, msg_ref);
14273 }
14274 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
14275         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14276         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14277         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14278         LDKChannelUpdate msg_var = *msg;
14279         int64_t msg_ref = 0;
14280         msg_var = ChannelUpdate_clone(&msg_var);
14281         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14282         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14283         js_invoke_function_void_ll(j_calls->instance_ptr, 111, (int64_t)their_node_id_arr, msg_ref);
14284 }
14285 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
14286         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14287         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14288         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14289         LDKErrorMessage msg_var = *msg;
14290         int64_t msg_ref = 0;
14291         msg_var = ErrorMessage_clone(&msg_var);
14292         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14293         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14294         js_invoke_function_void_ll(j_calls->instance_ptr, 112, (int64_t)their_node_id_arr, msg_ref);
14295 }
14296 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
14297         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14298         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 113);
14299         LDKNodeFeatures ret_conv;
14300         ret_conv.inner = untag_ptr(ret);
14301         ret_conv.is_owned = ptr_is_owned(ret);
14302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14303         return ret_conv;
14304 }
14305 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14306         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14307         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14308         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14309         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 114, (int64_t)their_node_id_arr);
14310         LDKInitFeatures ret_conv;
14311         ret_conv.inner = untag_ptr(ret);
14312         ret_conv.is_owned = ptr_is_owned(ret);
14313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14314         return ret_conv;
14315 }
14316 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
14317         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14318         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 115);
14319         void* ret_ptr = untag_ptr(ret);
14320         CHECK_ACCESS(ret_ptr);
14321         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
14322         FREE(untag_ptr(ret));
14323         return ret_conv;
14324 }
14325 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
14326         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
14327         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14328         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
14329 }
14330 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
14331         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
14332         atomic_init(&calls->refcnt, 1);
14333         calls->instance_ptr = o;
14334
14335         LDKChannelMessageHandler ret = {
14336                 .this_arg = (void*) calls,
14337                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
14338                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
14339                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
14340                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
14341                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
14342                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
14343                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
14344                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
14345                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
14346                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
14347                 .handle_splice = handle_splice_LDKChannelMessageHandler_jcall,
14348                 .handle_splice_ack = handle_splice_ack_LDKChannelMessageHandler_jcall,
14349                 .handle_splice_locked = handle_splice_locked_LDKChannelMessageHandler_jcall,
14350                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
14351                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
14352                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
14353                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
14354                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
14355                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
14356                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
14357                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
14358                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
14359                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
14360                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
14361                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
14362                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
14363                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
14364                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
14365                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
14366                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
14367                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
14368                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
14369                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
14370                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
14371                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
14372                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
14373                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
14374                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
14375                 .free = LDKChannelMessageHandler_JCalls_free,
14376                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
14377         };
14378         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
14379         return ret;
14380 }
14381 uint64_t  CS_LDK_LDKChannelMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
14382         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
14383         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
14384         return tag_ptr(res_ptr, true);
14385 }
14386 void  CS_LDK_ChannelMessageHandler_handle_open_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14387         void* this_arg_ptr = untag_ptr(this_arg);
14388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14389         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14390         LDKPublicKey their_node_id_ref;
14391         CHECK(their_node_id->arr_len == 33);
14392         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14393         LDKOpenChannel msg_conv;
14394         msg_conv.inner = untag_ptr(msg);
14395         msg_conv.is_owned = ptr_is_owned(msg);
14396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14397         msg_conv.is_owned = false;
14398         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14399 }
14400
14401 void  CS_LDK_ChannelMessageHandler_handle_open_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14402         void* this_arg_ptr = untag_ptr(this_arg);
14403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14404         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14405         LDKPublicKey their_node_id_ref;
14406         CHECK(their_node_id->arr_len == 33);
14407         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14408         LDKOpenChannelV2 msg_conv;
14409         msg_conv.inner = untag_ptr(msg);
14410         msg_conv.is_owned = ptr_is_owned(msg);
14411         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14412         msg_conv.is_owned = false;
14413         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14414 }
14415
14416 void  CS_LDK_ChannelMessageHandler_handle_accept_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14417         void* this_arg_ptr = untag_ptr(this_arg);
14418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14419         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14420         LDKPublicKey their_node_id_ref;
14421         CHECK(their_node_id->arr_len == 33);
14422         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14423         LDKAcceptChannel msg_conv;
14424         msg_conv.inner = untag_ptr(msg);
14425         msg_conv.is_owned = ptr_is_owned(msg);
14426         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14427         msg_conv.is_owned = false;
14428         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14429 }
14430
14431 void  CS_LDK_ChannelMessageHandler_handle_accept_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14432         void* this_arg_ptr = untag_ptr(this_arg);
14433         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14434         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14435         LDKPublicKey their_node_id_ref;
14436         CHECK(their_node_id->arr_len == 33);
14437         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14438         LDKAcceptChannelV2 msg_conv;
14439         msg_conv.inner = untag_ptr(msg);
14440         msg_conv.is_owned = ptr_is_owned(msg);
14441         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14442         msg_conv.is_owned = false;
14443         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14444 }
14445
14446 void  CS_LDK_ChannelMessageHandler_handle_funding_created(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14447         void* this_arg_ptr = untag_ptr(this_arg);
14448         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14449         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14450         LDKPublicKey their_node_id_ref;
14451         CHECK(their_node_id->arr_len == 33);
14452         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14453         LDKFundingCreated msg_conv;
14454         msg_conv.inner = untag_ptr(msg);
14455         msg_conv.is_owned = ptr_is_owned(msg);
14456         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14457         msg_conv.is_owned = false;
14458         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14459 }
14460
14461 void  CS_LDK_ChannelMessageHandler_handle_funding_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14462         void* this_arg_ptr = untag_ptr(this_arg);
14463         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14464         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14465         LDKPublicKey their_node_id_ref;
14466         CHECK(their_node_id->arr_len == 33);
14467         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14468         LDKFundingSigned msg_conv;
14469         msg_conv.inner = untag_ptr(msg);
14470         msg_conv.is_owned = ptr_is_owned(msg);
14471         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14472         msg_conv.is_owned = false;
14473         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14474 }
14475
14476 void  CS_LDK_ChannelMessageHandler_handle_channel_ready(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14477         void* this_arg_ptr = untag_ptr(this_arg);
14478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14479         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14480         LDKPublicKey their_node_id_ref;
14481         CHECK(their_node_id->arr_len == 33);
14482         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14483         LDKChannelReady msg_conv;
14484         msg_conv.inner = untag_ptr(msg);
14485         msg_conv.is_owned = ptr_is_owned(msg);
14486         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14487         msg_conv.is_owned = false;
14488         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14489 }
14490
14491 void  CS_LDK_ChannelMessageHandler_handle_shutdown(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14492         void* this_arg_ptr = untag_ptr(this_arg);
14493         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14494         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14495         LDKPublicKey their_node_id_ref;
14496         CHECK(their_node_id->arr_len == 33);
14497         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14498         LDKShutdown msg_conv;
14499         msg_conv.inner = untag_ptr(msg);
14500         msg_conv.is_owned = ptr_is_owned(msg);
14501         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14502         msg_conv.is_owned = false;
14503         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14504 }
14505
14506 void  CS_LDK_ChannelMessageHandler_handle_closing_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14507         void* this_arg_ptr = untag_ptr(this_arg);
14508         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14509         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14510         LDKPublicKey their_node_id_ref;
14511         CHECK(their_node_id->arr_len == 33);
14512         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14513         LDKClosingSigned 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         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14519 }
14520
14521 void  CS_LDK_ChannelMessageHandler_handle_stfu(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14522         void* this_arg_ptr = untag_ptr(this_arg);
14523         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14524         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14525         LDKPublicKey their_node_id_ref;
14526         CHECK(their_node_id->arr_len == 33);
14527         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14528         LDKStfu msg_conv;
14529         msg_conv.inner = untag_ptr(msg);
14530         msg_conv.is_owned = ptr_is_owned(msg);
14531         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14532         msg_conv.is_owned = false;
14533         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14534 }
14535
14536 void  CS_LDK_ChannelMessageHandler_handle_splice(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14537         void* this_arg_ptr = untag_ptr(this_arg);
14538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14539         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14540         LDKPublicKey their_node_id_ref;
14541         CHECK(their_node_id->arr_len == 33);
14542         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14543         LDKSplice msg_conv;
14544         msg_conv.inner = untag_ptr(msg);
14545         msg_conv.is_owned = ptr_is_owned(msg);
14546         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14547         msg_conv.is_owned = false;
14548         (this_arg_conv->handle_splice)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14549 }
14550
14551 void  CS_LDK_ChannelMessageHandler_handle_splice_ack(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14552         void* this_arg_ptr = untag_ptr(this_arg);
14553         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14554         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14555         LDKPublicKey their_node_id_ref;
14556         CHECK(their_node_id->arr_len == 33);
14557         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14558         LDKSpliceAck msg_conv;
14559         msg_conv.inner = untag_ptr(msg);
14560         msg_conv.is_owned = ptr_is_owned(msg);
14561         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14562         msg_conv.is_owned = false;
14563         (this_arg_conv->handle_splice_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14564 }
14565
14566 void  CS_LDK_ChannelMessageHandler_handle_splice_locked(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14567         void* this_arg_ptr = untag_ptr(this_arg);
14568         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14569         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14570         LDKPublicKey their_node_id_ref;
14571         CHECK(their_node_id->arr_len == 33);
14572         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14573         LDKSpliceLocked msg_conv;
14574         msg_conv.inner = untag_ptr(msg);
14575         msg_conv.is_owned = ptr_is_owned(msg);
14576         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14577         msg_conv.is_owned = false;
14578         (this_arg_conv->handle_splice_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14579 }
14580
14581 void  CS_LDK_ChannelMessageHandler_handle_tx_add_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14582         void* this_arg_ptr = untag_ptr(this_arg);
14583         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14584         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14585         LDKPublicKey their_node_id_ref;
14586         CHECK(their_node_id->arr_len == 33);
14587         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14588         LDKTxAddInput msg_conv;
14589         msg_conv.inner = untag_ptr(msg);
14590         msg_conv.is_owned = ptr_is_owned(msg);
14591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14592         msg_conv.is_owned = false;
14593         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14594 }
14595
14596 void  CS_LDK_ChannelMessageHandler_handle_tx_add_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14597         void* this_arg_ptr = untag_ptr(this_arg);
14598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14599         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14600         LDKPublicKey their_node_id_ref;
14601         CHECK(their_node_id->arr_len == 33);
14602         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14603         LDKTxAddOutput msg_conv;
14604         msg_conv.inner = untag_ptr(msg);
14605         msg_conv.is_owned = ptr_is_owned(msg);
14606         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14607         msg_conv.is_owned = false;
14608         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14609 }
14610
14611 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14612         void* this_arg_ptr = untag_ptr(this_arg);
14613         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14614         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14615         LDKPublicKey their_node_id_ref;
14616         CHECK(their_node_id->arr_len == 33);
14617         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14618         LDKTxRemoveInput msg_conv;
14619         msg_conv.inner = untag_ptr(msg);
14620         msg_conv.is_owned = ptr_is_owned(msg);
14621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14622         msg_conv.is_owned = false;
14623         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14624 }
14625
14626 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14627         void* this_arg_ptr = untag_ptr(this_arg);
14628         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14629         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14630         LDKPublicKey their_node_id_ref;
14631         CHECK(their_node_id->arr_len == 33);
14632         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14633         LDKTxRemoveOutput msg_conv;
14634         msg_conv.inner = untag_ptr(msg);
14635         msg_conv.is_owned = ptr_is_owned(msg);
14636         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14637         msg_conv.is_owned = false;
14638         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14639 }
14640
14641 void  CS_LDK_ChannelMessageHandler_handle_tx_complete(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14642         void* this_arg_ptr = untag_ptr(this_arg);
14643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14644         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14645         LDKPublicKey their_node_id_ref;
14646         CHECK(their_node_id->arr_len == 33);
14647         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14648         LDKTxComplete msg_conv;
14649         msg_conv.inner = untag_ptr(msg);
14650         msg_conv.is_owned = ptr_is_owned(msg);
14651         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14652         msg_conv.is_owned = false;
14653         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14654 }
14655
14656 void  CS_LDK_ChannelMessageHandler_handle_tx_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14657         void* this_arg_ptr = untag_ptr(this_arg);
14658         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14659         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14660         LDKPublicKey their_node_id_ref;
14661         CHECK(their_node_id->arr_len == 33);
14662         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14663         LDKTxSignatures msg_conv;
14664         msg_conv.inner = untag_ptr(msg);
14665         msg_conv.is_owned = ptr_is_owned(msg);
14666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14667         msg_conv.is_owned = false;
14668         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14669 }
14670
14671 void  CS_LDK_ChannelMessageHandler_handle_tx_init_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14672         void* this_arg_ptr = untag_ptr(this_arg);
14673         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14674         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14675         LDKPublicKey their_node_id_ref;
14676         CHECK(their_node_id->arr_len == 33);
14677         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14678         LDKTxInitRbf msg_conv;
14679         msg_conv.inner = untag_ptr(msg);
14680         msg_conv.is_owned = ptr_is_owned(msg);
14681         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14682         msg_conv.is_owned = false;
14683         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14684 }
14685
14686 void  CS_LDK_ChannelMessageHandler_handle_tx_ack_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14687         void* this_arg_ptr = untag_ptr(this_arg);
14688         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14689         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14690         LDKPublicKey their_node_id_ref;
14691         CHECK(their_node_id->arr_len == 33);
14692         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14693         LDKTxAckRbf msg_conv;
14694         msg_conv.inner = untag_ptr(msg);
14695         msg_conv.is_owned = ptr_is_owned(msg);
14696         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14697         msg_conv.is_owned = false;
14698         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14699 }
14700
14701 void  CS_LDK_ChannelMessageHandler_handle_tx_abort(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14702         void* this_arg_ptr = untag_ptr(this_arg);
14703         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14704         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14705         LDKPublicKey their_node_id_ref;
14706         CHECK(their_node_id->arr_len == 33);
14707         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14708         LDKTxAbort msg_conv;
14709         msg_conv.inner = untag_ptr(msg);
14710         msg_conv.is_owned = ptr_is_owned(msg);
14711         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14712         msg_conv.is_owned = false;
14713         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14714 }
14715
14716 void  CS_LDK_ChannelMessageHandler_handle_update_add_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14717         void* this_arg_ptr = untag_ptr(this_arg);
14718         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14719         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14720         LDKPublicKey their_node_id_ref;
14721         CHECK(their_node_id->arr_len == 33);
14722         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14723         LDKUpdateAddHTLC msg_conv;
14724         msg_conv.inner = untag_ptr(msg);
14725         msg_conv.is_owned = ptr_is_owned(msg);
14726         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14727         msg_conv.is_owned = false;
14728         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14729 }
14730
14731 void  CS_LDK_ChannelMessageHandler_handle_update_fulfill_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14732         void* this_arg_ptr = untag_ptr(this_arg);
14733         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14734         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14735         LDKPublicKey their_node_id_ref;
14736         CHECK(their_node_id->arr_len == 33);
14737         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14738         LDKUpdateFulfillHTLC msg_conv;
14739         msg_conv.inner = untag_ptr(msg);
14740         msg_conv.is_owned = ptr_is_owned(msg);
14741         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14742         msg_conv.is_owned = false;
14743         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14744 }
14745
14746 void  CS_LDK_ChannelMessageHandler_handle_update_fail_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14747         void* this_arg_ptr = untag_ptr(this_arg);
14748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14749         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14750         LDKPublicKey their_node_id_ref;
14751         CHECK(their_node_id->arr_len == 33);
14752         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14753         LDKUpdateFailHTLC msg_conv;
14754         msg_conv.inner = untag_ptr(msg);
14755         msg_conv.is_owned = ptr_is_owned(msg);
14756         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14757         msg_conv.is_owned = false;
14758         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14759 }
14760
14761 void  CS_LDK_ChannelMessageHandler_handle_update_fail_malformed_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14762         void* this_arg_ptr = untag_ptr(this_arg);
14763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14764         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14765         LDKPublicKey their_node_id_ref;
14766         CHECK(their_node_id->arr_len == 33);
14767         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14768         LDKUpdateFailMalformedHTLC msg_conv;
14769         msg_conv.inner = untag_ptr(msg);
14770         msg_conv.is_owned = ptr_is_owned(msg);
14771         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14772         msg_conv.is_owned = false;
14773         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14774 }
14775
14776 void  CS_LDK_ChannelMessageHandler_handle_commitment_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14777         void* this_arg_ptr = untag_ptr(this_arg);
14778         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14779         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14780         LDKPublicKey their_node_id_ref;
14781         CHECK(their_node_id->arr_len == 33);
14782         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14783         LDKCommitmentSigned msg_conv;
14784         msg_conv.inner = untag_ptr(msg);
14785         msg_conv.is_owned = ptr_is_owned(msg);
14786         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14787         msg_conv.is_owned = false;
14788         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14789 }
14790
14791 void  CS_LDK_ChannelMessageHandler_handle_revoke_and_ack(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14792         void* this_arg_ptr = untag_ptr(this_arg);
14793         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14794         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14795         LDKPublicKey their_node_id_ref;
14796         CHECK(their_node_id->arr_len == 33);
14797         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14798         LDKRevokeAndACK msg_conv;
14799         msg_conv.inner = untag_ptr(msg);
14800         msg_conv.is_owned = ptr_is_owned(msg);
14801         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14802         msg_conv.is_owned = false;
14803         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14804 }
14805
14806 void  CS_LDK_ChannelMessageHandler_handle_update_fee(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14807         void* this_arg_ptr = untag_ptr(this_arg);
14808         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14809         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14810         LDKPublicKey their_node_id_ref;
14811         CHECK(their_node_id->arr_len == 33);
14812         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14813         LDKUpdateFee msg_conv;
14814         msg_conv.inner = untag_ptr(msg);
14815         msg_conv.is_owned = ptr_is_owned(msg);
14816         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14817         msg_conv.is_owned = false;
14818         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14819 }
14820
14821 void  CS_LDK_ChannelMessageHandler_handle_announcement_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14822         void* this_arg_ptr = untag_ptr(this_arg);
14823         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14824         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14825         LDKPublicKey their_node_id_ref;
14826         CHECK(their_node_id->arr_len == 33);
14827         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14828         LDKAnnouncementSignatures msg_conv;
14829         msg_conv.inner = untag_ptr(msg);
14830         msg_conv.is_owned = ptr_is_owned(msg);
14831         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14832         msg_conv.is_owned = false;
14833         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14834 }
14835
14836 void  CS_LDK_ChannelMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
14837         void* this_arg_ptr = untag_ptr(this_arg);
14838         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14839         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14840         LDKPublicKey their_node_id_ref;
14841         CHECK(their_node_id->arr_len == 33);
14842         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14843         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
14844 }
14845
14846 int64_t  CS_LDK_ChannelMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t msg, jboolean inbound) {
14847         void* this_arg_ptr = untag_ptr(this_arg);
14848         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14849         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14850         LDKPublicKey their_node_id_ref;
14851         CHECK(their_node_id->arr_len == 33);
14852         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14853         LDKInit msg_conv;
14854         msg_conv.inner = untag_ptr(msg);
14855         msg_conv.is_owned = ptr_is_owned(msg);
14856         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14857         msg_conv.is_owned = false;
14858         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14859         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
14860         return tag_ptr(ret_conv, true);
14861 }
14862
14863 void  CS_LDK_ChannelMessageHandler_handle_channel_reestablish(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14864         void* this_arg_ptr = untag_ptr(this_arg);
14865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14866         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14867         LDKPublicKey their_node_id_ref;
14868         CHECK(their_node_id->arr_len == 33);
14869         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14870         LDKChannelReestablish msg_conv;
14871         msg_conv.inner = untag_ptr(msg);
14872         msg_conv.is_owned = ptr_is_owned(msg);
14873         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14874         msg_conv.is_owned = false;
14875         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14876 }
14877
14878 void  CS_LDK_ChannelMessageHandler_handle_channel_update(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14879         void* this_arg_ptr = untag_ptr(this_arg);
14880         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14881         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14882         LDKPublicKey their_node_id_ref;
14883         CHECK(their_node_id->arr_len == 33);
14884         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14885         LDKChannelUpdate msg_conv;
14886         msg_conv.inner = untag_ptr(msg);
14887         msg_conv.is_owned = ptr_is_owned(msg);
14888         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14889         msg_conv.is_owned = false;
14890         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14891 }
14892
14893 void  CS_LDK_ChannelMessageHandler_handle_error(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14894         void* this_arg_ptr = untag_ptr(this_arg);
14895         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14896         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14897         LDKPublicKey their_node_id_ref;
14898         CHECK(their_node_id->arr_len == 33);
14899         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14900         LDKErrorMessage msg_conv;
14901         msg_conv.inner = untag_ptr(msg);
14902         msg_conv.is_owned = ptr_is_owned(msg);
14903         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14904         msg_conv.is_owned = false;
14905         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14906 }
14907
14908 int64_t  CS_LDK_ChannelMessageHandler_provided_node_features(int64_t this_arg) {
14909         void* this_arg_ptr = untag_ptr(this_arg);
14910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14911         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14912         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14913         int64_t ret_ref = 0;
14914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14916         return ret_ref;
14917 }
14918
14919 int64_t  CS_LDK_ChannelMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
14920         void* this_arg_ptr = untag_ptr(this_arg);
14921         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14922         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14923         LDKPublicKey their_node_id_ref;
14924         CHECK(their_node_id->arr_len == 33);
14925         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14926         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14927         int64_t ret_ref = 0;
14928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14930         return ret_ref;
14931 }
14932
14933 int64_t  CS_LDK_ChannelMessageHandler_get_chain_hashes(int64_t this_arg) {
14934         void* this_arg_ptr = untag_ptr(this_arg);
14935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14936         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14937         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
14938         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
14939         int64_t ret_ref = tag_ptr(ret_copy, true);
14940         return ret_ref;
14941 }
14942
14943 typedef struct LDKOffersMessageHandler_JCalls {
14944         atomic_size_t refcnt;
14945         uint32_t instance_ptr;
14946 } LDKOffersMessageHandler_JCalls;
14947 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
14948         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14949         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14950                 FREE(j_calls);
14951         }
14952 }
14953 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
14954         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14955         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
14956         *message_copy = message;
14957         int64_t message_ref = tag_ptr(message_copy, true);
14958         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 116, message_ref);
14959         void* ret_ptr = untag_ptr(ret);
14960         CHECK_ACCESS(ret_ptr);
14961         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
14962         FREE(untag_ptr(ret));
14963         return ret_conv;
14964 }
14965 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
14966         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14967         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 117);
14968         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
14969         ret_constr.datalen = ret->arr_len;
14970         if (ret_constr.datalen > 0)
14971                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
14972         else
14973                 ret_constr.data = NULL;
14974         int64_t* ret_vals = ret->elems;
14975         for (size_t x = 0; x < ret_constr.datalen; x++) {
14976                 int64_t ret_conv_49 = ret_vals[x];
14977                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
14978                 CHECK_ACCESS(ret_conv_49_ptr);
14979                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
14980                 FREE(untag_ptr(ret_conv_49));
14981                 ret_constr.data[x] = ret_conv_49_conv;
14982         }
14983         FREE(ret);
14984         return ret_constr;
14985 }
14986 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
14987         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
14988         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14989 }
14990 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (int64_t o) {
14991         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
14992         atomic_init(&calls->refcnt, 1);
14993         calls->instance_ptr = o;
14994
14995         LDKOffersMessageHandler ret = {
14996                 .this_arg = (void*) calls,
14997                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
14998                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
14999                 .free = LDKOffersMessageHandler_JCalls_free,
15000         };
15001         return ret;
15002 }
15003 uint64_t  CS_LDK_LDKOffersMessageHandler_new(int32_t o) {
15004         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
15005         *res_ptr = LDKOffersMessageHandler_init(o);
15006         return tag_ptr(res_ptr, true);
15007 }
15008 int64_t  CS_LDK_OffersMessageHandler_handle_message(int64_t this_arg, int64_t message) {
15009         void* this_arg_ptr = untag_ptr(this_arg);
15010         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15011         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
15012         void* message_ptr = untag_ptr(message);
15013         CHECK_ACCESS(message_ptr);
15014         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
15015         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
15016         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
15017         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
15018         int64_t ret_ref = tag_ptr(ret_copy, true);
15019         return ret_ref;
15020 }
15021
15022 int64_tArray  CS_LDK_OffersMessageHandler_release_pending_messages(int64_t this_arg) {
15023         void* this_arg_ptr = untag_ptr(this_arg);
15024         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15025         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
15026         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
15027         int64_tArray ret_arr = NULL;
15028         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15029         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15030         for (size_t x = 0; x < ret_var.datalen; x++) {
15031                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
15032                 *ret_conv_49_conv = ret_var.data[x];
15033                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
15034         }
15035         
15036         FREE(ret_var.data);
15037         return ret_arr;
15038 }
15039
15040 typedef struct LDKRoutingMessageHandler_JCalls {
15041         atomic_size_t refcnt;
15042         uint32_t instance_ptr;
15043         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15044 } LDKRoutingMessageHandler_JCalls;
15045 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
15046         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15047         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15048                 FREE(j_calls);
15049         }
15050 }
15051 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
15052         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15053         LDKNodeAnnouncement msg_var = *msg;
15054         int64_t msg_ref = 0;
15055         msg_var = NodeAnnouncement_clone(&msg_var);
15056         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15057         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15058         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 118, msg_ref);
15059         void* ret_ptr = untag_ptr(ret);
15060         CHECK_ACCESS(ret_ptr);
15061         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
15062         FREE(untag_ptr(ret));
15063         return ret_conv;
15064 }
15065 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
15066         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15067         LDKChannelAnnouncement msg_var = *msg;
15068         int64_t msg_ref = 0;
15069         msg_var = ChannelAnnouncement_clone(&msg_var);
15070         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15071         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15072         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 119, msg_ref);
15073         void* ret_ptr = untag_ptr(ret);
15074         CHECK_ACCESS(ret_ptr);
15075         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
15076         FREE(untag_ptr(ret));
15077         return ret_conv;
15078 }
15079 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
15080         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15081         LDKChannelUpdate msg_var = *msg;
15082         int64_t msg_ref = 0;
15083         msg_var = ChannelUpdate_clone(&msg_var);
15084         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15085         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15086         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 120, msg_ref);
15087         void* ret_ptr = untag_ptr(ret);
15088         CHECK_ACCESS(ret_ptr);
15089         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
15090         FREE(untag_ptr(ret));
15091         return ret_conv;
15092 }
15093 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
15094         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15095         int64_t starting_point_conv = starting_point;
15096         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 121, starting_point_conv);
15097         void* ret_ptr = untag_ptr(ret);
15098         CHECK_ACCESS(ret_ptr);
15099         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
15100         FREE(untag_ptr(ret));
15101         return ret_conv;
15102 }
15103 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
15104         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15105         LDKNodeId starting_point_var = starting_point;
15106         int64_t starting_point_ref = 0;
15107         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
15108         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
15109         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 122, starting_point_ref);
15110         LDKNodeAnnouncement ret_conv;
15111         ret_conv.inner = untag_ptr(ret);
15112         ret_conv.is_owned = ptr_is_owned(ret);
15113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15114         return ret_conv;
15115 }
15116 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
15117         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15118         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15119         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15120         LDKInit init_var = *init;
15121         int64_t init_ref = 0;
15122         init_var = Init_clone(&init_var);
15123         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
15124         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
15125         jboolean inbound_conv = inbound;
15126         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 123, (int64_t)their_node_id_arr, init_ref, inbound_conv);
15127         void* ret_ptr = untag_ptr(ret);
15128         CHECK_ACCESS(ret_ptr);
15129         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15130         FREE(untag_ptr(ret));
15131         return ret_conv;
15132 }
15133 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
15134         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15135         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15136         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15137         LDKReplyChannelRange msg_var = msg;
15138         int64_t msg_ref = 0;
15139         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15140         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15141         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 124, (int64_t)their_node_id_arr, msg_ref);
15142         void* ret_ptr = untag_ptr(ret);
15143         CHECK_ACCESS(ret_ptr);
15144         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15145         FREE(untag_ptr(ret));
15146         return ret_conv;
15147 }
15148 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
15149         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15150         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15151         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15152         LDKReplyShortChannelIdsEnd msg_var = msg;
15153         int64_t msg_ref = 0;
15154         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15155         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15156         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 125, (int64_t)their_node_id_arr, msg_ref);
15157         void* ret_ptr = untag_ptr(ret);
15158         CHECK_ACCESS(ret_ptr);
15159         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15160         FREE(untag_ptr(ret));
15161         return ret_conv;
15162 }
15163 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
15164         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15165         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15166         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15167         LDKQueryChannelRange msg_var = msg;
15168         int64_t msg_ref = 0;
15169         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15170         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15171         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 126, (int64_t)their_node_id_arr, msg_ref);
15172         void* ret_ptr = untag_ptr(ret);
15173         CHECK_ACCESS(ret_ptr);
15174         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15175         FREE(untag_ptr(ret));
15176         return ret_conv;
15177 }
15178 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
15179         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15180         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15181         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15182         LDKQueryShortChannelIds msg_var = msg;
15183         int64_t msg_ref = 0;
15184         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15185         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15186         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 127, (int64_t)their_node_id_arr, msg_ref);
15187         void* ret_ptr = untag_ptr(ret);
15188         CHECK_ACCESS(ret_ptr);
15189         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15190         FREE(untag_ptr(ret));
15191         return ret_conv;
15192 }
15193 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
15194         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15195         return js_invoke_function_b_(j_calls->instance_ptr, 128);
15196 }
15197 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
15198         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15199         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 129);
15200         LDKNodeFeatures ret_conv;
15201         ret_conv.inner = untag_ptr(ret);
15202         ret_conv.is_owned = ptr_is_owned(ret);
15203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15204         return ret_conv;
15205 }
15206 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15207         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15208         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15209         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15210         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 130, (int64_t)their_node_id_arr);
15211         LDKInitFeatures ret_conv;
15212         ret_conv.inner = untag_ptr(ret);
15213         ret_conv.is_owned = ptr_is_owned(ret);
15214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15215         return ret_conv;
15216 }
15217 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
15218         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
15219         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15220         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
15221 }
15222 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
15223         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
15224         atomic_init(&calls->refcnt, 1);
15225         calls->instance_ptr = o;
15226
15227         LDKRoutingMessageHandler ret = {
15228                 .this_arg = (void*) calls,
15229                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
15230                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
15231                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
15232                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
15233                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
15234                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
15235                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
15236                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
15237                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
15238                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
15239                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
15240                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
15241                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
15242                 .free = LDKRoutingMessageHandler_JCalls_free,
15243                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15244         };
15245         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15246         return ret;
15247 }
15248 uint64_t  CS_LDK_LDKRoutingMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
15249         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
15250         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
15251         return tag_ptr(res_ptr, true);
15252 }
15253 int64_t  CS_LDK_RoutingMessageHandler_handle_node_announcement(int64_t this_arg, int64_t msg) {
15254         void* this_arg_ptr = untag_ptr(this_arg);
15255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15256         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15257         LDKNodeAnnouncement msg_conv;
15258         msg_conv.inner = untag_ptr(msg);
15259         msg_conv.is_owned = ptr_is_owned(msg);
15260         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15261         msg_conv.is_owned = false;
15262         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15263         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
15264         return tag_ptr(ret_conv, true);
15265 }
15266
15267 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_announcement(int64_t this_arg, int64_t msg) {
15268         void* this_arg_ptr = untag_ptr(this_arg);
15269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15270         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15271         LDKChannelAnnouncement msg_conv;
15272         msg_conv.inner = untag_ptr(msg);
15273         msg_conv.is_owned = ptr_is_owned(msg);
15274         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15275         msg_conv.is_owned = false;
15276         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15277         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
15278         return tag_ptr(ret_conv, true);
15279 }
15280
15281 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_update(int64_t this_arg, int64_t msg) {
15282         void* this_arg_ptr = untag_ptr(this_arg);
15283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15284         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15285         LDKChannelUpdate msg_conv;
15286         msg_conv.inner = untag_ptr(msg);
15287         msg_conv.is_owned = ptr_is_owned(msg);
15288         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15289         msg_conv.is_owned = false;
15290         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15291         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
15292         return tag_ptr(ret_conv, true);
15293 }
15294
15295 int64_t  CS_LDK_RoutingMessageHandler_get_next_channel_announcement(int64_t this_arg, int64_t starting_point) {
15296         void* this_arg_ptr = untag_ptr(this_arg);
15297         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15298         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15299         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15300         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
15301         int64_t ret_ref = tag_ptr(ret_copy, true);
15302         return ret_ref;
15303 }
15304
15305 int64_t  CS_LDK_RoutingMessageHandler_get_next_node_announcement(int64_t this_arg, int64_t starting_point) {
15306         void* this_arg_ptr = untag_ptr(this_arg);
15307         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15308         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15309         LDKNodeId starting_point_conv;
15310         starting_point_conv.inner = untag_ptr(starting_point);
15311         starting_point_conv.is_owned = ptr_is_owned(starting_point);
15312         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
15313         starting_point_conv = NodeId_clone(&starting_point_conv);
15314         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
15315         int64_t ret_ref = 0;
15316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15318         return ret_ref;
15319 }
15320
15321 int64_t  CS_LDK_RoutingMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
15322         void* this_arg_ptr = untag_ptr(this_arg);
15323         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15324         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15325         LDKPublicKey their_node_id_ref;
15326         CHECK(their_node_id->arr_len == 33);
15327         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15328         LDKInit init_conv;
15329         init_conv.inner = untag_ptr(init);
15330         init_conv.is_owned = ptr_is_owned(init);
15331         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15332         init_conv.is_owned = false;
15333         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15334         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15335         return tag_ptr(ret_conv, true);
15336 }
15337
15338 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15339         void* this_arg_ptr = untag_ptr(this_arg);
15340         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15341         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15342         LDKPublicKey their_node_id_ref;
15343         CHECK(their_node_id->arr_len == 33);
15344         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15345         LDKReplyChannelRange msg_conv;
15346         msg_conv.inner = untag_ptr(msg);
15347         msg_conv.is_owned = ptr_is_owned(msg);
15348         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15349         msg_conv = ReplyChannelRange_clone(&msg_conv);
15350         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15351         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15352         return tag_ptr(ret_conv, true);
15353 }
15354
15355 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_short_channel_ids_end(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15356         void* this_arg_ptr = untag_ptr(this_arg);
15357         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15358         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15359         LDKPublicKey their_node_id_ref;
15360         CHECK(their_node_id->arr_len == 33);
15361         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15362         LDKReplyShortChannelIdsEnd msg_conv;
15363         msg_conv.inner = untag_ptr(msg);
15364         msg_conv.is_owned = ptr_is_owned(msg);
15365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15366         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
15367         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15368         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15369         return tag_ptr(ret_conv, true);
15370 }
15371
15372 int64_t  CS_LDK_RoutingMessageHandler_handle_query_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15373         void* this_arg_ptr = untag_ptr(this_arg);
15374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15375         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15376         LDKPublicKey their_node_id_ref;
15377         CHECK(their_node_id->arr_len == 33);
15378         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15379         LDKQueryChannelRange msg_conv;
15380         msg_conv.inner = untag_ptr(msg);
15381         msg_conv.is_owned = ptr_is_owned(msg);
15382         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15383         msg_conv = QueryChannelRange_clone(&msg_conv);
15384         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15385         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15386         return tag_ptr(ret_conv, true);
15387 }
15388
15389 int64_t  CS_LDK_RoutingMessageHandler_handle_query_short_channel_ids(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15390         void* this_arg_ptr = untag_ptr(this_arg);
15391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15392         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15393         LDKPublicKey their_node_id_ref;
15394         CHECK(their_node_id->arr_len == 33);
15395         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15396         LDKQueryShortChannelIds msg_conv;
15397         msg_conv.inner = untag_ptr(msg);
15398         msg_conv.is_owned = ptr_is_owned(msg);
15399         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15400         msg_conv = QueryShortChannelIds_clone(&msg_conv);
15401         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15402         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15403         return tag_ptr(ret_conv, true);
15404 }
15405
15406 jboolean  CS_LDK_RoutingMessageHandler_processing_queue_high(int64_t this_arg) {
15407         void* this_arg_ptr = untag_ptr(this_arg);
15408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15409         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15410         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
15411         return ret_conv;
15412 }
15413
15414 int64_t  CS_LDK_RoutingMessageHandler_provided_node_features(int64_t this_arg) {
15415         void* this_arg_ptr = untag_ptr(this_arg);
15416         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15417         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15418         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15419         int64_t ret_ref = 0;
15420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15422         return ret_ref;
15423 }
15424
15425 int64_t  CS_LDK_RoutingMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
15426         void* this_arg_ptr = untag_ptr(this_arg);
15427         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15428         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15429         LDKPublicKey their_node_id_ref;
15430         CHECK(their_node_id->arr_len == 33);
15431         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15432         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15433         int64_t ret_ref = 0;
15434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15436         return ret_ref;
15437 }
15438
15439 typedef struct LDKOnionMessageHandler_JCalls {
15440         atomic_size_t refcnt;
15441         uint32_t instance_ptr;
15442 } LDKOnionMessageHandler_JCalls;
15443 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
15444         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15445         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15446                 FREE(j_calls);
15447         }
15448 }
15449 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
15450         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15451         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 131);
15452         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
15453         ret_constr.datalen = ret->arr_len;
15454         if (ret_constr.datalen > 0)
15455                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
15456         else
15457                 ret_constr.data = NULL;
15458         int64_t* ret_vals = ret->elems;
15459         for (size_t o = 0; o < ret_constr.datalen; o++) {
15460                 int64_t ret_conv_40 = ret_vals[o];
15461                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
15462                 CHECK_ACCESS(ret_conv_40_ptr);
15463                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
15464                 FREE(untag_ptr(ret_conv_40));
15465                 ret_constr.data[o] = ret_conv_40_conv;
15466         }
15467         FREE(ret);
15468         return ret_constr;
15469 }
15470 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
15471         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15472         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15473         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15474         LDKOnionMessage msg_var = *msg;
15475         int64_t msg_ref = 0;
15476         msg_var = OnionMessage_clone(&msg_var);
15477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15478         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15479         js_invoke_function_void_ll(j_calls->instance_ptr, 132, (int64_t)peer_node_id_arr, msg_ref);
15480 }
15481 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
15482         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15483         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15484         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15485         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 133, (int64_t)peer_node_id_arr);
15486         LDKOnionMessage ret_conv;
15487         ret_conv.inner = untag_ptr(ret);
15488         ret_conv.is_owned = ptr_is_owned(ret);
15489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15490         return ret_conv;
15491 }
15492 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
15493         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15494         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15495         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15496         LDKInit init_var = *init;
15497         int64_t init_ref = 0;
15498         init_var = Init_clone(&init_var);
15499         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
15500         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
15501         jboolean inbound_conv = inbound;
15502         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 134, (int64_t)their_node_id_arr, init_ref, inbound_conv);
15503         void* ret_ptr = untag_ptr(ret);
15504         CHECK_ACCESS(ret_ptr);
15505         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15506         FREE(untag_ptr(ret));
15507         return ret_conv;
15508 }
15509 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15510         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15511         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15512         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15513         js_invoke_function_void_l(j_calls->instance_ptr, 135, (int64_t)their_node_id_arr);
15514 }
15515 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
15516         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15517         js_invoke_function_void_(j_calls->instance_ptr, 136);
15518 }
15519 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
15520         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15521         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 137);
15522         LDKNodeFeatures ret_conv;
15523         ret_conv.inner = untag_ptr(ret);
15524         ret_conv.is_owned = ptr_is_owned(ret);
15525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15526         return ret_conv;
15527 }
15528 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15529         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15530         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15531         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15532         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 138, (int64_t)their_node_id_arr);
15533         LDKInitFeatures ret_conv;
15534         ret_conv.inner = untag_ptr(ret);
15535         ret_conv.is_owned = ptr_is_owned(ret);
15536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15537         return ret_conv;
15538 }
15539 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
15540         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
15541         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15542 }
15543 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (int64_t o) {
15544         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
15545         atomic_init(&calls->refcnt, 1);
15546         calls->instance_ptr = o;
15547
15548         LDKOnionMessageHandler ret = {
15549                 .this_arg = (void*) calls,
15550                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
15551                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
15552                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
15553                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
15554                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
15555                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
15556                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
15557                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
15558                 .free = LDKOnionMessageHandler_JCalls_free,
15559         };
15560         return ret;
15561 }
15562 uint64_t  CS_LDK_LDKOnionMessageHandler_new(int32_t o) {
15563         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
15564         *res_ptr = LDKOnionMessageHandler_init(o);
15565         return tag_ptr(res_ptr, true);
15566 }
15567 int64_tArray  CS_LDK_OnionMessageHandler_get_and_clear_connections_needed(int64_t this_arg) {
15568         void* this_arg_ptr = untag_ptr(this_arg);
15569         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15570         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15571         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
15572         int64_tArray ret_arr = NULL;
15573         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15574         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15575         for (size_t o = 0; o < ret_var.datalen; o++) {
15576                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
15577                 *ret_conv_40_conv = ret_var.data[o];
15578                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
15579         }
15580         
15581         FREE(ret_var.data);
15582         return ret_arr;
15583 }
15584
15585 void  CS_LDK_OnionMessageHandler_handle_onion_message(int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
15586         void* this_arg_ptr = untag_ptr(this_arg);
15587         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15588         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15589         LDKPublicKey peer_node_id_ref;
15590         CHECK(peer_node_id->arr_len == 33);
15591         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15592         LDKOnionMessage msg_conv;
15593         msg_conv.inner = untag_ptr(msg);
15594         msg_conv.is_owned = ptr_is_owned(msg);
15595         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15596         msg_conv.is_owned = false;
15597         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
15598 }
15599
15600 int64_t  CS_LDK_OnionMessageHandler_next_onion_message_for_peer(int64_t this_arg, int8_tArray peer_node_id) {
15601         void* this_arg_ptr = untag_ptr(this_arg);
15602         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15603         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15604         LDKPublicKey peer_node_id_ref;
15605         CHECK(peer_node_id->arr_len == 33);
15606         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15607         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
15608         int64_t ret_ref = 0;
15609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15611         return ret_ref;
15612 }
15613
15614 int64_t  CS_LDK_OnionMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
15615         void* this_arg_ptr = untag_ptr(this_arg);
15616         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15617         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15618         LDKPublicKey their_node_id_ref;
15619         CHECK(their_node_id->arr_len == 33);
15620         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15621         LDKInit init_conv;
15622         init_conv.inner = untag_ptr(init);
15623         init_conv.is_owned = ptr_is_owned(init);
15624         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15625         init_conv.is_owned = false;
15626         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15627         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15628         return tag_ptr(ret_conv, true);
15629 }
15630
15631 void  CS_LDK_OnionMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
15632         void* this_arg_ptr = untag_ptr(this_arg);
15633         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15634         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15635         LDKPublicKey their_node_id_ref;
15636         CHECK(their_node_id->arr_len == 33);
15637         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15638         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
15639 }
15640
15641 void  CS_LDK_OnionMessageHandler_timer_tick_occurred(int64_t this_arg) {
15642         void* this_arg_ptr = untag_ptr(this_arg);
15643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15644         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15645         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
15646 }
15647
15648 int64_t  CS_LDK_OnionMessageHandler_provided_node_features(int64_t this_arg) {
15649         void* this_arg_ptr = untag_ptr(this_arg);
15650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15651         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15652         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15653         int64_t ret_ref = 0;
15654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15656         return ret_ref;
15657 }
15658
15659 int64_t  CS_LDK_OnionMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
15660         void* this_arg_ptr = untag_ptr(this_arg);
15661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15662         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15663         LDKPublicKey their_node_id_ref;
15664         CHECK(their_node_id->arr_len == 33);
15665         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15666         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15667         int64_t ret_ref = 0;
15668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15670         return ret_ref;
15671 }
15672
15673 typedef struct LDKCustomMessageReader_JCalls {
15674         atomic_size_t refcnt;
15675         uint32_t instance_ptr;
15676 } LDKCustomMessageReader_JCalls;
15677 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
15678         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15679         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15680                 FREE(j_calls);
15681         }
15682 }
15683 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
15684         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15685         int16_t message_type_conv = message_type;
15686         LDKu8slice buffer_var = buffer;
15687         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15688         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15689         uint64_t ret = js_invoke_function_l_sl(j_calls->instance_ptr, 139, message_type_conv, (int64_t)buffer_arr);
15690         void* ret_ptr = untag_ptr(ret);
15691         CHECK_ACCESS(ret_ptr);
15692         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
15693         FREE(untag_ptr(ret));
15694         return ret_conv;
15695 }
15696 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
15697         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
15698         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15699 }
15700 static inline LDKCustomMessageReader LDKCustomMessageReader_init (int64_t o) {
15701         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
15702         atomic_init(&calls->refcnt, 1);
15703         calls->instance_ptr = o;
15704
15705         LDKCustomMessageReader ret = {
15706                 .this_arg = (void*) calls,
15707                 .read = read_LDKCustomMessageReader_jcall,
15708                 .free = LDKCustomMessageReader_JCalls_free,
15709         };
15710         return ret;
15711 }
15712 uint64_t  CS_LDK_LDKCustomMessageReader_new(int32_t o) {
15713         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
15714         *res_ptr = LDKCustomMessageReader_init(o);
15715         return tag_ptr(res_ptr, true);
15716 }
15717 int64_t  CS_LDK_CustomMessageReader_read(int64_t this_arg, int16_t message_type, int8_tArray buffer) {
15718         void* this_arg_ptr = untag_ptr(this_arg);
15719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15720         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
15721         LDKu8slice buffer_ref;
15722         buffer_ref.datalen = buffer->arr_len;
15723         buffer_ref.data = buffer->elems;
15724         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15725         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
15726         FREE(buffer);
15727         return tag_ptr(ret_conv, true);
15728 }
15729
15730 typedef struct LDKCustomMessageHandler_JCalls {
15731         atomic_size_t refcnt;
15732         uint32_t instance_ptr;
15733         LDKCustomMessageReader_JCalls* CustomMessageReader;
15734 } LDKCustomMessageHandler_JCalls;
15735 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
15736         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15737         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15738                 FREE(j_calls);
15739         }
15740 }
15741 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
15742         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15743         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
15744         *msg_ret = msg;
15745         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
15746         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
15747         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 140, tag_ptr(msg_ret, true), (int64_t)sender_node_id_arr);
15748         void* ret_ptr = untag_ptr(ret);
15749         CHECK_ACCESS(ret_ptr);
15750         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15751         FREE(untag_ptr(ret));
15752         return ret_conv;
15753 }
15754 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
15755         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15756         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 141);
15757         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
15758         ret_constr.datalen = ret->arr_len;
15759         if (ret_constr.datalen > 0)
15760                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
15761         else
15762                 ret_constr.data = NULL;
15763         int64_t* ret_vals = ret->elems;
15764         for (size_t z = 0; z < ret_constr.datalen; z++) {
15765                 int64_t ret_conv_25 = ret_vals[z];
15766                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
15767                 CHECK_ACCESS(ret_conv_25_ptr);
15768                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
15769                 FREE(untag_ptr(ret_conv_25));
15770                 ret_constr.data[z] = ret_conv_25_conv;
15771         }
15772         FREE(ret);
15773         return ret_constr;
15774 }
15775 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
15776         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15777         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 142);
15778         LDKNodeFeatures ret_conv;
15779         ret_conv.inner = untag_ptr(ret);
15780         ret_conv.is_owned = ptr_is_owned(ret);
15781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15782         return ret_conv;
15783 }
15784 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15785         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15786         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15787         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15788         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 143, (int64_t)their_node_id_arr);
15789         LDKInitFeatures ret_conv;
15790         ret_conv.inner = untag_ptr(ret);
15791         ret_conv.is_owned = ptr_is_owned(ret);
15792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15793         return ret_conv;
15794 }
15795 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
15796         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
15797         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15798         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
15799 }
15800 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (int64_t o, int64_t CustomMessageReader) {
15801         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
15802         atomic_init(&calls->refcnt, 1);
15803         calls->instance_ptr = o;
15804
15805         LDKCustomMessageHandler ret = {
15806                 .this_arg = (void*) calls,
15807                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
15808                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
15809                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
15810                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
15811                 .free = LDKCustomMessageHandler_JCalls_free,
15812                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
15813         };
15814         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
15815         return ret;
15816 }
15817 uint64_t  CS_LDK_LDKCustomMessageHandler_new(int32_t o, int32_t CustomMessageReader) {
15818         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
15819         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
15820         return tag_ptr(res_ptr, true);
15821 }
15822 int64_t  CS_LDK_CustomMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
15823         void* this_arg_ptr = untag_ptr(this_arg);
15824         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15825         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15826         void* msg_ptr = untag_ptr(msg);
15827         CHECK_ACCESS(msg_ptr);
15828         LDKType msg_conv = *(LDKType*)(msg_ptr);
15829         if (msg_conv.free == LDKType_JCalls_free) {
15830                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15831                 LDKType_JCalls_cloned(&msg_conv);
15832         }
15833         LDKPublicKey sender_node_id_ref;
15834         CHECK(sender_node_id->arr_len == 33);
15835         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
15836         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15837         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
15838         return tag_ptr(ret_conv, true);
15839 }
15840
15841 int64_tArray  CS_LDK_CustomMessageHandler_get_and_clear_pending_msg(int64_t this_arg) {
15842         void* this_arg_ptr = untag_ptr(this_arg);
15843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15844         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15845         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
15846         int64_tArray ret_arr = NULL;
15847         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15848         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15849         for (size_t z = 0; z < ret_var.datalen; z++) {
15850                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
15851                 *ret_conv_25_conv = ret_var.data[z];
15852                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
15853         }
15854         
15855         FREE(ret_var.data);
15856         return ret_arr;
15857 }
15858
15859 int64_t  CS_LDK_CustomMessageHandler_provided_node_features(int64_t this_arg) {
15860         void* this_arg_ptr = untag_ptr(this_arg);
15861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15862         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15863         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15864         int64_t ret_ref = 0;
15865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15867         return ret_ref;
15868 }
15869
15870 int64_t  CS_LDK_CustomMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
15871         void* this_arg_ptr = untag_ptr(this_arg);
15872         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15873         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15874         LDKPublicKey their_node_id_ref;
15875         CHECK(their_node_id->arr_len == 33);
15876         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15877         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15878         int64_t ret_ref = 0;
15879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15881         return ret_ref;
15882 }
15883
15884 typedef struct LDKCustomOnionMessageHandler_JCalls {
15885         atomic_size_t refcnt;
15886         uint32_t instance_ptr;
15887 } LDKCustomOnionMessageHandler_JCalls;
15888 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
15889         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15890         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15891                 FREE(j_calls);
15892         }
15893 }
15894 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
15895         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15896         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
15897         *msg_ret = msg;
15898         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 144, tag_ptr(msg_ret, true));
15899         void* ret_ptr = untag_ptr(ret);
15900         CHECK_ACCESS(ret_ptr);
15901         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
15902         FREE(untag_ptr(ret));
15903         return ret_conv;
15904 }
15905 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
15906         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15907         int64_t message_type_conv = message_type;
15908         LDKu8slice buffer_var = buffer;
15909         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15910         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15911         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 145, message_type_conv, (int64_t)buffer_arr);
15912         void* ret_ptr = untag_ptr(ret);
15913         CHECK_ACCESS(ret_ptr);
15914         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
15915         FREE(untag_ptr(ret));
15916         return ret_conv;
15917 }
15918 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
15919         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15920         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 146);
15921         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
15922         ret_constr.datalen = ret->arr_len;
15923         if (ret_constr.datalen > 0)
15924                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
15925         else
15926                 ret_constr.data = NULL;
15927         int64_t* ret_vals = ret->elems;
15928         for (size_t e = 0; e < ret_constr.datalen; e++) {
15929                 int64_t ret_conv_56 = ret_vals[e];
15930                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
15931                 CHECK_ACCESS(ret_conv_56_ptr);
15932                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
15933                 FREE(untag_ptr(ret_conv_56));
15934                 ret_constr.data[e] = ret_conv_56_conv;
15935         }
15936         FREE(ret);
15937         return ret_constr;
15938 }
15939 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
15940         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
15941         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15942 }
15943 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (int64_t o) {
15944         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
15945         atomic_init(&calls->refcnt, 1);
15946         calls->instance_ptr = o;
15947
15948         LDKCustomOnionMessageHandler ret = {
15949                 .this_arg = (void*) calls,
15950                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
15951                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
15952                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
15953                 .free = LDKCustomOnionMessageHandler_JCalls_free,
15954         };
15955         return ret;
15956 }
15957 uint64_t  CS_LDK_LDKCustomOnionMessageHandler_new(int32_t o) {
15958         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
15959         *res_ptr = LDKCustomOnionMessageHandler_init(o);
15960         return tag_ptr(res_ptr, true);
15961 }
15962 int64_t  CS_LDK_CustomOnionMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg) {
15963         void* this_arg_ptr = untag_ptr(this_arg);
15964         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15965         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15966         void* msg_ptr = untag_ptr(msg);
15967         CHECK_ACCESS(msg_ptr);
15968         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
15969         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
15970                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15971                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
15972         }
15973         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
15974         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
15975         int64_t ret_ref = tag_ptr(ret_copy, true);
15976         return ret_ref;
15977 }
15978
15979 int64_t  CS_LDK_CustomOnionMessageHandler_read_custom_message(int64_t this_arg, int64_t message_type, int8_tArray buffer) {
15980         void* this_arg_ptr = untag_ptr(this_arg);
15981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15982         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15983         LDKu8slice buffer_ref;
15984         buffer_ref.datalen = buffer->arr_len;
15985         buffer_ref.data = buffer->elems;
15986         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
15987         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
15988         FREE(buffer);
15989         return tag_ptr(ret_conv, true);
15990 }
15991
15992 int64_tArray  CS_LDK_CustomOnionMessageHandler_release_pending_custom_messages(int64_t this_arg) {
15993         void* this_arg_ptr = untag_ptr(this_arg);
15994         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15995         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15996         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
15997         int64_tArray ret_arr = NULL;
15998         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15999         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
16000         for (size_t e = 0; e < ret_var.datalen; e++) {
16001                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
16002                 *ret_conv_56_conv = ret_var.data[e];
16003                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
16004         }
16005         
16006         FREE(ret_var.data);
16007         return ret_arr;
16008 }
16009
16010 typedef struct LDKSocketDescriptor_JCalls {
16011         atomic_size_t refcnt;
16012         uint32_t instance_ptr;
16013 } LDKSocketDescriptor_JCalls;
16014 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
16015         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16016         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16017                 FREE(j_calls);
16018         }
16019 }
16020 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
16021         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16022         LDKu8slice data_var = data;
16023         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
16024         memcpy(data_arr->elems, data_var.data, data_var.datalen);
16025         jboolean resume_read_conv = resume_read;
16026         return js_invoke_function_l_lb(j_calls->instance_ptr, 147, (int64_t)data_arr, resume_read_conv);
16027 }
16028 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
16029         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16030         js_invoke_function_void_(j_calls->instance_ptr, 148);
16031 }
16032 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
16033         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16034         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16035         *other_arg_clone = SocketDescriptor_clone(other_arg);
16036         return js_invoke_function_b_l(j_calls->instance_ptr, 149, tag_ptr(other_arg_clone, true));
16037 }
16038 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
16039         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16040         return js_invoke_function_l_(j_calls->instance_ptr, 150);
16041 }
16042 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
16043         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
16044         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16045 }
16046 static inline LDKSocketDescriptor LDKSocketDescriptor_init (int64_t o) {
16047         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
16048         atomic_init(&calls->refcnt, 1);
16049         calls->instance_ptr = o;
16050
16051         LDKSocketDescriptor ret = {
16052                 .this_arg = (void*) calls,
16053                 .send_data = send_data_LDKSocketDescriptor_jcall,
16054                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
16055                 .eq = eq_LDKSocketDescriptor_jcall,
16056                 .hash = hash_LDKSocketDescriptor_jcall,
16057                 .cloned = LDKSocketDescriptor_JCalls_cloned,
16058                 .free = LDKSocketDescriptor_JCalls_free,
16059         };
16060         return ret;
16061 }
16062 uint64_t  CS_LDK_LDKSocketDescriptor_new(int32_t o) {
16063         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16064         *res_ptr = LDKSocketDescriptor_init(o);
16065         return tag_ptr(res_ptr, true);
16066 }
16067 int64_t  CS_LDK_SocketDescriptor_send_data(int64_t this_arg, int8_tArray data, jboolean resume_read) {
16068         void* this_arg_ptr = untag_ptr(this_arg);
16069         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16070         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
16071         LDKu8slice data_ref;
16072         data_ref.datalen = data->arr_len;
16073         data_ref.data = data->elems;
16074         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
16075         FREE(data);
16076         return ret_conv;
16077 }
16078
16079 void  CS_LDK_SocketDescriptor_disconnect_socket(int64_t this_arg) {
16080         void* this_arg_ptr = untag_ptr(this_arg);
16081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16082         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
16083         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
16084 }
16085
16086 int64_t  CS_LDK_SocketDescriptor_hash(int64_t this_arg) {
16087         void* this_arg_ptr = untag_ptr(this_arg);
16088         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16089         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
16090         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
16091         return ret_conv;
16092 }
16093
16094 uint32_t CS_LDK_LDKEffectiveCapacity_ty_from_ptr(int64_t ptr) {
16095         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16096         switch(obj->tag) {
16097                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
16098                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
16099                 case LDKEffectiveCapacity_Total: return 2;
16100                 case LDKEffectiveCapacity_Infinite: return 3;
16101                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
16102                 case LDKEffectiveCapacity_Unknown: return 5;
16103                 default: abort();
16104         }
16105 }
16106 int64_t CS_LDK_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(int64_t ptr) {
16107         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16108         CHECK(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
16109         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
16110         return liquidity_msat_conv;
16111 }
16112 int64_t CS_LDK_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(int64_t ptr) {
16113         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16114         CHECK(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
16115         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
16116         return amount_msat_conv;
16117 }
16118 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_capacity_msat(int64_t ptr) {
16119         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16120         CHECK(obj->tag == LDKEffectiveCapacity_Total);
16121         int64_t capacity_msat_conv = obj->total.capacity_msat;
16122         return capacity_msat_conv;
16123 }
16124 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(int64_t ptr) {
16125         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16126         CHECK(obj->tag == LDKEffectiveCapacity_Total);
16127         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
16128         return htlc_maximum_msat_conv;
16129 }
16130 int64_t CS_LDK_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(int64_t ptr) {
16131         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16132         CHECK(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
16133         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
16134         return amount_msat_conv;
16135 }
16136 uint32_t CS_LDK_LDKPayee_ty_from_ptr(int64_t ptr) {
16137         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16138         switch(obj->tag) {
16139                 case LDKPayee_Blinded: return 0;
16140                 case LDKPayee_Clear: return 1;
16141                 default: abort();
16142         }
16143 }
16144 int64_tArray CS_LDK_LDKPayee_Blinded_get_route_hints(int64_t ptr) {
16145         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16146         CHECK(obj->tag == LDKPayee_Blinded);
16147         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
16148                         int64_tArray route_hints_arr = NULL;
16149                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
16150                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
16151                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
16152                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
16153                                 *route_hints_conv_37_conv = route_hints_var.data[l];
16154                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
16155                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
16156                         }
16157                         
16158         return route_hints_arr;
16159 }
16160 int64_t CS_LDK_LDKPayee_Blinded_get_features(int64_t ptr) {
16161         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16162         CHECK(obj->tag == LDKPayee_Blinded);
16163         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
16164                         int64_t features_ref = 0;
16165                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
16166                         features_ref = tag_ptr(features_var.inner, false);
16167         return features_ref;
16168 }
16169 int8_tArray CS_LDK_LDKPayee_Clear_get_node_id(int64_t ptr) {
16170         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16171         CHECK(obj->tag == LDKPayee_Clear);
16172         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
16173         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
16174         return node_id_arr;
16175 }
16176 int64_tArray CS_LDK_LDKPayee_Clear_get_route_hints(int64_t ptr) {
16177         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16178         CHECK(obj->tag == LDKPayee_Clear);
16179         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
16180                         int64_tArray route_hints_arr = NULL;
16181                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
16182                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
16183                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
16184                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
16185                                 int64_t route_hints_conv_11_ref = 0;
16186                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
16187                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
16188                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
16189                         }
16190                         
16191         return route_hints_arr;
16192 }
16193 int64_t CS_LDK_LDKPayee_Clear_get_features(int64_t ptr) {
16194         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16195         CHECK(obj->tag == LDKPayee_Clear);
16196         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
16197                         int64_t features_ref = 0;
16198                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
16199                         features_ref = tag_ptr(features_var.inner, false);
16200         return features_ref;
16201 }
16202 int32_t CS_LDK_LDKPayee_Clear_get_final_cltv_expiry_delta(int64_t ptr) {
16203         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16204         CHECK(obj->tag == LDKPayee_Clear);
16205         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
16206         return final_cltv_expiry_delta_conv;
16207 }
16208 typedef struct LDKScore_JCalls {
16209         atomic_size_t refcnt;
16210         uint32_t instance_ptr;
16211         LDKScoreLookUp_JCalls* ScoreLookUp;
16212         LDKScoreUpdate_JCalls* ScoreUpdate;
16213 } LDKScore_JCalls;
16214 static void LDKScore_JCalls_free(void* this_arg) {
16215         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
16216         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16217                 FREE(j_calls);
16218         }
16219 }
16220 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
16221         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
16222         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 151);
16223         LDKCVec_u8Z ret_ref;
16224         ret_ref.datalen = ret->arr_len;
16225         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
16226         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
16227         return ret_ref;
16228 }
16229 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
16230         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
16231         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16232         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
16233         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
16234 }
16235 static inline LDKScore LDKScore_init (int64_t o, int64_t ScoreLookUp, int64_t ScoreUpdate) {
16236         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
16237         atomic_init(&calls->refcnt, 1);
16238         calls->instance_ptr = o;
16239
16240         LDKScore ret = {
16241                 .this_arg = (void*) calls,
16242                 .write = write_LDKScore_jcall,
16243                 .free = LDKScore_JCalls_free,
16244                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
16245                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
16246         };
16247         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
16248         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
16249         return ret;
16250 }
16251 uint64_t  CS_LDK_LDKScore_new(int32_t o, int32_t ScoreLookUp, int32_t ScoreUpdate) {
16252         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
16253         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
16254         return tag_ptr(res_ptr, true);
16255 }
16256 int8_tArray  CS_LDK_Score_write(int64_t this_arg) {
16257         void* this_arg_ptr = untag_ptr(this_arg);
16258         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16259         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
16260         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
16261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16263         CVec_u8Z_free(ret_var);
16264         return ret_arr;
16265 }
16266
16267 typedef struct LDKCoinSelectionSource_JCalls {
16268         atomic_size_t refcnt;
16269         uint32_t instance_ptr;
16270 } LDKCoinSelectionSource_JCalls;
16271 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
16272         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16273         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16274                 FREE(j_calls);
16275         }
16276 }
16277 LDKCResult_CoinSelectionNoneZ select_confirmed_utxos_LDKCoinSelectionSource_jcall(const void* this_arg, LDKThirtyTwoBytes claim_id, LDKCVec_InputZ must_spend, LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight) {
16278         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16279         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
16280         memcpy(claim_id_arr->elems, claim_id.data, 32);
16281         LDKCVec_InputZ must_spend_var = must_spend;
16282         int64_tArray must_spend_arr = NULL;
16283         must_spend_arr = init_int64_tArray(must_spend_var.datalen, __LINE__);
16284         int64_t *must_spend_arr_ptr = (int64_t*)(((uint8_t*)must_spend_arr) + 8);
16285         for (size_t h = 0; h < must_spend_var.datalen; h++) {
16286                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
16287                 int64_t must_spend_conv_7_ref = 0;
16288                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
16289                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
16290                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
16291         }
16292         
16293         FREE(must_spend_var.data);
16294         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
16295         int64_tArray must_pay_to_arr = NULL;
16296         must_pay_to_arr = init_int64_tArray(must_pay_to_var.datalen, __LINE__);
16297         int64_t *must_pay_to_arr_ptr = (int64_t*)(((uint8_t*)must_pay_to_arr) + 8);
16298         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
16299                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16300                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
16301                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
16302         }
16303         
16304         FREE(must_pay_to_var.data);
16305         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
16306         uint64_t ret = js_invoke_function_l_llli(j_calls->instance_ptr, 152, (int64_t)claim_id_arr, (int64_t)must_spend_arr, (int64_t)must_pay_to_arr, target_feerate_sat_per_1000_weight_conv);
16307         void* ret_ptr = untag_ptr(ret);
16308         CHECK_ACCESS(ret_ptr);
16309         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
16310         FREE(untag_ptr(ret));
16311         return ret_conv;
16312 }
16313 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16314         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16315         LDKCVec_u8Z psbt_var = psbt;
16316         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16317         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16318         CVec_u8Z_free(psbt_var);
16319         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 153, (int64_t)psbt_arr);
16320         void* ret_ptr = untag_ptr(ret);
16321         CHECK_ACCESS(ret_ptr);
16322         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16323         FREE(untag_ptr(ret));
16324         return ret_conv;
16325 }
16326 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
16327         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
16328         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16329 }
16330 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (int64_t o) {
16331         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
16332         atomic_init(&calls->refcnt, 1);
16333         calls->instance_ptr = o;
16334
16335         LDKCoinSelectionSource ret = {
16336                 .this_arg = (void*) calls,
16337                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
16338                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
16339                 .free = LDKCoinSelectionSource_JCalls_free,
16340         };
16341         return ret;
16342 }
16343 uint64_t  CS_LDK_LDKCoinSelectionSource_new(int32_t o) {
16344         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
16345         *res_ptr = LDKCoinSelectionSource_init(o);
16346         return tag_ptr(res_ptr, true);
16347 }
16348 int64_t  CS_LDK_CoinSelectionSource_select_confirmed_utxos(int64_t this_arg, int8_tArray claim_id, int64_tArray must_spend, int64_tArray must_pay_to, int32_t target_feerate_sat_per_1000_weight) {
16349         void* this_arg_ptr = untag_ptr(this_arg);
16350         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16351         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16352         LDKThirtyTwoBytes claim_id_ref;
16353         CHECK(claim_id->arr_len == 32);
16354         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
16355         LDKCVec_InputZ must_spend_constr;
16356         must_spend_constr.datalen = must_spend->arr_len;
16357         if (must_spend_constr.datalen > 0)
16358                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
16359         else
16360                 must_spend_constr.data = NULL;
16361         int64_t* must_spend_vals = must_spend->elems;
16362         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
16363                 int64_t must_spend_conv_7 = must_spend_vals[h];
16364                 LDKInput must_spend_conv_7_conv;
16365                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
16366                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
16367                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
16368                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
16369                 must_spend_constr.data[h] = must_spend_conv_7_conv;
16370         }
16371         FREE(must_spend);
16372         LDKCVec_TxOutZ must_pay_to_constr;
16373         must_pay_to_constr.datalen = must_pay_to->arr_len;
16374         if (must_pay_to_constr.datalen > 0)
16375                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16376         else
16377                 must_pay_to_constr.data = NULL;
16378         int64_t* must_pay_to_vals = must_pay_to->elems;
16379         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
16380                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
16381                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
16382                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
16383                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
16384                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
16385                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
16386         }
16387         FREE(must_pay_to);
16388         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
16389         *ret_conv = (this_arg_conv->select_confirmed_utxos)(this_arg_conv->this_arg, claim_id_ref, must_spend_constr, must_pay_to_constr, target_feerate_sat_per_1000_weight);
16390         return tag_ptr(ret_conv, true);
16391 }
16392
16393 int64_t  CS_LDK_CoinSelectionSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
16394         void* this_arg_ptr = untag_ptr(this_arg);
16395         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16396         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16397         LDKCVec_u8Z psbt_ref;
16398         psbt_ref.datalen = psbt->arr_len;
16399         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16400         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16401         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16402         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16403         return tag_ptr(ret_conv, true);
16404 }
16405
16406 typedef struct LDKWalletSource_JCalls {
16407         atomic_size_t refcnt;
16408         uint32_t instance_ptr;
16409 } LDKWalletSource_JCalls;
16410 static void LDKWalletSource_JCalls_free(void* this_arg) {
16411         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16412         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16413                 FREE(j_calls);
16414         }
16415 }
16416 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
16417         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16418         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 154);
16419         void* ret_ptr = untag_ptr(ret);
16420         CHECK_ACCESS(ret_ptr);
16421         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
16422         FREE(untag_ptr(ret));
16423         return ret_conv;
16424 }
16425 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
16426         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16427         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 155);
16428         void* ret_ptr = untag_ptr(ret);
16429         CHECK_ACCESS(ret_ptr);
16430         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
16431         FREE(untag_ptr(ret));
16432         return ret_conv;
16433 }
16434 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16435         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16436         LDKCVec_u8Z psbt_var = psbt;
16437         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16438         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16439         CVec_u8Z_free(psbt_var);
16440         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 156, (int64_t)psbt_arr);
16441         void* ret_ptr = untag_ptr(ret);
16442         CHECK_ACCESS(ret_ptr);
16443         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16444         FREE(untag_ptr(ret));
16445         return ret_conv;
16446 }
16447 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
16448         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
16449         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16450 }
16451 static inline LDKWalletSource LDKWalletSource_init (int64_t o) {
16452         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
16453         atomic_init(&calls->refcnt, 1);
16454         calls->instance_ptr = o;
16455
16456         LDKWalletSource ret = {
16457                 .this_arg = (void*) calls,
16458                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
16459                 .get_change_script = get_change_script_LDKWalletSource_jcall,
16460                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
16461                 .free = LDKWalletSource_JCalls_free,
16462         };
16463         return ret;
16464 }
16465 uint64_t  CS_LDK_LDKWalletSource_new(int32_t o) {
16466         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
16467         *res_ptr = LDKWalletSource_init(o);
16468         return tag_ptr(res_ptr, true);
16469 }
16470 int64_t  CS_LDK_WalletSource_list_confirmed_utxos(int64_t this_arg) {
16471         void* this_arg_ptr = untag_ptr(this_arg);
16472         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16473         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16474         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
16475         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
16476         return tag_ptr(ret_conv, true);
16477 }
16478
16479 int64_t  CS_LDK_WalletSource_get_change_script(int64_t this_arg) {
16480         void* this_arg_ptr = untag_ptr(this_arg);
16481         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16482         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16483         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16484         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
16485         return tag_ptr(ret_conv, true);
16486 }
16487
16488 int64_t  CS_LDK_WalletSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
16489         void* this_arg_ptr = untag_ptr(this_arg);
16490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16491         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16492         LDKCVec_u8Z psbt_ref;
16493         psbt_ref.datalen = psbt->arr_len;
16494         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16495         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16496         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16497         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16498         return tag_ptr(ret_conv, true);
16499 }
16500
16501 uint32_t CS_LDK_LDKGossipSync_ty_from_ptr(int64_t ptr) {
16502         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16503         switch(obj->tag) {
16504                 case LDKGossipSync_P2P: return 0;
16505                 case LDKGossipSync_Rapid: return 1;
16506                 case LDKGossipSync_None: return 2;
16507                 default: abort();
16508         }
16509 }
16510 int64_t CS_LDK_LDKGossipSync_P2P_get_p2p(int64_t ptr) {
16511         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16512         CHECK(obj->tag == LDKGossipSync_P2P);
16513         LDKP2PGossipSync p2p_var = obj->p2p;
16514                         int64_t p2p_ref = 0;
16515                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
16516                         p2p_ref = tag_ptr(p2p_var.inner, false);
16517         return p2p_ref;
16518 }
16519 int64_t CS_LDK_LDKGossipSync_Rapid_get_rapid(int64_t ptr) {
16520         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16521         CHECK(obj->tag == LDKGossipSync_Rapid);
16522         LDKRapidGossipSync rapid_var = obj->rapid;
16523                         int64_t rapid_ref = 0;
16524                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
16525                         rapid_ref = tag_ptr(rapid_var.inner, false);
16526         return rapid_ref;
16527 }
16528 uint32_t CS_LDK_LDKFallback_ty_from_ptr(int64_t ptr) {
16529         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16530         switch(obj->tag) {
16531                 case LDKFallback_SegWitProgram: return 0;
16532                 case LDKFallback_PubKeyHash: return 1;
16533                 case LDKFallback_ScriptHash: return 2;
16534                 default: abort();
16535         }
16536 }
16537 int8_t CS_LDK_LDKFallback_SegWitProgram_get_version(int64_t ptr) {
16538         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16539         CHECK(obj->tag == LDKFallback_SegWitProgram);
16540         uint8_t version_val = obj->seg_wit_program.version._0;
16541         return version_val;
16542 }
16543 int8_tArray CS_LDK_LDKFallback_SegWitProgram_get_program(int64_t ptr) {
16544         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16545         CHECK(obj->tag == LDKFallback_SegWitProgram);
16546         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
16547                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
16548                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
16549         return program_arr;
16550 }
16551 int8_tArray CS_LDK_LDKFallback_PubKeyHash_get_pub_key_hash(int64_t ptr) {
16552         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16553         CHECK(obj->tag == LDKFallback_PubKeyHash);
16554         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
16555         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
16556         return pub_key_hash_arr;
16557 }
16558 int8_tArray CS_LDK_LDKFallback_ScriptHash_get_script_hash(int64_t ptr) {
16559         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16560         CHECK(obj->tag == LDKFallback_ScriptHash);
16561         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
16562         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
16563         return script_hash_arr;
16564 }
16565 jstring  CS_LDK__ldk_get_compiled_version() {
16566         LDKStr ret_str = _ldk_get_compiled_version();
16567         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
16568         Str_free(ret_str);
16569         return ret_conv;
16570 }
16571
16572 jstring  CS_LDK__ldk_c_bindings_get_compiled_version() {
16573         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
16574         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
16575         Str_free(ret_str);
16576         return ret_conv;
16577 }
16578
16579 int8_tArray  CS_LDK_U128_le_bytes(int8_tArray val) {
16580         LDKU128 val_ref;
16581         CHECK(val->arr_len == 16);
16582         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
16583         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16584         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
16585         return ret_arr;
16586 }
16587
16588 int8_tArray  CS_LDK_U128_new(int8_tArray le_bytes) {
16589         LDKSixteenBytes le_bytes_ref;
16590         CHECK(le_bytes->arr_len == 16);
16591         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
16592         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16593         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
16594         return ret_arr;
16595 }
16596
16597 int64_t  CS_LDK_WitnessProgram_new(int8_t version, int8_tArray program) {
16598         
16599         LDKCVec_u8Z program_ref;
16600         program_ref.datalen = program->arr_len;
16601         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
16602         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
16603         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16604         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
16605         return tag_ptr(ret_ref, true);
16606 }
16607
16608 int8_t  CS_LDK_WitnessProgram_get_version(int64_t prog) {
16609         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16610         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
16611         return ret_val;
16612 }
16613
16614 int8_tArray  CS_LDK_WitnessProgram_get_program(int64_t prog) {
16615         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16616         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
16617         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16618         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16619         return ret_arr;
16620 }
16621
16622 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
16623         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16624         *ret_ref = WitnessProgram_clone(arg);
16625         return tag_ptr(ret_ref, true);
16626 }
16627 int64_t  CS_LDK_WitnessProgram_clone_ptr(int64_t arg) {
16628         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
16629         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
16630         return ret_conv;
16631 }
16632
16633 int64_t  CS_LDK_WitnessProgram_clone(int64_t orig) {
16634         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
16635         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16636         *ret_ref = WitnessProgram_clone(orig_conv);
16637         return tag_ptr(ret_ref, true);
16638 }
16639
16640 void  CS_LDK_WitnessProgram_free(int64_t o) {
16641         if (!ptr_is_owned(o)) return;
16642         void* o_ptr = untag_ptr(o);
16643         CHECK_ACCESS(o_ptr);
16644         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
16645         FREE(untag_ptr(o));
16646         WitnessProgram_free(o_conv);
16647 }
16648
16649 int64_t  CS_LDK_BigEndianScalar_new(int8_tArray big_endian_bytes) {
16650         LDKThirtyTwoBytes big_endian_bytes_ref;
16651         CHECK(big_endian_bytes->arr_len == 32);
16652         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
16653         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
16654         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
16655         return tag_ptr(ret_ref, true);
16656 }
16657
16658 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
16659         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16660         *ret_copy = Bech32Error_clone(arg);
16661         int64_t ret_ref = tag_ptr(ret_copy, true);
16662         return ret_ref;
16663 }
16664 int64_t  CS_LDK_Bech32Error_clone_ptr(int64_t arg) {
16665         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
16666         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
16667         return ret_conv;
16668 }
16669
16670 int64_t  CS_LDK_Bech32Error_clone(int64_t orig) {
16671         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
16672         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16673         *ret_copy = Bech32Error_clone(orig_conv);
16674         int64_t ret_ref = tag_ptr(ret_copy, true);
16675         return ret_ref;
16676 }
16677
16678 void  CS_LDK_Bech32Error_free(int64_t o) {
16679         if (!ptr_is_owned(o)) return;
16680         void* o_ptr = untag_ptr(o);
16681         CHECK_ACCESS(o_ptr);
16682         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
16683         FREE(untag_ptr(o));
16684         Bech32Error_free(o_conv);
16685 }
16686
16687 void  CS_LDK_Transaction_free(int8_tArray _res) {
16688         LDKTransaction _res_ref;
16689         _res_ref.datalen = _res->arr_len;
16690         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
16691         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16692         _res_ref.data_is_owned = true;
16693         Transaction_free(_res_ref);
16694 }
16695
16696 void  CS_LDK_Witness_free(int8_tArray _res) {
16697         LDKWitness _res_ref;
16698         _res_ref.datalen = _res->arr_len;
16699         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
16700         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16701         _res_ref.data_is_owned = true;
16702         Witness_free(_res_ref);
16703 }
16704
16705 int64_t  CS_LDK_TxIn_new(int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
16706         LDKWitness witness_ref;
16707         witness_ref.datalen = witness->arr_len;
16708         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
16709         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
16710         witness_ref.data_is_owned = true;
16711         LDKCVec_u8Z script_sig_ref;
16712         script_sig_ref.datalen = script_sig->arr_len;
16713         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
16714         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
16715         LDKThirtyTwoBytes previous_txid_ref;
16716         CHECK(previous_txid->arr_len == 32);
16717         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
16718         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
16719         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
16720         return tag_ptr(ret_ref, true);
16721 }
16722
16723 int8_tArray  CS_LDK_TxIn_get_witness(int64_t txin) {
16724         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16725         LDKWitness ret_var = TxIn_get_witness(txin_conv);
16726         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16727         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16728         Witness_free(ret_var);
16729         return ret_arr;
16730 }
16731
16732 int8_tArray  CS_LDK_TxIn_get_script_sig(int64_t txin) {
16733         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16734         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
16735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16737         return ret_arr;
16738 }
16739
16740 int32_t  CS_LDK_TxIn_get_sequence(int64_t txin) {
16741         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16742         int32_t ret_conv = TxIn_get_sequence(txin_conv);
16743         return ret_conv;
16744 }
16745
16746 int8_tArray  CS_LDK_TxIn_get_previous_txid(int64_t txin) {
16747         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16748         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
16749         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
16750         return ret_arr;
16751 }
16752
16753 int32_t  CS_LDK_TxIn_get_previous_vout(int64_t txin) {
16754         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16755         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
16756         return ret_conv;
16757 }
16758
16759 void  CS_LDK_TxIn_free(int64_t _res) {
16760         if (!ptr_is_owned(_res)) return;
16761         void* _res_ptr = untag_ptr(_res);
16762         CHECK_ACCESS(_res_ptr);
16763         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
16764         FREE(untag_ptr(_res));
16765         TxIn_free(_res_conv);
16766 }
16767
16768 int64_t  CS_LDK_TxOut_new(int8_tArray script_pubkey, int64_t value) {
16769         LDKCVec_u8Z script_pubkey_ref;
16770         script_pubkey_ref.datalen = script_pubkey->arr_len;
16771         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
16772         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
16773         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16774         *ret_ref = TxOut_new(script_pubkey_ref, value);
16775         return tag_ptr(ret_ref, true);
16776 }
16777
16778 int8_tArray  CS_LDK_TxOut_get_script_pubkey(int64_t txout) {
16779         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16780         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
16781         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16782         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16783         return ret_arr;
16784 }
16785
16786 int64_t  CS_LDK_TxOut_get_value(int64_t txout) {
16787         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16788         int64_t ret_conv = TxOut_get_value(txout_conv);
16789         return ret_conv;
16790 }
16791
16792 void  CS_LDK_TxOut_free(int64_t _res) {
16793         if (!ptr_is_owned(_res)) return;
16794         void* _res_ptr = untag_ptr(_res);
16795         CHECK_ACCESS(_res_ptr);
16796         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
16797         FREE(untag_ptr(_res));
16798         TxOut_free(_res_conv);
16799 }
16800
16801 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
16802         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16803         *ret_ref = TxOut_clone(arg);
16804         return tag_ptr(ret_ref, true);
16805 }
16806 int64_t  CS_LDK_TxOut_clone_ptr(int64_t arg) {
16807         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
16808         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
16809         return ret_conv;
16810 }
16811
16812 int64_t  CS_LDK_TxOut_clone(int64_t orig) {
16813         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
16814         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16815         *ret_ref = TxOut_clone(orig_conv);
16816         return tag_ptr(ret_ref, true);
16817 }
16818
16819 void  CS_LDK_Str_free(jstring _res) {
16820         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
16821         Str_free(dummy);
16822 }
16823
16824 int64_t  CS_LDK_COption_u64Z_some(int64_t o) {
16825         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16826         *ret_copy = COption_u64Z_some(o);
16827         int64_t ret_ref = tag_ptr(ret_copy, true);
16828         return ret_ref;
16829 }
16830
16831 int64_t  CS_LDK_COption_u64Z_none() {
16832         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16833         *ret_copy = COption_u64Z_none();
16834         int64_t ret_ref = tag_ptr(ret_copy, true);
16835         return ret_ref;
16836 }
16837
16838 void  CS_LDK_COption_u64Z_free(int64_t _res) {
16839         if (!ptr_is_owned(_res)) return;
16840         void* _res_ptr = untag_ptr(_res);
16841         CHECK_ACCESS(_res_ptr);
16842         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
16843         FREE(untag_ptr(_res));
16844         COption_u64Z_free(_res_conv);
16845 }
16846
16847 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
16848         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16849         *ret_copy = COption_u64Z_clone(arg);
16850         int64_t ret_ref = tag_ptr(ret_copy, true);
16851         return ret_ref;
16852 }
16853 int64_t  CS_LDK_COption_u64Z_clone_ptr(int64_t arg) {
16854         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
16855         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
16856         return ret_conv;
16857 }
16858
16859 int64_t  CS_LDK_COption_u64Z_clone(int64_t orig) {
16860         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
16861         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16862         *ret_copy = COption_u64Z_clone(orig_conv);
16863         int64_t ret_ref = tag_ptr(ret_copy, true);
16864         return ret_ref;
16865 }
16866
16867 void  CS_LDK_CVec_BlindedPathZ_free(int64_tArray _res) {
16868         LDKCVec_BlindedPathZ _res_constr;
16869         _res_constr.datalen = _res->arr_len;
16870         if (_res_constr.datalen > 0)
16871                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
16872         else
16873                 _res_constr.data = NULL;
16874         int64_t* _res_vals = _res->elems;
16875         for (size_t n = 0; n < _res_constr.datalen; n++) {
16876                 int64_t _res_conv_13 = _res_vals[n];
16877                 LDKBlindedPath _res_conv_13_conv;
16878                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
16879                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
16880                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
16881                 _res_constr.data[n] = _res_conv_13_conv;
16882         }
16883         FREE(_res);
16884         CVec_BlindedPathZ_free(_res_constr);
16885 }
16886
16887 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_ok(int64_t o) {
16888         LDKRefund o_conv;
16889         o_conv.inner = untag_ptr(o);
16890         o_conv.is_owned = ptr_is_owned(o);
16891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16892         o_conv = Refund_clone(&o_conv);
16893         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16894         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
16895         return tag_ptr(ret_conv, true);
16896 }
16897
16898 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_err(int64_t e) {
16899         LDKBolt12ParseError e_conv;
16900         e_conv.inner = untag_ptr(e);
16901         e_conv.is_owned = ptr_is_owned(e);
16902         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16903         e_conv = Bolt12ParseError_clone(&e_conv);
16904         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16905         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
16906         return tag_ptr(ret_conv, true);
16907 }
16908
16909 jboolean  CS_LDK_CResult_RefundBolt12ParseErrorZ_is_ok(int64_t o) {
16910         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
16911         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
16912         return ret_conv;
16913 }
16914
16915 void  CS_LDK_CResult_RefundBolt12ParseErrorZ_free(int64_t _res) {
16916         if (!ptr_is_owned(_res)) return;
16917         void* _res_ptr = untag_ptr(_res);
16918         CHECK_ACCESS(_res_ptr);
16919         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
16920         FREE(untag_ptr(_res));
16921         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
16922 }
16923
16924 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
16925         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16926         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
16927         return tag_ptr(ret_conv, true);
16928 }
16929 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone_ptr(int64_t arg) {
16930         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
16931         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
16932         return ret_conv;
16933 }
16934
16935 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone(int64_t orig) {
16936         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
16937         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16938         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
16939         return tag_ptr(ret_conv, true);
16940 }
16941
16942 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_ok(int64_t o) {
16943         void* o_ptr = untag_ptr(o);
16944         CHECK_ACCESS(o_ptr);
16945         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
16946         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
16947         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16948         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
16949         return tag_ptr(ret_conv, true);
16950 }
16951
16952 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_err(int64_t e) {
16953         void* e_ptr = untag_ptr(e);
16954         CHECK_ACCESS(e_ptr);
16955         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16956         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16957         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16958         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
16959         return tag_ptr(ret_conv, true);
16960 }
16961
16962 jboolean  CS_LDK_CResult_RetryDecodeErrorZ_is_ok(int64_t o) {
16963         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
16964         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
16965         return ret_conv;
16966 }
16967
16968 void  CS_LDK_CResult_RetryDecodeErrorZ_free(int64_t _res) {
16969         if (!ptr_is_owned(_res)) return;
16970         void* _res_ptr = untag_ptr(_res);
16971         CHECK_ACCESS(_res_ptr);
16972         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
16973         FREE(untag_ptr(_res));
16974         CResult_RetryDecodeErrorZ_free(_res_conv);
16975 }
16976
16977 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
16978         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16979         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
16980         return tag_ptr(ret_conv, true);
16981 }
16982 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone_ptr(int64_t arg) {
16983         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
16984         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
16985         return ret_conv;
16986 }
16987
16988 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone(int64_t orig) {
16989         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
16990         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16991         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
16992         return tag_ptr(ret_conv, true);
16993 }
16994
16995 int64_t  CS_LDK_CResult_NoneAPIErrorZ_ok() {
16996         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16997         *ret_conv = CResult_NoneAPIErrorZ_ok();
16998         return tag_ptr(ret_conv, true);
16999 }
17000
17001 int64_t  CS_LDK_CResult_NoneAPIErrorZ_err(int64_t e) {
17002         void* e_ptr = untag_ptr(e);
17003         CHECK_ACCESS(e_ptr);
17004         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17005         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17006         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17007         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
17008         return tag_ptr(ret_conv, true);
17009 }
17010
17011 jboolean  CS_LDK_CResult_NoneAPIErrorZ_is_ok(int64_t o) {
17012         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
17013         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
17014         return ret_conv;
17015 }
17016
17017 void  CS_LDK_CResult_NoneAPIErrorZ_free(int64_t _res) {
17018         if (!ptr_is_owned(_res)) return;
17019         void* _res_ptr = untag_ptr(_res);
17020         CHECK_ACCESS(_res_ptr);
17021         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
17022         FREE(untag_ptr(_res));
17023         CResult_NoneAPIErrorZ_free(_res_conv);
17024 }
17025
17026 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
17027         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17028         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
17029         return tag_ptr(ret_conv, true);
17030 }
17031 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone_ptr(int64_t arg) {
17032         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
17033         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
17034         return ret_conv;
17035 }
17036
17037 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone(int64_t orig) {
17038         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
17039         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17040         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
17041         return tag_ptr(ret_conv, true);
17042 }
17043
17044 void  CS_LDK_CVec_CResult_NoneAPIErrorZZ_free(int64_tArray _res) {
17045         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
17046         _res_constr.datalen = _res->arr_len;
17047         if (_res_constr.datalen > 0)
17048                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17049         else
17050                 _res_constr.data = NULL;
17051         int64_t* _res_vals = _res->elems;
17052         for (size_t w = 0; w < _res_constr.datalen; w++) {
17053                 int64_t _res_conv_22 = _res_vals[w];
17054                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
17055                 CHECK_ACCESS(_res_conv_22_ptr);
17056                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
17057                 FREE(untag_ptr(_res_conv_22));
17058                 _res_constr.data[w] = _res_conv_22_conv;
17059         }
17060         FREE(_res);
17061         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
17062 }
17063
17064 void  CS_LDK_CVec_APIErrorZ_free(int64_tArray _res) {
17065         LDKCVec_APIErrorZ _res_constr;
17066         _res_constr.datalen = _res->arr_len;
17067         if (_res_constr.datalen > 0)
17068                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17069         else
17070                 _res_constr.data = NULL;
17071         int64_t* _res_vals = _res->elems;
17072         for (size_t k = 0; k < _res_constr.datalen; k++) {
17073                 int64_t _res_conv_10 = _res_vals[k];
17074                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
17075                 CHECK_ACCESS(_res_conv_10_ptr);
17076                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
17077                 FREE(untag_ptr(_res_conv_10));
17078                 _res_constr.data[k] = _res_conv_10_conv;
17079         }
17080         FREE(_res);
17081         CVec_APIErrorZ_free(_res_constr);
17082 }
17083
17084 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
17085         LDKThirtyTwoBytes o_ref;
17086         CHECK(o->arr_len == 32);
17087         memcpy(o_ref.data, o->elems, 32); FREE(o);
17088         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17089         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
17090         int64_t ret_ref = tag_ptr(ret_copy, true);
17091         return ret_ref;
17092 }
17093
17094 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_none() {
17095         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17096         *ret_copy = COption_ThirtyTwoBytesZ_none();
17097         int64_t ret_ref = tag_ptr(ret_copy, true);
17098         return ret_ref;
17099 }
17100
17101 void  CS_LDK_COption_ThirtyTwoBytesZ_free(int64_t _res) {
17102         if (!ptr_is_owned(_res)) return;
17103         void* _res_ptr = untag_ptr(_res);
17104         CHECK_ACCESS(_res_ptr);
17105         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
17106         FREE(untag_ptr(_res));
17107         COption_ThirtyTwoBytesZ_free(_res_conv);
17108 }
17109
17110 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
17111         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17112         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
17113         int64_t ret_ref = tag_ptr(ret_copy, true);
17114         return ret_ref;
17115 }
17116 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone_ptr(int64_t arg) {
17117         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
17118         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
17119         return ret_conv;
17120 }
17121
17122 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone(int64_t orig) {
17123         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
17124         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17125         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
17126         int64_t ret_ref = tag_ptr(ret_copy, true);
17127         return ret_ref;
17128 }
17129
17130 void  CS_LDK_CVec_u8Z_free(int8_tArray _res) {
17131         LDKCVec_u8Z _res_ref;
17132         _res_ref.datalen = _res->arr_len;
17133         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
17134         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
17135         CVec_u8Z_free(_res_ref);
17136 }
17137
17138 int64_t  CS_LDK_COption_CVec_u8ZZ_some(int8_tArray o) {
17139         LDKCVec_u8Z o_ref;
17140         o_ref.datalen = o->arr_len;
17141         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17142         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17143         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17144         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
17145         int64_t ret_ref = tag_ptr(ret_copy, true);
17146         return ret_ref;
17147 }
17148
17149 int64_t  CS_LDK_COption_CVec_u8ZZ_none() {
17150         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17151         *ret_copy = COption_CVec_u8ZZ_none();
17152         int64_t ret_ref = tag_ptr(ret_copy, true);
17153         return ret_ref;
17154 }
17155
17156 void  CS_LDK_COption_CVec_u8ZZ_free(int64_t _res) {
17157         if (!ptr_is_owned(_res)) return;
17158         void* _res_ptr = untag_ptr(_res);
17159         CHECK_ACCESS(_res_ptr);
17160         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
17161         FREE(untag_ptr(_res));
17162         COption_CVec_u8ZZ_free(_res_conv);
17163 }
17164
17165 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
17166         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17167         *ret_copy = COption_CVec_u8ZZ_clone(arg);
17168         int64_t ret_ref = tag_ptr(ret_copy, true);
17169         return ret_ref;
17170 }
17171 int64_t  CS_LDK_COption_CVec_u8ZZ_clone_ptr(int64_t arg) {
17172         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
17173         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
17174         return ret_conv;
17175 }
17176
17177 int64_t  CS_LDK_COption_CVec_u8ZZ_clone(int64_t orig) {
17178         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
17179         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17180         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
17181         int64_t ret_ref = tag_ptr(ret_copy, true);
17182         return ret_ref;
17183 }
17184
17185 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_ok(int64_t o) {
17186         LDKRecipientOnionFields o_conv;
17187         o_conv.inner = untag_ptr(o);
17188         o_conv.is_owned = ptr_is_owned(o);
17189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17190         o_conv = RecipientOnionFields_clone(&o_conv);
17191         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17192         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
17193         return tag_ptr(ret_conv, true);
17194 }
17195
17196 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_err(int64_t e) {
17197         void* e_ptr = untag_ptr(e);
17198         CHECK_ACCESS(e_ptr);
17199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17201         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17202         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
17203         return tag_ptr(ret_conv, true);
17204 }
17205
17206 jboolean  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(int64_t o) {
17207         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
17208         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
17209         return ret_conv;
17210 }
17211
17212 void  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_free(int64_t _res) {
17213         if (!ptr_is_owned(_res)) return;
17214         void* _res_ptr = untag_ptr(_res);
17215         CHECK_ACCESS(_res_ptr);
17216         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
17217         FREE(untag_ptr(_res));
17218         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
17219 }
17220
17221 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
17222         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17223         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
17224         return tag_ptr(ret_conv, true);
17225 }
17226 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(int64_t arg) {
17227         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
17228         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
17229         return ret_conv;
17230 }
17231
17232 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone(int64_t orig) {
17233         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
17234         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17235         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
17236         return tag_ptr(ret_conv, true);
17237 }
17238
17239 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
17240         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17241         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
17242         return tag_ptr(ret_conv, true);
17243 }
17244 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone_ptr(int64_t arg) {
17245         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
17246         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
17247         return ret_conv;
17248 }
17249
17250 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone(int64_t orig) {
17251         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
17252         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17253         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
17254         return tag_ptr(ret_conv, true);
17255 }
17256
17257 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
17258         LDKCVec_u8Z b_ref;
17259         b_ref.datalen = b->arr_len;
17260         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17261         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17262         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17263         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
17264         return tag_ptr(ret_conv, true);
17265 }
17266
17267 void  CS_LDK_C2Tuple_u64CVec_u8ZZ_free(int64_t _res) {
17268         if (!ptr_is_owned(_res)) return;
17269         void* _res_ptr = untag_ptr(_res);
17270         CHECK_ACCESS(_res_ptr);
17271         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
17272         FREE(untag_ptr(_res));
17273         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
17274 }
17275
17276 void  CS_LDK_CVec_C2Tuple_u64CVec_u8ZZZ_free(int64_tArray _res) {
17277         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
17278         _res_constr.datalen = _res->arr_len;
17279         if (_res_constr.datalen > 0)
17280                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
17281         else
17282                 _res_constr.data = NULL;
17283         int64_t* _res_vals = _res->elems;
17284         for (size_t x = 0; x < _res_constr.datalen; x++) {
17285                 int64_t _res_conv_23 = _res_vals[x];
17286                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
17287                 CHECK_ACCESS(_res_conv_23_ptr);
17288                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
17289                 FREE(untag_ptr(_res_conv_23));
17290                 _res_constr.data[x] = _res_conv_23_conv;
17291         }
17292         FREE(_res);
17293         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
17294 }
17295
17296 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_ok(int64_t o) {
17297         LDKRecipientOnionFields o_conv;
17298         o_conv.inner = untag_ptr(o);
17299         o_conv.is_owned = ptr_is_owned(o);
17300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17301         o_conv = RecipientOnionFields_clone(&o_conv);
17302         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17303         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
17304         return tag_ptr(ret_conv, true);
17305 }
17306
17307 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_err() {
17308         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17309         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
17310         return tag_ptr(ret_conv, true);
17311 }
17312
17313 jboolean  CS_LDK_CResult_RecipientOnionFieldsNoneZ_is_ok(int64_t o) {
17314         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
17315         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
17316         return ret_conv;
17317 }
17318
17319 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_free(int64_t _res) {
17320         if (!ptr_is_owned(_res)) return;
17321         void* _res_ptr = untag_ptr(_res);
17322         CHECK_ACCESS(_res_ptr);
17323         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
17324         FREE(untag_ptr(_res));
17325         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
17326 }
17327
17328 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
17329         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17330         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
17331         return tag_ptr(ret_conv, true);
17332 }
17333 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone_ptr(int64_t arg) {
17334         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
17335         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
17336         return ret_conv;
17337 }
17338
17339 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone(int64_t orig) {
17340         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
17341         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17342         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
17343         return tag_ptr(ret_conv, true);
17344 }
17345
17346 void  CS_LDK_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17347         LDKCVec_ThirtyTwoBytesZ _res_constr;
17348         _res_constr.datalen = _res->arr_len;
17349         if (_res_constr.datalen > 0)
17350                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17351         else
17352                 _res_constr.data = NULL;
17353         int8_tArray* _res_vals = (void*) _res->elems;
17354         for (size_t i = 0; i < _res_constr.datalen; i++) {
17355                 int8_tArray _res_conv_8 = _res_vals[i];
17356                 LDKThirtyTwoBytes _res_conv_8_ref;
17357                 CHECK(_res_conv_8->arr_len == 32);
17358                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, 32); FREE(_res_conv_8);
17359                 _res_constr.data[i] = _res_conv_8_ref;
17360         }
17361         FREE(_res);
17362         CVec_ThirtyTwoBytesZ_free(_res_constr);
17363 }
17364
17365 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
17366         LDKCVec_ThirtyTwoBytesZ o_constr;
17367         o_constr.datalen = o->arr_len;
17368         if (o_constr.datalen > 0)
17369                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17370         else
17371                 o_constr.data = NULL;
17372         int8_tArray* o_vals = (void*) o->elems;
17373         for (size_t i = 0; i < o_constr.datalen; i++) {
17374                 int8_tArray o_conv_8 = o_vals[i];
17375                 LDKThirtyTwoBytes o_conv_8_ref;
17376                 CHECK(o_conv_8->arr_len == 32);
17377                 memcpy(o_conv_8_ref.data, o_conv_8->elems, 32); FREE(o_conv_8);
17378                 o_constr.data[i] = o_conv_8_ref;
17379         }
17380         FREE(o);
17381         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17382         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
17383         int64_t ret_ref = tag_ptr(ret_copy, true);
17384         return ret_ref;
17385 }
17386
17387 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_none() {
17388         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17389         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
17390         int64_t ret_ref = tag_ptr(ret_copy, true);
17391         return ret_ref;
17392 }
17393
17394 void  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_free(int64_t _res) {
17395         if (!ptr_is_owned(_res)) return;
17396         void* _res_ptr = untag_ptr(_res);
17397         CHECK_ACCESS(_res_ptr);
17398         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
17399         FREE(untag_ptr(_res));
17400         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
17401 }
17402
17403 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
17404         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17405         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
17406         int64_t ret_ref = tag_ptr(ret_copy, true);
17407         return ret_ref;
17408 }
17409 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
17410         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
17411         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
17412         return ret_conv;
17413 }
17414
17415 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone(int64_t orig) {
17416         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
17417         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17418         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
17419         int64_t ret_ref = tag_ptr(ret_copy, true);
17420         return ret_ref;
17421 }
17422
17423 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
17424         LDKThirtyTwoBytes o_ref;
17425         CHECK(o->arr_len == 32);
17426         memcpy(o_ref.data, o->elems, 32); FREE(o);
17427         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17428         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
17429         return tag_ptr(ret_conv, true);
17430 }
17431
17432 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_err() {
17433         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17434         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
17435         return tag_ptr(ret_conv, true);
17436 }
17437
17438 jboolean  CS_LDK_CResult_ThirtyTwoBytesNoneZ_is_ok(int64_t o) {
17439         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
17440         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
17441         return ret_conv;
17442 }
17443
17444 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_free(int64_t _res) {
17445         if (!ptr_is_owned(_res)) return;
17446         void* _res_ptr = untag_ptr(_res);
17447         CHECK_ACCESS(_res_ptr);
17448         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
17449         FREE(untag_ptr(_res));
17450         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
17451 }
17452
17453 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
17454         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17455         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
17456         return tag_ptr(ret_conv, true);
17457 }
17458 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone_ptr(int64_t arg) {
17459         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
17460         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
17461         return ret_conv;
17462 }
17463
17464 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone(int64_t orig) {
17465         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
17466         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17467         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
17468         return tag_ptr(ret_conv, true);
17469 }
17470
17471 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_ok(int64_t o) {
17472         LDKBlindedPayInfo o_conv;
17473         o_conv.inner = untag_ptr(o);
17474         o_conv.is_owned = ptr_is_owned(o);
17475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17476         o_conv = BlindedPayInfo_clone(&o_conv);
17477         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17478         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
17479         return tag_ptr(ret_conv, true);
17480 }
17481
17482 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_err(int64_t e) {
17483         void* e_ptr = untag_ptr(e);
17484         CHECK_ACCESS(e_ptr);
17485         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17486         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17487         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17488         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
17489         return tag_ptr(ret_conv, true);
17490 }
17491
17492 jboolean  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_is_ok(int64_t o) {
17493         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
17494         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
17495         return ret_conv;
17496 }
17497
17498 void  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_free(int64_t _res) {
17499         if (!ptr_is_owned(_res)) return;
17500         void* _res_ptr = untag_ptr(_res);
17501         CHECK_ACCESS(_res_ptr);
17502         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
17503         FREE(untag_ptr(_res));
17504         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
17505 }
17506
17507 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
17508         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17509         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
17510         return tag_ptr(ret_conv, true);
17511 }
17512 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(int64_t arg) {
17513         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
17514         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
17515         return ret_conv;
17516 }
17517
17518 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone(int64_t orig) {
17519         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
17520         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17521         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
17522         return tag_ptr(ret_conv, true);
17523 }
17524
17525 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
17526         LDKDelayedPaymentOutputDescriptor o_conv;
17527         o_conv.inner = untag_ptr(o);
17528         o_conv.is_owned = ptr_is_owned(o);
17529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17530         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17531         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17532         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17533         return tag_ptr(ret_conv, true);
17534 }
17535
17536 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
17537         void* e_ptr = untag_ptr(e);
17538         CHECK_ACCESS(e_ptr);
17539         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17540         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17541         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17542         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17543         return tag_ptr(ret_conv, true);
17544 }
17545
17546 jboolean  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
17547         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17548         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17549         return ret_conv;
17550 }
17551
17552 void  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
17553         if (!ptr_is_owned(_res)) return;
17554         void* _res_ptr = untag_ptr(_res);
17555         CHECK_ACCESS(_res_ptr);
17556         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17557         FREE(untag_ptr(_res));
17558         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17559 }
17560
17561 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17562         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17563         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17564         return tag_ptr(ret_conv, true);
17565 }
17566 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17567         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17568         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17569         return ret_conv;
17570 }
17571
17572 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
17573         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17574         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17575         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17576         return tag_ptr(ret_conv, true);
17577 }
17578
17579 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
17580         LDKStaticPaymentOutputDescriptor o_conv;
17581         o_conv.inner = untag_ptr(o);
17582         o_conv.is_owned = ptr_is_owned(o);
17583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17584         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17585         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17586         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17587         return tag_ptr(ret_conv, true);
17588 }
17589
17590 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
17591         void* e_ptr = untag_ptr(e);
17592         CHECK_ACCESS(e_ptr);
17593         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17594         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17595         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17596         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17597         return tag_ptr(ret_conv, true);
17598 }
17599
17600 jboolean  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
17601         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17602         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17603         return ret_conv;
17604 }
17605
17606 void  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
17607         if (!ptr_is_owned(_res)) return;
17608         void* _res_ptr = untag_ptr(_res);
17609         CHECK_ACCESS(_res_ptr);
17610         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17611         FREE(untag_ptr(_res));
17612         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17613 }
17614
17615 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17616         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17617         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17618         return tag_ptr(ret_conv, true);
17619 }
17620 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17621         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17622         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17623         return ret_conv;
17624 }
17625
17626 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
17627         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17628         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17629         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17630         return tag_ptr(ret_conv, true);
17631 }
17632
17633 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(int64_t o) {
17634         void* o_ptr = untag_ptr(o);
17635         CHECK_ACCESS(o_ptr);
17636         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17637         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
17638         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17639         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17640         return tag_ptr(ret_conv, true);
17641 }
17642
17643 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_err(int64_t e) {
17644         void* e_ptr = untag_ptr(e);
17645         CHECK_ACCESS(e_ptr);
17646         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17647         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17648         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17649         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17650         return tag_ptr(ret_conv, true);
17651 }
17652
17653 jboolean  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
17654         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17655         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17656         return ret_conv;
17657 }
17658
17659 void  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_free(int64_t _res) {
17660         if (!ptr_is_owned(_res)) return;
17661         void* _res_ptr = untag_ptr(_res);
17662         CHECK_ACCESS(_res_ptr);
17663         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17664         FREE(untag_ptr(_res));
17665         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17666 }
17667
17668 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17669         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17670         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17671         return tag_ptr(ret_conv, true);
17672 }
17673 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17674         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17675         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17676         return ret_conv;
17677 }
17678
17679 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
17680         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17681         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17682         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17683         return tag_ptr(ret_conv, true);
17684 }
17685
17686 void  CS_LDK_CVec_SpendableOutputDescriptorZ_free(int64_tArray _res) {
17687         LDKCVec_SpendableOutputDescriptorZ _res_constr;
17688         _res_constr.datalen = _res->arr_len;
17689         if (_res_constr.datalen > 0)
17690                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17691         else
17692                 _res_constr.data = NULL;
17693         int64_t* _res_vals = _res->elems;
17694         for (size_t b = 0; b < _res_constr.datalen; b++) {
17695                 int64_t _res_conv_27 = _res_vals[b];
17696                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
17697                 CHECK_ACCESS(_res_conv_27_ptr);
17698                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
17699                 FREE(untag_ptr(_res_conv_27));
17700                 _res_constr.data[b] = _res_conv_27_conv;
17701         }
17702         FREE(_res);
17703         CVec_SpendableOutputDescriptorZ_free(_res_constr);
17704 }
17705
17706 void  CS_LDK_CVec_TxOutZ_free(int64_tArray _res) {
17707         LDKCVec_TxOutZ _res_constr;
17708         _res_constr.datalen = _res->arr_len;
17709         if (_res_constr.datalen > 0)
17710                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17711         else
17712                 _res_constr.data = NULL;
17713         int64_t* _res_vals = _res->elems;
17714         for (size_t h = 0; h < _res_constr.datalen; h++) {
17715                 int64_t _res_conv_7 = _res_vals[h];
17716                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17717                 CHECK_ACCESS(_res_conv_7_ptr);
17718                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17719                 FREE(untag_ptr(_res_conv_7));
17720                 _res_constr.data[h] = _res_conv_7_conv;
17721         }
17722         FREE(_res);
17723         CVec_TxOutZ_free(_res_constr);
17724 }
17725
17726 int64_t  CS_LDK_COption_u32Z_some(int32_t o) {
17727         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17728         *ret_copy = COption_u32Z_some(o);
17729         int64_t ret_ref = tag_ptr(ret_copy, true);
17730         return ret_ref;
17731 }
17732
17733 int64_t  CS_LDK_COption_u32Z_none() {
17734         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17735         *ret_copy = COption_u32Z_none();
17736         int64_t ret_ref = tag_ptr(ret_copy, true);
17737         return ret_ref;
17738 }
17739
17740 void  CS_LDK_COption_u32Z_free(int64_t _res) {
17741         if (!ptr_is_owned(_res)) return;
17742         void* _res_ptr = untag_ptr(_res);
17743         CHECK_ACCESS(_res_ptr);
17744         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
17745         FREE(untag_ptr(_res));
17746         COption_u32Z_free(_res_conv);
17747 }
17748
17749 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
17750         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17751         *ret_copy = COption_u32Z_clone(arg);
17752         int64_t ret_ref = tag_ptr(ret_copy, true);
17753         return ret_ref;
17754 }
17755 int64_t  CS_LDK_COption_u32Z_clone_ptr(int64_t arg) {
17756         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
17757         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
17758         return ret_conv;
17759 }
17760
17761 int64_t  CS_LDK_COption_u32Z_clone(int64_t orig) {
17762         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
17763         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17764         *ret_copy = COption_u32Z_clone(orig_conv);
17765         int64_t ret_ref = tag_ptr(ret_copy, true);
17766         return ret_ref;
17767 }
17768
17769 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
17770         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17771         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
17772         return tag_ptr(ret_conv, true);
17773 }
17774 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone_ptr(int64_t arg) {
17775         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
17776         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
17777         return ret_conv;
17778 }
17779
17780 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone(int64_t orig) {
17781         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
17782         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17783         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
17784         return tag_ptr(ret_conv, true);
17785 }
17786
17787 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
17788         LDKCVec_u8Z a_ref;
17789         a_ref.datalen = a->arr_len;
17790         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
17791         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
17792         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17793         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
17794         return tag_ptr(ret_conv, true);
17795 }
17796
17797 void  CS_LDK_C2Tuple_CVec_u8Zu64Z_free(int64_t _res) {
17798         if (!ptr_is_owned(_res)) return;
17799         void* _res_ptr = untag_ptr(_res);
17800         CHECK_ACCESS(_res_ptr);
17801         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
17802         FREE(untag_ptr(_res));
17803         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
17804 }
17805
17806 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(int64_t o) {
17807         void* o_ptr = untag_ptr(o);
17808         CHECK_ACCESS(o_ptr);
17809         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
17810         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
17811         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17812         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
17813         return tag_ptr(ret_conv, true);
17814 }
17815
17816 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
17817         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17818         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
17819         return tag_ptr(ret_conv, true);
17820 }
17821
17822 jboolean  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(int64_t o) {
17823         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
17824         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
17825         return ret_conv;
17826 }
17827
17828 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(int64_t _res) {
17829         if (!ptr_is_owned(_res)) return;
17830         void* _res_ptr = untag_ptr(_res);
17831         CHECK_ACCESS(_res_ptr);
17832         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
17833         FREE(untag_ptr(_res));
17834         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
17835 }
17836
17837 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
17838         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17839         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
17840         return tag_ptr(ret_conv, true);
17841 }
17842 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(int64_t arg) {
17843         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
17844         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
17845         return ret_conv;
17846 }
17847
17848 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(int64_t orig) {
17849         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
17850         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17851         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
17852         return tag_ptr(ret_conv, true);
17853 }
17854
17855 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_ok(int64_t o) {
17856         LDKChannelDerivationParameters o_conv;
17857         o_conv.inner = untag_ptr(o);
17858         o_conv.is_owned = ptr_is_owned(o);
17859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17860         o_conv = ChannelDerivationParameters_clone(&o_conv);
17861         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17862         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
17863         return tag_ptr(ret_conv, true);
17864 }
17865
17866 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_err(int64_t e) {
17867         void* e_ptr = untag_ptr(e);
17868         CHECK_ACCESS(e_ptr);
17869         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17870         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17871         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17872         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
17873         return tag_ptr(ret_conv, true);
17874 }
17875
17876 jboolean  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(int64_t o) {
17877         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
17878         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
17879         return ret_conv;
17880 }
17881
17882 void  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_free(int64_t _res) {
17883         if (!ptr_is_owned(_res)) return;
17884         void* _res_ptr = untag_ptr(_res);
17885         CHECK_ACCESS(_res_ptr);
17886         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
17887         FREE(untag_ptr(_res));
17888         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
17889 }
17890
17891 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
17892         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17893         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
17894         return tag_ptr(ret_conv, true);
17895 }
17896 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(int64_t arg) {
17897         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
17898         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
17899         return ret_conv;
17900 }
17901
17902 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone(int64_t orig) {
17903         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
17904         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17905         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
17906         return tag_ptr(ret_conv, true);
17907 }
17908
17909 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_ok(int64_t o) {
17910         LDKHTLCDescriptor o_conv;
17911         o_conv.inner = untag_ptr(o);
17912         o_conv.is_owned = ptr_is_owned(o);
17913         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17914         o_conv = HTLCDescriptor_clone(&o_conv);
17915         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17916         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
17917         return tag_ptr(ret_conv, true);
17918 }
17919
17920 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_err(int64_t e) {
17921         void* e_ptr = untag_ptr(e);
17922         CHECK_ACCESS(e_ptr);
17923         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17924         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17925         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17926         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
17927         return tag_ptr(ret_conv, true);
17928 }
17929
17930 jboolean  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_is_ok(int64_t o) {
17931         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
17932         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
17933         return ret_conv;
17934 }
17935
17936 void  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_free(int64_t _res) {
17937         if (!ptr_is_owned(_res)) return;
17938         void* _res_ptr = untag_ptr(_res);
17939         CHECK_ACCESS(_res_ptr);
17940         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
17941         FREE(untag_ptr(_res));
17942         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
17943 }
17944
17945 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17946         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17947         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
17948         return tag_ptr(ret_conv, true);
17949 }
17950 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17951         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
17952         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17953         return ret_conv;
17954 }
17955
17956 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone(int64_t orig) {
17957         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
17958         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17959         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
17960         return tag_ptr(ret_conv, true);
17961 }
17962
17963 int64_t  CS_LDK_CResult_NoneNoneZ_ok() {
17964         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17965         *ret_conv = CResult_NoneNoneZ_ok();
17966         return tag_ptr(ret_conv, true);
17967 }
17968
17969 int64_t  CS_LDK_CResult_NoneNoneZ_err() {
17970         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17971         *ret_conv = CResult_NoneNoneZ_err();
17972         return tag_ptr(ret_conv, true);
17973 }
17974
17975 jboolean  CS_LDK_CResult_NoneNoneZ_is_ok(int64_t o) {
17976         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
17977         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
17978         return ret_conv;
17979 }
17980
17981 void  CS_LDK_CResult_NoneNoneZ_free(int64_t _res) {
17982         if (!ptr_is_owned(_res)) return;
17983         void* _res_ptr = untag_ptr(_res);
17984         CHECK_ACCESS(_res_ptr);
17985         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
17986         FREE(untag_ptr(_res));
17987         CResult_NoneNoneZ_free(_res_conv);
17988 }
17989
17990 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
17991         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17992         *ret_conv = CResult_NoneNoneZ_clone(arg);
17993         return tag_ptr(ret_conv, true);
17994 }
17995 int64_t  CS_LDK_CResult_NoneNoneZ_clone_ptr(int64_t arg) {
17996         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
17997         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
17998         return ret_conv;
17999 }
18000
18001 int64_t  CS_LDK_CResult_NoneNoneZ_clone(int64_t orig) {
18002         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
18003         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18004         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
18005         return tag_ptr(ret_conv, true);
18006 }
18007
18008 int64_t  CS_LDK_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
18009         LDKPublicKey o_ref;
18010         CHECK(o->arr_len == 33);
18011         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
18012         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18013         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
18014         return tag_ptr(ret_conv, true);
18015 }
18016
18017 int64_t  CS_LDK_CResult_PublicKeyNoneZ_err() {
18018         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18019         *ret_conv = CResult_PublicKeyNoneZ_err();
18020         return tag_ptr(ret_conv, true);
18021 }
18022
18023 jboolean  CS_LDK_CResult_PublicKeyNoneZ_is_ok(int64_t o) {
18024         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
18025         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
18026         return ret_conv;
18027 }
18028
18029 void  CS_LDK_CResult_PublicKeyNoneZ_free(int64_t _res) {
18030         if (!ptr_is_owned(_res)) return;
18031         void* _res_ptr = untag_ptr(_res);
18032         CHECK_ACCESS(_res_ptr);
18033         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
18034         FREE(untag_ptr(_res));
18035         CResult_PublicKeyNoneZ_free(_res_conv);
18036 }
18037
18038 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
18039         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18040         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
18041         return tag_ptr(ret_conv, true);
18042 }
18043 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone_ptr(int64_t arg) {
18044         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
18045         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
18046         return ret_conv;
18047 }
18048
18049 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone(int64_t orig) {
18050         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
18051         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18052         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
18053         return tag_ptr(ret_conv, true);
18054 }
18055
18056 int64_t  CS_LDK_COption_BigEndianScalarZ_some(int64_t o) {
18057         void* o_ptr = untag_ptr(o);
18058         CHECK_ACCESS(o_ptr);
18059         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
18060         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
18061         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18062         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
18063         int64_t ret_ref = tag_ptr(ret_copy, true);
18064         return ret_ref;
18065 }
18066
18067 int64_t  CS_LDK_COption_BigEndianScalarZ_none() {
18068         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18069         *ret_copy = COption_BigEndianScalarZ_none();
18070         int64_t ret_ref = tag_ptr(ret_copy, true);
18071         return ret_ref;
18072 }
18073
18074 void  CS_LDK_COption_BigEndianScalarZ_free(int64_t _res) {
18075         if (!ptr_is_owned(_res)) return;
18076         void* _res_ptr = untag_ptr(_res);
18077         CHECK_ACCESS(_res_ptr);
18078         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
18079         FREE(untag_ptr(_res));
18080         COption_BigEndianScalarZ_free(_res_conv);
18081 }
18082
18083 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
18084         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18085         *ret_copy = COption_BigEndianScalarZ_clone(arg);
18086         int64_t ret_ref = tag_ptr(ret_copy, true);
18087         return ret_ref;
18088 }
18089 int64_t  CS_LDK_COption_BigEndianScalarZ_clone_ptr(int64_t arg) {
18090         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
18091         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
18092         return ret_conv;
18093 }
18094
18095 int64_t  CS_LDK_COption_BigEndianScalarZ_clone(int64_t orig) {
18096         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
18097         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18098         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
18099         int64_t ret_ref = tag_ptr(ret_copy, true);
18100         return ret_ref;
18101 }
18102
18103 void  CS_LDK_CVec_U5Z_free(ptrArray _res) {
18104         LDKCVec_U5Z _res_constr;
18105         _res_constr.datalen = _res->arr_len;
18106         if (_res_constr.datalen > 0)
18107                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
18108         else
18109                 _res_constr.data = NULL;
18110         int8_t* _res_vals = (void*) _res->elems;
18111         for (size_t h = 0; h < _res_constr.datalen; h++) {
18112                 int8_t _res_conv_7 = _res_vals[h];
18113                 
18114                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
18115         }
18116         FREE(_res);
18117         CVec_U5Z_free(_res_constr);
18118 }
18119
18120 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
18121         LDKRecoverableSignature o_ref;
18122         CHECK(o->arr_len == 68);
18123         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
18124         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18125         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
18126         return tag_ptr(ret_conv, true);
18127 }
18128
18129 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_err() {
18130         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18131         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
18132         return tag_ptr(ret_conv, true);
18133 }
18134
18135 jboolean  CS_LDK_CResult_RecoverableSignatureNoneZ_is_ok(int64_t o) {
18136         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
18137         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
18138         return ret_conv;
18139 }
18140
18141 void  CS_LDK_CResult_RecoverableSignatureNoneZ_free(int64_t _res) {
18142         if (!ptr_is_owned(_res)) return;
18143         void* _res_ptr = untag_ptr(_res);
18144         CHECK_ACCESS(_res_ptr);
18145         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
18146         FREE(untag_ptr(_res));
18147         CResult_RecoverableSignatureNoneZ_free(_res_conv);
18148 }
18149
18150 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
18151         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18152         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
18153         return tag_ptr(ret_conv, true);
18154 }
18155 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone_ptr(int64_t arg) {
18156         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
18157         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
18158         return ret_conv;
18159 }
18160
18161 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone(int64_t orig) {
18162         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
18163         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18164         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
18165         return tag_ptr(ret_conv, true);
18166 }
18167
18168 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
18169         LDKSchnorrSignature o_ref;
18170         CHECK(o->arr_len == 64);
18171         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
18172         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18173         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
18174         return tag_ptr(ret_conv, true);
18175 }
18176
18177 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_err() {
18178         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18179         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
18180         return tag_ptr(ret_conv, true);
18181 }
18182
18183 jboolean  CS_LDK_CResult_SchnorrSignatureNoneZ_is_ok(int64_t o) {
18184         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
18185         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
18186         return ret_conv;
18187 }
18188
18189 void  CS_LDK_CResult_SchnorrSignatureNoneZ_free(int64_t _res) {
18190         if (!ptr_is_owned(_res)) return;
18191         void* _res_ptr = untag_ptr(_res);
18192         CHECK_ACCESS(_res_ptr);
18193         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
18194         FREE(untag_ptr(_res));
18195         CResult_SchnorrSignatureNoneZ_free(_res_conv);
18196 }
18197
18198 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
18199         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18200         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
18201         return tag_ptr(ret_conv, true);
18202 }
18203 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone_ptr(int64_t arg) {
18204         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
18205         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
18206         return ret_conv;
18207 }
18208
18209 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone(int64_t orig) {
18210         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
18211         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18212         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
18213         return tag_ptr(ret_conv, true);
18214 }
18215
18216 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
18217         LDKECDSASignature o_ref;
18218         CHECK(o->arr_len == 64);
18219         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
18220         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18221         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
18222         return tag_ptr(ret_conv, true);
18223 }
18224
18225 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_err() {
18226         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18227         *ret_conv = CResult_ECDSASignatureNoneZ_err();
18228         return tag_ptr(ret_conv, true);
18229 }
18230
18231 jboolean  CS_LDK_CResult_ECDSASignatureNoneZ_is_ok(int64_t o) {
18232         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
18233         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
18234         return ret_conv;
18235 }
18236
18237 void  CS_LDK_CResult_ECDSASignatureNoneZ_free(int64_t _res) {
18238         if (!ptr_is_owned(_res)) return;
18239         void* _res_ptr = untag_ptr(_res);
18240         CHECK_ACCESS(_res_ptr);
18241         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
18242         FREE(untag_ptr(_res));
18243         CResult_ECDSASignatureNoneZ_free(_res_conv);
18244 }
18245
18246 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
18247         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18248         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
18249         return tag_ptr(ret_conv, true);
18250 }
18251 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone_ptr(int64_t arg) {
18252         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
18253         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
18254         return ret_conv;
18255 }
18256
18257 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone(int64_t orig) {
18258         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
18259         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18260         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
18261         return tag_ptr(ret_conv, true);
18262 }
18263
18264 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(int64_t o) {
18265         void* o_ptr = untag_ptr(o);
18266         CHECK_ACCESS(o_ptr);
18267         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
18268         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
18269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18270                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
18271         }
18272         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18273         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
18274         return tag_ptr(ret_conv, true);
18275 }
18276
18277 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(int64_t e) {
18278         void* e_ptr = untag_ptr(e);
18279         CHECK_ACCESS(e_ptr);
18280         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18281         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18282         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18283         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
18284         return tag_ptr(ret_conv, true);
18285 }
18286
18287 jboolean  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(int64_t o) {
18288         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
18289         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
18290         return ret_conv;
18291 }
18292
18293 void  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(int64_t _res) {
18294         if (!ptr_is_owned(_res)) return;
18295         void* _res_ptr = untag_ptr(_res);
18296         CHECK_ACCESS(_res_ptr);
18297         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
18298         FREE(untag_ptr(_res));
18299         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
18300 }
18301
18302 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
18303         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18304         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
18305         return tag_ptr(ret_conv, true);
18306 }
18307 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(int64_t arg) {
18308         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
18309         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
18310         return ret_conv;
18311 }
18312
18313 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(int64_t orig) {
18314         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
18315         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18316         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
18317         return tag_ptr(ret_conv, true);
18318 }
18319
18320 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
18321         LDKCVec_u8Z o_ref;
18322         o_ref.datalen = o->arr_len;
18323         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18324         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18325         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18326         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
18327         return tag_ptr(ret_conv, true);
18328 }
18329
18330 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_err() {
18331         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18332         *ret_conv = CResult_CVec_u8ZNoneZ_err();
18333         return tag_ptr(ret_conv, true);
18334 }
18335
18336 jboolean  CS_LDK_CResult_CVec_u8ZNoneZ_is_ok(int64_t o) {
18337         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
18338         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
18339         return ret_conv;
18340 }
18341
18342 void  CS_LDK_CResult_CVec_u8ZNoneZ_free(int64_t _res) {
18343         if (!ptr_is_owned(_res)) return;
18344         void* _res_ptr = untag_ptr(_res);
18345         CHECK_ACCESS(_res_ptr);
18346         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
18347         FREE(untag_ptr(_res));
18348         CResult_CVec_u8ZNoneZ_free(_res_conv);
18349 }
18350
18351 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
18352         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18353         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
18354         return tag_ptr(ret_conv, true);
18355 }
18356 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone_ptr(int64_t arg) {
18357         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
18358         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
18359         return ret_conv;
18360 }
18361
18362 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone(int64_t orig) {
18363         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
18364         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18365         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
18366         return tag_ptr(ret_conv, true);
18367 }
18368
18369 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_ok(int64_t o) {
18370         LDKShutdownScript o_conv;
18371         o_conv.inner = untag_ptr(o);
18372         o_conv.is_owned = ptr_is_owned(o);
18373         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18374         o_conv = ShutdownScript_clone(&o_conv);
18375         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18376         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
18377         return tag_ptr(ret_conv, true);
18378 }
18379
18380 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_err() {
18381         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18382         *ret_conv = CResult_ShutdownScriptNoneZ_err();
18383         return tag_ptr(ret_conv, true);
18384 }
18385
18386 jboolean  CS_LDK_CResult_ShutdownScriptNoneZ_is_ok(int64_t o) {
18387         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
18388         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
18389         return ret_conv;
18390 }
18391
18392 void  CS_LDK_CResult_ShutdownScriptNoneZ_free(int64_t _res) {
18393         if (!ptr_is_owned(_res)) return;
18394         void* _res_ptr = untag_ptr(_res);
18395         CHECK_ACCESS(_res_ptr);
18396         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
18397         FREE(untag_ptr(_res));
18398         CResult_ShutdownScriptNoneZ_free(_res_conv);
18399 }
18400
18401 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
18402         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18403         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
18404         return tag_ptr(ret_conv, true);
18405 }
18406 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone_ptr(int64_t arg) {
18407         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
18408         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
18409         return ret_conv;
18410 }
18411
18412 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone(int64_t orig) {
18413         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
18414         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18415         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
18416         return tag_ptr(ret_conv, true);
18417 }
18418
18419 int64_t  CS_LDK_COption_u16Z_some(int16_t o) {
18420         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18421         *ret_copy = COption_u16Z_some(o);
18422         int64_t ret_ref = tag_ptr(ret_copy, true);
18423         return ret_ref;
18424 }
18425
18426 int64_t  CS_LDK_COption_u16Z_none() {
18427         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18428         *ret_copy = COption_u16Z_none();
18429         int64_t ret_ref = tag_ptr(ret_copy, true);
18430         return ret_ref;
18431 }
18432
18433 void  CS_LDK_COption_u16Z_free(int64_t _res) {
18434         if (!ptr_is_owned(_res)) return;
18435         void* _res_ptr = untag_ptr(_res);
18436         CHECK_ACCESS(_res_ptr);
18437         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18438         FREE(untag_ptr(_res));
18439         COption_u16Z_free(_res_conv);
18440 }
18441
18442 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18443         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18444         *ret_copy = COption_u16Z_clone(arg);
18445         int64_t ret_ref = tag_ptr(ret_copy, true);
18446         return ret_ref;
18447 }
18448 int64_t  CS_LDK_COption_u16Z_clone_ptr(int64_t arg) {
18449         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
18450         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18451         return ret_conv;
18452 }
18453
18454 int64_t  CS_LDK_COption_u16Z_clone(int64_t orig) {
18455         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
18456         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18457         *ret_copy = COption_u16Z_clone(orig_conv);
18458         int64_t ret_ref = tag_ptr(ret_copy, true);
18459         return ret_ref;
18460 }
18461
18462 int64_t  CS_LDK_COption_boolZ_some(jboolean o) {
18463         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18464         *ret_copy = COption_boolZ_some(o);
18465         int64_t ret_ref = tag_ptr(ret_copy, true);
18466         return ret_ref;
18467 }
18468
18469 int64_t  CS_LDK_COption_boolZ_none() {
18470         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18471         *ret_copy = COption_boolZ_none();
18472         int64_t ret_ref = tag_ptr(ret_copy, true);
18473         return ret_ref;
18474 }
18475
18476 void  CS_LDK_COption_boolZ_free(int64_t _res) {
18477         if (!ptr_is_owned(_res)) return;
18478         void* _res_ptr = untag_ptr(_res);
18479         CHECK_ACCESS(_res_ptr);
18480         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
18481         FREE(untag_ptr(_res));
18482         COption_boolZ_free(_res_conv);
18483 }
18484
18485 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
18486         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18487         *ret_copy = COption_boolZ_clone(arg);
18488         int64_t ret_ref = tag_ptr(ret_copy, true);
18489         return ret_ref;
18490 }
18491 int64_t  CS_LDK_COption_boolZ_clone_ptr(int64_t arg) {
18492         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
18493         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
18494         return ret_conv;
18495 }
18496
18497 int64_t  CS_LDK_COption_boolZ_clone(int64_t orig) {
18498         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
18499         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18500         *ret_copy = COption_boolZ_clone(orig_conv);
18501         int64_t ret_ref = tag_ptr(ret_copy, true);
18502         return ret_ref;
18503 }
18504
18505 int64_t  CS_LDK_CResult_WitnessNoneZ_ok(int8_tArray o) {
18506         LDKWitness o_ref;
18507         o_ref.datalen = o->arr_len;
18508         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
18509         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18510         o_ref.data_is_owned = true;
18511         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18512         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
18513         return tag_ptr(ret_conv, true);
18514 }
18515
18516 int64_t  CS_LDK_CResult_WitnessNoneZ_err() {
18517         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18518         *ret_conv = CResult_WitnessNoneZ_err();
18519         return tag_ptr(ret_conv, true);
18520 }
18521
18522 jboolean  CS_LDK_CResult_WitnessNoneZ_is_ok(int64_t o) {
18523         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
18524         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
18525         return ret_conv;
18526 }
18527
18528 void  CS_LDK_CResult_WitnessNoneZ_free(int64_t _res) {
18529         if (!ptr_is_owned(_res)) return;
18530         void* _res_ptr = untag_ptr(_res);
18531         CHECK_ACCESS(_res_ptr);
18532         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
18533         FREE(untag_ptr(_res));
18534         CResult_WitnessNoneZ_free(_res_conv);
18535 }
18536
18537 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
18538         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18539         *ret_conv = CResult_WitnessNoneZ_clone(arg);
18540         return tag_ptr(ret_conv, true);
18541 }
18542 int64_t  CS_LDK_CResult_WitnessNoneZ_clone_ptr(int64_t arg) {
18543         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
18544         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
18545         return ret_conv;
18546 }
18547
18548 int64_t  CS_LDK_CResult_WitnessNoneZ_clone(int64_t orig) {
18549         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
18550         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18551         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
18552         return tag_ptr(ret_conv, true);
18553 }
18554
18555 void  CS_LDK_CVec_ECDSASignatureZ_free(ptrArray _res) {
18556         LDKCVec_ECDSASignatureZ _res_constr;
18557         _res_constr.datalen = _res->arr_len;
18558         if (_res_constr.datalen > 0)
18559                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18560         else
18561                 _res_constr.data = NULL;
18562         int8_tArray* _res_vals = (void*) _res->elems;
18563         for (size_t i = 0; i < _res_constr.datalen; i++) {
18564                 int8_tArray _res_conv_8 = _res_vals[i];
18565                 LDKECDSASignature _res_conv_8_ref;
18566                 CHECK(_res_conv_8->arr_len == 64);
18567                 memcpy(_res_conv_8_ref.compact_form, _res_conv_8->elems, 64); FREE(_res_conv_8);
18568                 _res_constr.data[i] = _res_conv_8_ref;
18569         }
18570         FREE(_res);
18571         CVec_ECDSASignatureZ_free(_res_constr);
18572 }
18573
18574 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
18575         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18576         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
18577         return tag_ptr(ret_conv, true);
18578 }
18579 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(int64_t arg) {
18580         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
18581         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
18582         return ret_conv;
18583 }
18584
18585 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(int64_t orig) {
18586         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
18587         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18588         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
18589         return tag_ptr(ret_conv, true);
18590 }
18591
18592 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
18593         LDKECDSASignature a_ref;
18594         CHECK(a->arr_len == 64);
18595         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
18596         LDKCVec_ECDSASignatureZ b_constr;
18597         b_constr.datalen = b->arr_len;
18598         if (b_constr.datalen > 0)
18599                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18600         else
18601                 b_constr.data = NULL;
18602         int8_tArray* b_vals = (void*) b->elems;
18603         for (size_t i = 0; i < b_constr.datalen; i++) {
18604                 int8_tArray b_conv_8 = b_vals[i];
18605                 LDKECDSASignature b_conv_8_ref;
18606                 CHECK(b_conv_8->arr_len == 64);
18607                 memcpy(b_conv_8_ref.compact_form, b_conv_8->elems, 64); FREE(b_conv_8);
18608                 b_constr.data[i] = b_conv_8_ref;
18609         }
18610         FREE(b);
18611         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18612         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
18613         return tag_ptr(ret_conv, true);
18614 }
18615
18616 void  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(int64_t _res) {
18617         if (!ptr_is_owned(_res)) return;
18618         void* _res_ptr = untag_ptr(_res);
18619         CHECK_ACCESS(_res_ptr);
18620         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
18621         FREE(untag_ptr(_res));
18622         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
18623 }
18624
18625 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(int64_t o) {
18626         void* o_ptr = untag_ptr(o);
18627         CHECK_ACCESS(o_ptr);
18628         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
18629         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
18630         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18631         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
18632         return tag_ptr(ret_conv, true);
18633 }
18634
18635 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
18636         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18637         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
18638         return tag_ptr(ret_conv, true);
18639 }
18640
18641 jboolean  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(int64_t o) {
18642         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
18643         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
18644         return ret_conv;
18645 }
18646
18647 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(int64_t _res) {
18648         if (!ptr_is_owned(_res)) return;
18649         void* _res_ptr = untag_ptr(_res);
18650         CHECK_ACCESS(_res_ptr);
18651         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
18652         FREE(untag_ptr(_res));
18653         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
18654 }
18655
18656 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
18657         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18658         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
18659         return tag_ptr(ret_conv, true);
18660 }
18661 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(int64_t arg) {
18662         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
18663         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
18664         return ret_conv;
18665 }
18666
18667 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(int64_t orig) {
18668         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
18669         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18670         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
18671         return tag_ptr(ret_conv, true);
18672 }
18673
18674 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_ok(int64_t o) {
18675         LDKInMemorySigner o_conv;
18676         o_conv.inner = untag_ptr(o);
18677         o_conv.is_owned = ptr_is_owned(o);
18678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18679         o_conv = InMemorySigner_clone(&o_conv);
18680         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18681         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18682         return tag_ptr(ret_conv, true);
18683 }
18684
18685 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_err(int64_t e) {
18686         void* e_ptr = untag_ptr(e);
18687         CHECK_ACCESS(e_ptr);
18688         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18689         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18690         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18691         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18692         return tag_ptr(ret_conv, true);
18693 }
18694
18695 jboolean  CS_LDK_CResult_InMemorySignerDecodeErrorZ_is_ok(int64_t o) {
18696         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
18697         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18698         return ret_conv;
18699 }
18700
18701 void  CS_LDK_CResult_InMemorySignerDecodeErrorZ_free(int64_t _res) {
18702         if (!ptr_is_owned(_res)) return;
18703         void* _res_ptr = untag_ptr(_res);
18704         CHECK_ACCESS(_res_ptr);
18705         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18706         FREE(untag_ptr(_res));
18707         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18708 }
18709
18710 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18711         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18712         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18713         return tag_ptr(ret_conv, true);
18714 }
18715 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone_ptr(int64_t arg) {
18716         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
18717         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18718         return ret_conv;
18719 }
18720
18721 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone(int64_t orig) {
18722         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
18723         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18724         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18725         return tag_ptr(ret_conv, true);
18726 }
18727
18728 int64_t  CS_LDK_CResult_TransactionNoneZ_ok(int8_tArray o) {
18729         LDKTransaction o_ref;
18730         o_ref.datalen = o->arr_len;
18731         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18732         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18733         o_ref.data_is_owned = true;
18734         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18735         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18736         return tag_ptr(ret_conv, true);
18737 }
18738
18739 int64_t  CS_LDK_CResult_TransactionNoneZ_err() {
18740         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18741         *ret_conv = CResult_TransactionNoneZ_err();
18742         return tag_ptr(ret_conv, true);
18743 }
18744
18745 jboolean  CS_LDK_CResult_TransactionNoneZ_is_ok(int64_t o) {
18746         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
18747         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18748         return ret_conv;
18749 }
18750
18751 void  CS_LDK_CResult_TransactionNoneZ_free(int64_t _res) {
18752         if (!ptr_is_owned(_res)) return;
18753         void* _res_ptr = untag_ptr(_res);
18754         CHECK_ACCESS(_res_ptr);
18755         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18756         FREE(untag_ptr(_res));
18757         CResult_TransactionNoneZ_free(_res_conv);
18758 }
18759
18760 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18761         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18762         *ret_conv = CResult_TransactionNoneZ_clone(arg);
18763         return tag_ptr(ret_conv, true);
18764 }
18765 int64_t  CS_LDK_CResult_TransactionNoneZ_clone_ptr(int64_t arg) {
18766         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
18767         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18768         return ret_conv;
18769 }
18770
18771 int64_t  CS_LDK_CResult_TransactionNoneZ_clone(int64_t orig) {
18772         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
18773         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18774         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18775         return tag_ptr(ret_conv, true);
18776 }
18777
18778 int64_t  CS_LDK_COption_WriteableScoreZ_some(int64_t o) {
18779         void* o_ptr = untag_ptr(o);
18780         CHECK_ACCESS(o_ptr);
18781         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
18782         if (o_conv.free == LDKWriteableScore_JCalls_free) {
18783                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18784                 LDKWriteableScore_JCalls_cloned(&o_conv);
18785         }
18786         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
18787         *ret_copy = COption_WriteableScoreZ_some(o_conv);
18788         int64_t ret_ref = tag_ptr(ret_copy, true);
18789         return ret_ref;
18790 }
18791
18792 int64_t  CS_LDK_COption_WriteableScoreZ_none() {
18793         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
18794         *ret_copy = COption_WriteableScoreZ_none();
18795         int64_t ret_ref = tag_ptr(ret_copy, true);
18796         return ret_ref;
18797 }
18798
18799 void  CS_LDK_COption_WriteableScoreZ_free(int64_t _res) {
18800         if (!ptr_is_owned(_res)) return;
18801         void* _res_ptr = untag_ptr(_res);
18802         CHECK_ACCESS(_res_ptr);
18803         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
18804         FREE(untag_ptr(_res));
18805         COption_WriteableScoreZ_free(_res_conv);
18806 }
18807
18808 int64_t  CS_LDK_CResult_NoneIOErrorZ_ok() {
18809         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18810         *ret_conv = CResult_NoneIOErrorZ_ok();
18811         return tag_ptr(ret_conv, true);
18812 }
18813
18814 int64_t  CS_LDK_CResult_NoneIOErrorZ_err(int32_t e) {
18815         LDKIOError e_conv = LDKIOError_from_cs(e);
18816         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18817         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
18818         return tag_ptr(ret_conv, true);
18819 }
18820
18821 jboolean  CS_LDK_CResult_NoneIOErrorZ_is_ok(int64_t o) {
18822         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
18823         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
18824         return ret_conv;
18825 }
18826
18827 void  CS_LDK_CResult_NoneIOErrorZ_free(int64_t _res) {
18828         if (!ptr_is_owned(_res)) return;
18829         void* _res_ptr = untag_ptr(_res);
18830         CHECK_ACCESS(_res_ptr);
18831         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
18832         FREE(untag_ptr(_res));
18833         CResult_NoneIOErrorZ_free(_res_conv);
18834 }
18835
18836 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
18837         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18838         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
18839         return tag_ptr(ret_conv, true);
18840 }
18841 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone_ptr(int64_t arg) {
18842         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
18843         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
18844         return ret_conv;
18845 }
18846
18847 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone(int64_t orig) {
18848         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
18849         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18850         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
18851         return tag_ptr(ret_conv, true);
18852 }
18853
18854 void  CS_LDK_CVec_ChannelDetailsZ_free(int64_tArray _res) {
18855         LDKCVec_ChannelDetailsZ _res_constr;
18856         _res_constr.datalen = _res->arr_len;
18857         if (_res_constr.datalen > 0)
18858                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18859         else
18860                 _res_constr.data = NULL;
18861         int64_t* _res_vals = _res->elems;
18862         for (size_t q = 0; q < _res_constr.datalen; q++) {
18863                 int64_t _res_conv_16 = _res_vals[q];
18864                 LDKChannelDetails _res_conv_16_conv;
18865                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18866                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18867                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18868                 _res_constr.data[q] = _res_conv_16_conv;
18869         }
18870         FREE(_res);
18871         CVec_ChannelDetailsZ_free(_res_constr);
18872 }
18873
18874 int64_t  CS_LDK_CResult_RouteLightningErrorZ_ok(int64_t o) {
18875         LDKRoute o_conv;
18876         o_conv.inner = untag_ptr(o);
18877         o_conv.is_owned = ptr_is_owned(o);
18878         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18879         o_conv = Route_clone(&o_conv);
18880         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18881         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
18882         return tag_ptr(ret_conv, true);
18883 }
18884
18885 int64_t  CS_LDK_CResult_RouteLightningErrorZ_err(int64_t e) {
18886         LDKLightningError e_conv;
18887         e_conv.inner = untag_ptr(e);
18888         e_conv.is_owned = ptr_is_owned(e);
18889         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18890         e_conv = LightningError_clone(&e_conv);
18891         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18892         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
18893         return tag_ptr(ret_conv, true);
18894 }
18895
18896 jboolean  CS_LDK_CResult_RouteLightningErrorZ_is_ok(int64_t o) {
18897         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
18898         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
18899         return ret_conv;
18900 }
18901
18902 void  CS_LDK_CResult_RouteLightningErrorZ_free(int64_t _res) {
18903         if (!ptr_is_owned(_res)) return;
18904         void* _res_ptr = untag_ptr(_res);
18905         CHECK_ACCESS(_res_ptr);
18906         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
18907         FREE(untag_ptr(_res));
18908         CResult_RouteLightningErrorZ_free(_res_conv);
18909 }
18910
18911 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
18912         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18913         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
18914         return tag_ptr(ret_conv, true);
18915 }
18916 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone_ptr(int64_t arg) {
18917         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
18918         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
18919         return ret_conv;
18920 }
18921
18922 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone(int64_t orig) {
18923         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
18924         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18925         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
18926         return tag_ptr(ret_conv, true);
18927 }
18928
18929 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
18930         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18931         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
18932         return tag_ptr(ret_conv, true);
18933 }
18934 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(int64_t arg) {
18935         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
18936         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
18937         return ret_conv;
18938 }
18939
18940 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone(int64_t orig) {
18941         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
18942         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18943         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
18944         return tag_ptr(ret_conv, true);
18945 }
18946
18947 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_new(int64_t a, int64_t b) {
18948         LDKBlindedPayInfo a_conv;
18949         a_conv.inner = untag_ptr(a);
18950         a_conv.is_owned = ptr_is_owned(a);
18951         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18952         a_conv = BlindedPayInfo_clone(&a_conv);
18953         LDKBlindedPath b_conv;
18954         b_conv.inner = untag_ptr(b);
18955         b_conv.is_owned = ptr_is_owned(b);
18956         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18957         b_conv = BlindedPath_clone(&b_conv);
18958         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18959         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
18960         return tag_ptr(ret_conv, true);
18961 }
18962
18963 void  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_free(int64_t _res) {
18964         if (!ptr_is_owned(_res)) return;
18965         void* _res_ptr = untag_ptr(_res);
18966         CHECK_ACCESS(_res_ptr);
18967         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
18968         FREE(untag_ptr(_res));
18969         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
18970 }
18971
18972 void  CS_LDK_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(int64_tArray _res) {
18973         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
18974         _res_constr.datalen = _res->arr_len;
18975         if (_res_constr.datalen > 0)
18976                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18977         else
18978                 _res_constr.data = NULL;
18979         int64_t* _res_vals = _res->elems;
18980         for (size_t l = 0; l < _res_constr.datalen; l++) {
18981                 int64_t _res_conv_37 = _res_vals[l];
18982                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
18983                 CHECK_ACCESS(_res_conv_37_ptr);
18984                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
18985                 FREE(untag_ptr(_res_conv_37));
18986                 _res_constr.data[l] = _res_conv_37_conv;
18987         }
18988         FREE(_res);
18989         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
18990 }
18991
18992 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(int64_tArray o) {
18993         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
18994         o_constr.datalen = o->arr_len;
18995         if (o_constr.datalen > 0)
18996                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18997         else
18998                 o_constr.data = NULL;
18999         int64_t* o_vals = o->elems;
19000         for (size_t l = 0; l < o_constr.datalen; l++) {
19001                 int64_t o_conv_37 = o_vals[l];
19002                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
19003                 CHECK_ACCESS(o_conv_37_ptr);
19004                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
19005                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
19006                 o_constr.data[l] = o_conv_37_conv;
19007         }
19008         FREE(o);
19009         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19010         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
19011         return tag_ptr(ret_conv, true);
19012 }
19013
19014 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
19015         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19016         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
19017         return tag_ptr(ret_conv, true);
19018 }
19019
19020 jboolean  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(int64_t o) {
19021         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
19022         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
19023         return ret_conv;
19024 }
19025
19026 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(int64_t _res) {
19027         if (!ptr_is_owned(_res)) return;
19028         void* _res_ptr = untag_ptr(_res);
19029         CHECK_ACCESS(_res_ptr);
19030         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
19031         FREE(untag_ptr(_res));
19032         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
19033 }
19034
19035 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
19036         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19037         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
19038         return tag_ptr(ret_conv, true);
19039 }
19040 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(int64_t arg) {
19041         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
19042         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
19043         return ret_conv;
19044 }
19045
19046 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(int64_t orig) {
19047         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
19048         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19049         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
19050         return tag_ptr(ret_conv, true);
19051 }
19052
19053 void  CS_LDK_CVec_PublicKeyZ_free(ptrArray _res) {
19054         LDKCVec_PublicKeyZ _res_constr;
19055         _res_constr.datalen = _res->arr_len;
19056         if (_res_constr.datalen > 0)
19057                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
19058         else
19059                 _res_constr.data = NULL;
19060         int8_tArray* _res_vals = (void*) _res->elems;
19061         for (size_t i = 0; i < _res_constr.datalen; i++) {
19062                 int8_tArray _res_conv_8 = _res_vals[i];
19063                 LDKPublicKey _res_conv_8_ref;
19064                 CHECK(_res_conv_8->arr_len == 33);
19065                 memcpy(_res_conv_8_ref.compressed_form, _res_conv_8->elems, 33); FREE(_res_conv_8);
19066                 _res_constr.data[i] = _res_conv_8_ref;
19067         }
19068         FREE(_res);
19069         CVec_PublicKeyZ_free(_res_constr);
19070 }
19071
19072 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_ok(int64_t o) {
19073         LDKOnionMessagePath o_conv;
19074         o_conv.inner = untag_ptr(o);
19075         o_conv.is_owned = ptr_is_owned(o);
19076         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19077         o_conv = OnionMessagePath_clone(&o_conv);
19078         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19079         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
19080         return tag_ptr(ret_conv, true);
19081 }
19082
19083 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_err() {
19084         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19085         *ret_conv = CResult_OnionMessagePathNoneZ_err();
19086         return tag_ptr(ret_conv, true);
19087 }
19088
19089 jboolean  CS_LDK_CResult_OnionMessagePathNoneZ_is_ok(int64_t o) {
19090         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
19091         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
19092         return ret_conv;
19093 }
19094
19095 void  CS_LDK_CResult_OnionMessagePathNoneZ_free(int64_t _res) {
19096         if (!ptr_is_owned(_res)) return;
19097         void* _res_ptr = untag_ptr(_res);
19098         CHECK_ACCESS(_res_ptr);
19099         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
19100         FREE(untag_ptr(_res));
19101         CResult_OnionMessagePathNoneZ_free(_res_conv);
19102 }
19103
19104 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
19105         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19106         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
19107         return tag_ptr(ret_conv, true);
19108 }
19109 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone_ptr(int64_t arg) {
19110         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
19111         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
19112         return ret_conv;
19113 }
19114
19115 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone(int64_t orig) {
19116         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
19117         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19118         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
19119         return tag_ptr(ret_conv, true);
19120 }
19121
19122 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_ok(int64_tArray o) {
19123         LDKCVec_BlindedPathZ o_constr;
19124         o_constr.datalen = o->arr_len;
19125         if (o_constr.datalen > 0)
19126                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
19127         else
19128                 o_constr.data = NULL;
19129         int64_t* o_vals = o->elems;
19130         for (size_t n = 0; n < o_constr.datalen; n++) {
19131                 int64_t o_conv_13 = o_vals[n];
19132                 LDKBlindedPath o_conv_13_conv;
19133                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
19134                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
19135                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
19136                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
19137                 o_constr.data[n] = o_conv_13_conv;
19138         }
19139         FREE(o);
19140         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19141         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
19142         return tag_ptr(ret_conv, true);
19143 }
19144
19145 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_err() {
19146         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19147         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
19148         return tag_ptr(ret_conv, true);
19149 }
19150
19151 jboolean  CS_LDK_CResult_CVec_BlindedPathZNoneZ_is_ok(int64_t o) {
19152         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
19153         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
19154         return ret_conv;
19155 }
19156
19157 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_free(int64_t _res) {
19158         if (!ptr_is_owned(_res)) return;
19159         void* _res_ptr = untag_ptr(_res);
19160         CHECK_ACCESS(_res_ptr);
19161         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
19162         FREE(untag_ptr(_res));
19163         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
19164 }
19165
19166 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
19167         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19168         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
19169         return tag_ptr(ret_conv, true);
19170 }
19171 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone_ptr(int64_t arg) {
19172         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
19173         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
19174         return ret_conv;
19175 }
19176
19177 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone(int64_t orig) {
19178         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
19179         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19180         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
19181         return tag_ptr(ret_conv, true);
19182 }
19183
19184 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_ok(int64_t o) {
19185         LDKInFlightHtlcs o_conv;
19186         o_conv.inner = untag_ptr(o);
19187         o_conv.is_owned = ptr_is_owned(o);
19188         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19189         o_conv = InFlightHtlcs_clone(&o_conv);
19190         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19191         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
19192         return tag_ptr(ret_conv, true);
19193 }
19194
19195 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_err(int64_t e) {
19196         void* e_ptr = untag_ptr(e);
19197         CHECK_ACCESS(e_ptr);
19198         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19199         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19200         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19201         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
19202         return tag_ptr(ret_conv, true);
19203 }
19204
19205 jboolean  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_is_ok(int64_t o) {
19206         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
19207         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
19208         return ret_conv;
19209 }
19210
19211 void  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_free(int64_t _res) {
19212         if (!ptr_is_owned(_res)) return;
19213         void* _res_ptr = untag_ptr(_res);
19214         CHECK_ACCESS(_res_ptr);
19215         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
19216         FREE(untag_ptr(_res));
19217         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
19218 }
19219
19220 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
19221         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19222         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
19223         return tag_ptr(ret_conv, true);
19224 }
19225 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(int64_t arg) {
19226         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
19227         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
19228         return ret_conv;
19229 }
19230
19231 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone(int64_t orig) {
19232         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
19233         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19234         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
19235         return tag_ptr(ret_conv, true);
19236 }
19237
19238 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_ok(int64_t o) {
19239         LDKRouteHop o_conv;
19240         o_conv.inner = untag_ptr(o);
19241         o_conv.is_owned = ptr_is_owned(o);
19242         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19243         o_conv = RouteHop_clone(&o_conv);
19244         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19245         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
19246         return tag_ptr(ret_conv, true);
19247 }
19248
19249 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_err(int64_t e) {
19250         void* e_ptr = untag_ptr(e);
19251         CHECK_ACCESS(e_ptr);
19252         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19253         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19254         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19255         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
19256         return tag_ptr(ret_conv, true);
19257 }
19258
19259 jboolean  CS_LDK_CResult_RouteHopDecodeErrorZ_is_ok(int64_t o) {
19260         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
19261         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
19262         return ret_conv;
19263 }
19264
19265 void  CS_LDK_CResult_RouteHopDecodeErrorZ_free(int64_t _res) {
19266         if (!ptr_is_owned(_res)) return;
19267         void* _res_ptr = untag_ptr(_res);
19268         CHECK_ACCESS(_res_ptr);
19269         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
19270         FREE(untag_ptr(_res));
19271         CResult_RouteHopDecodeErrorZ_free(_res_conv);
19272 }
19273
19274 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
19275         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19276         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
19277         return tag_ptr(ret_conv, true);
19278 }
19279 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone_ptr(int64_t arg) {
19280         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
19281         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
19282         return ret_conv;
19283 }
19284
19285 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone(int64_t orig) {
19286         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
19287         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19288         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
19289         return tag_ptr(ret_conv, true);
19290 }
19291
19292 void  CS_LDK_CVec_BlindedHopZ_free(int64_tArray _res) {
19293         LDKCVec_BlindedHopZ _res_constr;
19294         _res_constr.datalen = _res->arr_len;
19295         if (_res_constr.datalen > 0)
19296                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
19297         else
19298                 _res_constr.data = NULL;
19299         int64_t* _res_vals = _res->elems;
19300         for (size_t m = 0; m < _res_constr.datalen; m++) {
19301                 int64_t _res_conv_12 = _res_vals[m];
19302                 LDKBlindedHop _res_conv_12_conv;
19303                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
19304                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
19305                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
19306                 _res_constr.data[m] = _res_conv_12_conv;
19307         }
19308         FREE(_res);
19309         CVec_BlindedHopZ_free(_res_constr);
19310 }
19311
19312 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_ok(int64_t o) {
19313         LDKBlindedTail o_conv;
19314         o_conv.inner = untag_ptr(o);
19315         o_conv.is_owned = ptr_is_owned(o);
19316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19317         o_conv = BlindedTail_clone(&o_conv);
19318         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19319         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
19320         return tag_ptr(ret_conv, true);
19321 }
19322
19323 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_err(int64_t e) {
19324         void* e_ptr = untag_ptr(e);
19325         CHECK_ACCESS(e_ptr);
19326         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19327         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19328         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19329         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
19330         return tag_ptr(ret_conv, true);
19331 }
19332
19333 jboolean  CS_LDK_CResult_BlindedTailDecodeErrorZ_is_ok(int64_t o) {
19334         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
19335         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
19336         return ret_conv;
19337 }
19338
19339 void  CS_LDK_CResult_BlindedTailDecodeErrorZ_free(int64_t _res) {
19340         if (!ptr_is_owned(_res)) return;
19341         void* _res_ptr = untag_ptr(_res);
19342         CHECK_ACCESS(_res_ptr);
19343         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
19344         FREE(untag_ptr(_res));
19345         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
19346 }
19347
19348 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
19349         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19350         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
19351         return tag_ptr(ret_conv, true);
19352 }
19353 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone_ptr(int64_t arg) {
19354         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
19355         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
19356         return ret_conv;
19357 }
19358
19359 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone(int64_t orig) {
19360         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
19361         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19362         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
19363         return tag_ptr(ret_conv, true);
19364 }
19365
19366 void  CS_LDK_CVec_RouteHopZ_free(int64_tArray _res) {
19367         LDKCVec_RouteHopZ _res_constr;
19368         _res_constr.datalen = _res->arr_len;
19369         if (_res_constr.datalen > 0)
19370                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19371         else
19372                 _res_constr.data = NULL;
19373         int64_t* _res_vals = _res->elems;
19374         for (size_t k = 0; k < _res_constr.datalen; k++) {
19375                 int64_t _res_conv_10 = _res_vals[k];
19376                 LDKRouteHop _res_conv_10_conv;
19377                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
19378                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
19379                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19380                 _res_constr.data[k] = _res_conv_10_conv;
19381         }
19382         FREE(_res);
19383         CVec_RouteHopZ_free(_res_constr);
19384 }
19385
19386 void  CS_LDK_CVec_PathZ_free(int64_tArray _res) {
19387         LDKCVec_PathZ _res_constr;
19388         _res_constr.datalen = _res->arr_len;
19389         if (_res_constr.datalen > 0)
19390                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
19391         else
19392                 _res_constr.data = NULL;
19393         int64_t* _res_vals = _res->elems;
19394         for (size_t g = 0; g < _res_constr.datalen; g++) {
19395                 int64_t _res_conv_6 = _res_vals[g];
19396                 LDKPath _res_conv_6_conv;
19397                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
19398                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
19399                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
19400                 _res_constr.data[g] = _res_conv_6_conv;
19401         }
19402         FREE(_res);
19403         CVec_PathZ_free(_res_constr);
19404 }
19405
19406 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_ok(int64_t o) {
19407         LDKRoute o_conv;
19408         o_conv.inner = untag_ptr(o);
19409         o_conv.is_owned = ptr_is_owned(o);
19410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19411         o_conv = Route_clone(&o_conv);
19412         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19413         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
19414         return tag_ptr(ret_conv, true);
19415 }
19416
19417 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_err(int64_t e) {
19418         void* e_ptr = untag_ptr(e);
19419         CHECK_ACCESS(e_ptr);
19420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19422         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19423         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
19424         return tag_ptr(ret_conv, true);
19425 }
19426
19427 jboolean  CS_LDK_CResult_RouteDecodeErrorZ_is_ok(int64_t o) {
19428         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
19429         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
19430         return ret_conv;
19431 }
19432
19433 void  CS_LDK_CResult_RouteDecodeErrorZ_free(int64_t _res) {
19434         if (!ptr_is_owned(_res)) return;
19435         void* _res_ptr = untag_ptr(_res);
19436         CHECK_ACCESS(_res_ptr);
19437         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
19438         FREE(untag_ptr(_res));
19439         CResult_RouteDecodeErrorZ_free(_res_conv);
19440 }
19441
19442 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
19443         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19444         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
19445         return tag_ptr(ret_conv, true);
19446 }
19447 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone_ptr(int64_t arg) {
19448         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
19449         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
19450         return ret_conv;
19451 }
19452
19453 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone(int64_t orig) {
19454         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
19455         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19456         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
19457         return tag_ptr(ret_conv, true);
19458 }
19459
19460 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_ok(int64_t o) {
19461         LDKRouteParameters o_conv;
19462         o_conv.inner = untag_ptr(o);
19463         o_conv.is_owned = ptr_is_owned(o);
19464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19465         o_conv = RouteParameters_clone(&o_conv);
19466         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19467         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
19468         return tag_ptr(ret_conv, true);
19469 }
19470
19471 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_err(int64_t e) {
19472         void* e_ptr = untag_ptr(e);
19473         CHECK_ACCESS(e_ptr);
19474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19476         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19477         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
19478         return tag_ptr(ret_conv, true);
19479 }
19480
19481 jboolean  CS_LDK_CResult_RouteParametersDecodeErrorZ_is_ok(int64_t o) {
19482         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
19483         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
19484         return ret_conv;
19485 }
19486
19487 void  CS_LDK_CResult_RouteParametersDecodeErrorZ_free(int64_t _res) {
19488         if (!ptr_is_owned(_res)) return;
19489         void* _res_ptr = untag_ptr(_res);
19490         CHECK_ACCESS(_res_ptr);
19491         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
19492         FREE(untag_ptr(_res));
19493         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
19494 }
19495
19496 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
19497         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19498         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
19499         return tag_ptr(ret_conv, true);
19500 }
19501 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone_ptr(int64_t arg) {
19502         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
19503         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
19504         return ret_conv;
19505 }
19506
19507 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone(int64_t orig) {
19508         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
19509         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19510         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
19511         return tag_ptr(ret_conv, true);
19512 }
19513
19514 void  CS_LDK_CVec_u64Z_free(int64_tArray _res) {
19515         LDKCVec_u64Z _res_constr;
19516         _res_constr.datalen = _res->arr_len;
19517         if (_res_constr.datalen > 0)
19518                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19519         else
19520                 _res_constr.data = NULL;
19521         int64_t* _res_vals = _res->elems;
19522         for (size_t g = 0; g < _res_constr.datalen; g++) {
19523                 int64_t _res_conv_6 = _res_vals[g];
19524                 _res_constr.data[g] = _res_conv_6;
19525         }
19526         FREE(_res);
19527         CVec_u64Z_free(_res_constr);
19528 }
19529
19530 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_ok(int64_t o) {
19531         LDKPaymentParameters o_conv;
19532         o_conv.inner = untag_ptr(o);
19533         o_conv.is_owned = ptr_is_owned(o);
19534         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19535         o_conv = PaymentParameters_clone(&o_conv);
19536         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19537         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
19538         return tag_ptr(ret_conv, true);
19539 }
19540
19541 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_err(int64_t e) {
19542         void* e_ptr = untag_ptr(e);
19543         CHECK_ACCESS(e_ptr);
19544         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19545         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19546         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19547         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
19548         return tag_ptr(ret_conv, true);
19549 }
19550
19551 jboolean  CS_LDK_CResult_PaymentParametersDecodeErrorZ_is_ok(int64_t o) {
19552         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
19553         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
19554         return ret_conv;
19555 }
19556
19557 void  CS_LDK_CResult_PaymentParametersDecodeErrorZ_free(int64_t _res) {
19558         if (!ptr_is_owned(_res)) return;
19559         void* _res_ptr = untag_ptr(_res);
19560         CHECK_ACCESS(_res_ptr);
19561         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
19562         FREE(untag_ptr(_res));
19563         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
19564 }
19565
19566 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
19567         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19568         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
19569         return tag_ptr(ret_conv, true);
19570 }
19571 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone_ptr(int64_t arg) {
19572         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
19573         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
19574         return ret_conv;
19575 }
19576
19577 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone(int64_t orig) {
19578         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
19579         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19580         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
19581         return tag_ptr(ret_conv, true);
19582 }
19583
19584 void  CS_LDK_CVec_RouteHintZ_free(int64_tArray _res) {
19585         LDKCVec_RouteHintZ _res_constr;
19586         _res_constr.datalen = _res->arr_len;
19587         if (_res_constr.datalen > 0)
19588                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19589         else
19590                 _res_constr.data = NULL;
19591         int64_t* _res_vals = _res->elems;
19592         for (size_t l = 0; l < _res_constr.datalen; l++) {
19593                 int64_t _res_conv_11 = _res_vals[l];
19594                 LDKRouteHint _res_conv_11_conv;
19595                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
19596                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
19597                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
19598                 _res_constr.data[l] = _res_conv_11_conv;
19599         }
19600         FREE(_res);
19601         CVec_RouteHintZ_free(_res_constr);
19602 }
19603
19604 void  CS_LDK_CVec_RouteHintHopZ_free(int64_tArray _res) {
19605         LDKCVec_RouteHintHopZ _res_constr;
19606         _res_constr.datalen = _res->arr_len;
19607         if (_res_constr.datalen > 0)
19608                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
19609         else
19610                 _res_constr.data = NULL;
19611         int64_t* _res_vals = _res->elems;
19612         for (size_t o = 0; o < _res_constr.datalen; o++) {
19613                 int64_t _res_conv_14 = _res_vals[o];
19614                 LDKRouteHintHop _res_conv_14_conv;
19615                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19616                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19617                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19618                 _res_constr.data[o] = _res_conv_14_conv;
19619         }
19620         FREE(_res);
19621         CVec_RouteHintHopZ_free(_res_constr);
19622 }
19623
19624 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_ok(int64_t o) {
19625         LDKRouteHint o_conv;
19626         o_conv.inner = untag_ptr(o);
19627         o_conv.is_owned = ptr_is_owned(o);
19628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19629         o_conv = RouteHint_clone(&o_conv);
19630         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19631         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
19632         return tag_ptr(ret_conv, true);
19633 }
19634
19635 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_err(int64_t e) {
19636         void* e_ptr = untag_ptr(e);
19637         CHECK_ACCESS(e_ptr);
19638         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19639         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19640         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19641         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
19642         return tag_ptr(ret_conv, true);
19643 }
19644
19645 jboolean  CS_LDK_CResult_RouteHintDecodeErrorZ_is_ok(int64_t o) {
19646         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
19647         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
19648         return ret_conv;
19649 }
19650
19651 void  CS_LDK_CResult_RouteHintDecodeErrorZ_free(int64_t _res) {
19652         if (!ptr_is_owned(_res)) return;
19653         void* _res_ptr = untag_ptr(_res);
19654         CHECK_ACCESS(_res_ptr);
19655         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
19656         FREE(untag_ptr(_res));
19657         CResult_RouteHintDecodeErrorZ_free(_res_conv);
19658 }
19659
19660 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
19661         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19662         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
19663         return tag_ptr(ret_conv, true);
19664 }
19665 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone_ptr(int64_t arg) {
19666         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
19667         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
19668         return ret_conv;
19669 }
19670
19671 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone(int64_t orig) {
19672         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
19673         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19674         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
19675         return tag_ptr(ret_conv, true);
19676 }
19677
19678 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_ok(int64_t o) {
19679         LDKRouteHintHop o_conv;
19680         o_conv.inner = untag_ptr(o);
19681         o_conv.is_owned = ptr_is_owned(o);
19682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19683         o_conv = RouteHintHop_clone(&o_conv);
19684         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19685         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
19686         return tag_ptr(ret_conv, true);
19687 }
19688
19689 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_err(int64_t e) {
19690         void* e_ptr = untag_ptr(e);
19691         CHECK_ACCESS(e_ptr);
19692         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19693         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19694         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19695         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
19696         return tag_ptr(ret_conv, true);
19697 }
19698
19699 jboolean  CS_LDK_CResult_RouteHintHopDecodeErrorZ_is_ok(int64_t o) {
19700         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
19701         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
19702         return ret_conv;
19703 }
19704
19705 void  CS_LDK_CResult_RouteHintHopDecodeErrorZ_free(int64_t _res) {
19706         if (!ptr_is_owned(_res)) return;
19707         void* _res_ptr = untag_ptr(_res);
19708         CHECK_ACCESS(_res_ptr);
19709         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
19710         FREE(untag_ptr(_res));
19711         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
19712 }
19713
19714 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
19715         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19716         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
19717         return tag_ptr(ret_conv, true);
19718 }
19719 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone_ptr(int64_t arg) {
19720         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
19721         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
19722         return ret_conv;
19723 }
19724
19725 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone(int64_t orig) {
19726         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
19727         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19728         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
19729         return tag_ptr(ret_conv, true);
19730 }
19731
19732 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_ok(int64_t o) {
19733         LDKFixedPenaltyScorer o_conv;
19734         o_conv.inner = untag_ptr(o);
19735         o_conv.is_owned = ptr_is_owned(o);
19736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19737         o_conv = FixedPenaltyScorer_clone(&o_conv);
19738         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19739         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
19740         return tag_ptr(ret_conv, true);
19741 }
19742
19743 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_err(int64_t e) {
19744         void* e_ptr = untag_ptr(e);
19745         CHECK_ACCESS(e_ptr);
19746         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19747         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19748         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19749         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
19750         return tag_ptr(ret_conv, true);
19751 }
19752
19753 jboolean  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(int64_t o) {
19754         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
19755         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
19756         return ret_conv;
19757 }
19758
19759 void  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_free(int64_t _res) {
19760         if (!ptr_is_owned(_res)) return;
19761         void* _res_ptr = untag_ptr(_res);
19762         CHECK_ACCESS(_res_ptr);
19763         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
19764         FREE(untag_ptr(_res));
19765         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
19766 }
19767
19768 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
19769         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19770         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
19771         return tag_ptr(ret_conv, true);
19772 }
19773 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(int64_t arg) {
19774         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
19775         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
19776         return ret_conv;
19777 }
19778
19779 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone(int64_t orig) {
19780         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
19781         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19782         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
19783         return tag_ptr(ret_conv, true);
19784 }
19785
19786 void  CS_LDK_CVec_NodeIdZ_free(int64_tArray _res) {
19787         LDKCVec_NodeIdZ _res_constr;
19788         _res_constr.datalen = _res->arr_len;
19789         if (_res_constr.datalen > 0)
19790                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
19791         else
19792                 _res_constr.data = NULL;
19793         int64_t* _res_vals = _res->elems;
19794         for (size_t i = 0; i < _res_constr.datalen; i++) {
19795                 int64_t _res_conv_8 = _res_vals[i];
19796                 LDKNodeId _res_conv_8_conv;
19797                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
19798                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
19799                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
19800                 _res_constr.data[i] = _res_conv_8_conv;
19801         }
19802         FREE(_res);
19803         CVec_NodeIdZ_free(_res_constr);
19804 }
19805
19806 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
19807         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19808         *ret_conv = C2Tuple_u64u64Z_clone(arg);
19809         return tag_ptr(ret_conv, true);
19810 }
19811 int64_t  CS_LDK_C2Tuple_u64u64Z_clone_ptr(int64_t arg) {
19812         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
19813         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
19814         return ret_conv;
19815 }
19816
19817 int64_t  CS_LDK_C2Tuple_u64u64Z_clone(int64_t orig) {
19818         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
19819         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19820         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
19821         return tag_ptr(ret_conv, true);
19822 }
19823
19824 int64_t  CS_LDK_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
19825         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19826         *ret_conv = C2Tuple_u64u64Z_new(a, b);
19827         return tag_ptr(ret_conv, true);
19828 }
19829
19830 void  CS_LDK_C2Tuple_u64u64Z_free(int64_t _res) {
19831         if (!ptr_is_owned(_res)) return;
19832         void* _res_ptr = untag_ptr(_res);
19833         CHECK_ACCESS(_res_ptr);
19834         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
19835         FREE(untag_ptr(_res));
19836         C2Tuple_u64u64Z_free(_res_conv);
19837 }
19838
19839 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_some(int64_t o) {
19840         void* o_ptr = untag_ptr(o);
19841         CHECK_ACCESS(o_ptr);
19842         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
19843         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
19844         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19845         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
19846         int64_t ret_ref = tag_ptr(ret_copy, true);
19847         return ret_ref;
19848 }
19849
19850 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_none() {
19851         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19852         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
19853         int64_t ret_ref = tag_ptr(ret_copy, true);
19854         return ret_ref;
19855 }
19856
19857 void  CS_LDK_COption_C2Tuple_u64u64ZZ_free(int64_t _res) {
19858         if (!ptr_is_owned(_res)) return;
19859         void* _res_ptr = untag_ptr(_res);
19860         CHECK_ACCESS(_res_ptr);
19861         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
19862         FREE(untag_ptr(_res));
19863         COption_C2Tuple_u64u64ZZ_free(_res_conv);
19864 }
19865
19866 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
19867         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19868         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
19869         int64_t ret_ref = tag_ptr(ret_copy, true);
19870         return ret_ref;
19871 }
19872 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone_ptr(int64_t arg) {
19873         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
19874         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
19875         return ret_conv;
19876 }
19877
19878 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone(int64_t orig) {
19879         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
19880         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19881         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
19882         int64_t ret_ref = tag_ptr(ret_copy, true);
19883         return ret_ref;
19884 }
19885
19886 int64_t  CS_LDK_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
19887         LDKThirtyTwoU16s a_ref;
19888         CHECK(a->arr_len == 32);
19889         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19890         LDKThirtyTwoU16s b_ref;
19891         CHECK(b->arr_len == 32);
19892         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19893         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
19894         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
19895         return tag_ptr(ret_conv, true);
19896 }
19897
19898 void  CS_LDK_C2Tuple_Z_free(int64_t _res) {
19899         if (!ptr_is_owned(_res)) return;
19900         void* _res_ptr = untag_ptr(_res);
19901         CHECK_ACCESS(_res_ptr);
19902         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
19903         FREE(untag_ptr(_res));
19904         C2Tuple_Z_free(_res_conv);
19905 }
19906
19907 int64_t  CS_LDK_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
19908         LDKThirtyTwoU16s a_ref;
19909         CHECK(a->arr_len == 32);
19910         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19911         LDKThirtyTwoU16s b_ref;
19912         CHECK(b->arr_len == 32);
19913         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19914         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
19915         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
19916         return tag_ptr(ret_conv, true);
19917 }
19918
19919 void  CS_LDK_C2Tuple__u1632_u1632Z_free(int64_t _res) {
19920         if (!ptr_is_owned(_res)) return;
19921         void* _res_ptr = untag_ptr(_res);
19922         CHECK_ACCESS(_res_ptr);
19923         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
19924         FREE(untag_ptr(_res));
19925         C2Tuple__u1632_u1632Z_free(_res_conv);
19926 }
19927
19928 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(int64_t o) {
19929         void* o_ptr = untag_ptr(o);
19930         CHECK_ACCESS(o_ptr);
19931         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
19932         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
19933         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19934         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
19935         int64_t ret_ref = tag_ptr(ret_copy, true);
19936         return ret_ref;
19937 }
19938
19939 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
19940         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19941         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
19942         int64_t ret_ref = tag_ptr(ret_copy, true);
19943         return ret_ref;
19944 }
19945
19946 void  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(int64_t _res) {
19947         if (!ptr_is_owned(_res)) return;
19948         void* _res_ptr = untag_ptr(_res);
19949         CHECK_ACCESS(_res_ptr);
19950         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
19951         FREE(untag_ptr(_res));
19952         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
19953 }
19954
19955 int64_t  CS_LDK_COption_f64Z_some(double o) {
19956         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19957         *ret_copy = COption_f64Z_some(o);
19958         int64_t ret_ref = tag_ptr(ret_copy, true);
19959         return ret_ref;
19960 }
19961
19962 int64_t  CS_LDK_COption_f64Z_none() {
19963         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19964         *ret_copy = COption_f64Z_none();
19965         int64_t ret_ref = tag_ptr(ret_copy, true);
19966         return ret_ref;
19967 }
19968
19969 void  CS_LDK_COption_f64Z_free(int64_t _res) {
19970         if (!ptr_is_owned(_res)) return;
19971         void* _res_ptr = untag_ptr(_res);
19972         CHECK_ACCESS(_res_ptr);
19973         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
19974         FREE(untag_ptr(_res));
19975         COption_f64Z_free(_res_conv);
19976 }
19977
19978 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
19979         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19980         *ret_copy = COption_f64Z_clone(arg);
19981         int64_t ret_ref = tag_ptr(ret_copy, true);
19982         return ret_ref;
19983 }
19984 int64_t  CS_LDK_COption_f64Z_clone_ptr(int64_t arg) {
19985         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
19986         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
19987         return ret_conv;
19988 }
19989
19990 int64_t  CS_LDK_COption_f64Z_clone(int64_t orig) {
19991         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
19992         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19993         *ret_copy = COption_f64Z_clone(orig_conv);
19994         int64_t ret_ref = tag_ptr(ret_copy, true);
19995         return ret_ref;
19996 }
19997
19998 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_ok(int64_t o) {
19999         LDKProbabilisticScorer o_conv;
20000         o_conv.inner = untag_ptr(o);
20001         o_conv.is_owned = ptr_is_owned(o);
20002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20003         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
20004         
20005         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
20006         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
20007         return tag_ptr(ret_conv, true);
20008 }
20009
20010 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_err(int64_t e) {
20011         void* e_ptr = untag_ptr(e);
20012         CHECK_ACCESS(e_ptr);
20013         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20014         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20015         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
20016         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
20017         return tag_ptr(ret_conv, true);
20018 }
20019
20020 jboolean  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(int64_t o) {
20021         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
20022         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
20023         return ret_conv;
20024 }
20025
20026 void  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_free(int64_t _res) {
20027         if (!ptr_is_owned(_res)) return;
20028         void* _res_ptr = untag_ptr(_res);
20029         CHECK_ACCESS(_res_ptr);
20030         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
20031         FREE(untag_ptr(_res));
20032         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
20033 }
20034
20035 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
20036         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
20037         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
20038         return tag_ptr(ret_conv, true);
20039 }
20040 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone_ptr(int64_t arg) {
20041         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
20042         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
20043         return ret_conv;
20044 }
20045
20046 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone(int64_t orig) {
20047         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
20048         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
20049         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
20050         return tag_ptr(ret_conv, true);
20051 }
20052
20053 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
20054         LDKTransaction b_ref;
20055         b_ref.datalen = b->arr_len;
20056         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
20057         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
20058         b_ref.data_is_owned = true;
20059         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
20060         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
20061         return tag_ptr(ret_conv, true);
20062 }
20063
20064 void  CS_LDK_C2Tuple_usizeTransactionZ_free(int64_t _res) {
20065         if (!ptr_is_owned(_res)) return;
20066         void* _res_ptr = untag_ptr(_res);
20067         CHECK_ACCESS(_res_ptr);
20068         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
20069         FREE(untag_ptr(_res));
20070         C2Tuple_usizeTransactionZ_free(_res_conv);
20071 }
20072
20073 void  CS_LDK_CVec_C2Tuple_usizeTransactionZZ_free(int64_tArray _res) {
20074         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
20075         _res_constr.datalen = _res->arr_len;
20076         if (_res_constr.datalen > 0)
20077                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
20078         else
20079                 _res_constr.data = NULL;
20080         int64_t* _res_vals = _res->elems;
20081         for (size_t c = 0; c < _res_constr.datalen; c++) {
20082                 int64_t _res_conv_28 = _res_vals[c];
20083                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
20084                 CHECK_ACCESS(_res_conv_28_ptr);
20085                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
20086                 FREE(untag_ptr(_res_conv_28));
20087                 _res_constr.data[c] = _res_conv_28_conv;
20088         }
20089         FREE(_res);
20090         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
20091 }
20092
20093 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
20094         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
20095         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
20096         return tag_ptr(ret_conv, true);
20097 }
20098 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
20099         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
20100         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
20101         return ret_conv;
20102 }
20103
20104 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(int64_t orig) {
20105         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
20106         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
20107         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
20108         return tag_ptr(ret_conv, true);
20109 }
20110
20111 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, int64_t c) {
20112         LDKThirtyTwoBytes a_ref;
20113         CHECK(a->arr_len == 32);
20114         memcpy(a_ref.data, a->elems, 32); FREE(a);
20115         void* c_ptr = untag_ptr(c);
20116         CHECK_ACCESS(c_ptr);
20117         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
20118         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
20119         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
20120         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
20121         return tag_ptr(ret_conv, true);
20122 }
20123
20124 void  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(int64_t _res) {
20125         if (!ptr_is_owned(_res)) return;
20126         void* _res_ptr = untag_ptr(_res);
20127         CHECK_ACCESS(_res_ptr);
20128         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
20129         FREE(untag_ptr(_res));
20130         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
20131 }
20132
20133 void  CS_LDK_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(int64_tArray _res) {
20134         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
20135         _res_constr.datalen = _res->arr_len;
20136         if (_res_constr.datalen > 0)
20137                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
20138         else
20139                 _res_constr.data = NULL;
20140         int64_t* _res_vals = _res->elems;
20141         for (size_t c = 0; c < _res_constr.datalen; c++) {
20142                 int64_t _res_conv_54 = _res_vals[c];
20143                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
20144                 CHECK_ACCESS(_res_conv_54_ptr);
20145                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
20146                 FREE(untag_ptr(_res_conv_54));
20147                 _res_constr.data[c] = _res_conv_54_conv;
20148         }
20149         FREE(_res);
20150         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
20151 }
20152
20153 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_ok(int32_t o) {
20154         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_cs(o);
20155         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20156         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
20157         return tag_ptr(ret_conv, true);
20158 }
20159
20160 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
20161         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20162         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
20163         return tag_ptr(ret_conv, true);
20164 }
20165
20166 jboolean  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(int64_t o) {
20167         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
20168         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
20169         return ret_conv;
20170 }
20171
20172 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_free(int64_t _res) {
20173         if (!ptr_is_owned(_res)) return;
20174         void* _res_ptr = untag_ptr(_res);
20175         CHECK_ACCESS(_res_ptr);
20176         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
20177         FREE(untag_ptr(_res));
20178         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
20179 }
20180
20181 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
20182         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20183         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
20184         return tag_ptr(ret_conv, true);
20185 }
20186 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(int64_t arg) {
20187         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
20188         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
20189         return ret_conv;
20190 }
20191
20192 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone(int64_t orig) {
20193         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
20194         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20195         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
20196         return tag_ptr(ret_conv, true);
20197 }
20198
20199 void  CS_LDK_CVec_MonitorEventZ_free(int64_tArray _res) {
20200         LDKCVec_MonitorEventZ _res_constr;
20201         _res_constr.datalen = _res->arr_len;
20202         if (_res_constr.datalen > 0)
20203                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
20204         else
20205                 _res_constr.data = NULL;
20206         int64_t* _res_vals = _res->elems;
20207         for (size_t o = 0; o < _res_constr.datalen; o++) {
20208                 int64_t _res_conv_14 = _res_vals[o];
20209                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
20210                 CHECK_ACCESS(_res_conv_14_ptr);
20211                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
20212                 FREE(untag_ptr(_res_conv_14));
20213                 _res_constr.data[o] = _res_conv_14_conv;
20214         }
20215         FREE(_res);
20216         CVec_MonitorEventZ_free(_res_constr);
20217 }
20218
20219 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
20220         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
20221         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
20222         return tag_ptr(ret_conv, true);
20223 }
20224 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(int64_t arg) {
20225         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
20226         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
20227         return ret_conv;
20228 }
20229
20230 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(int64_t orig) {
20231         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
20232         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
20233         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
20234         return tag_ptr(ret_conv, true);
20235 }
20236
20237 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(int64_t a, int64_tArray b, int8_tArray c) {
20238         LDKOutPoint a_conv;
20239         a_conv.inner = untag_ptr(a);
20240         a_conv.is_owned = ptr_is_owned(a);
20241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20242         a_conv = OutPoint_clone(&a_conv);
20243         LDKCVec_MonitorEventZ b_constr;
20244         b_constr.datalen = b->arr_len;
20245         if (b_constr.datalen > 0)
20246                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
20247         else
20248                 b_constr.data = NULL;
20249         int64_t* b_vals = b->elems;
20250         for (size_t o = 0; o < b_constr.datalen; o++) {
20251                 int64_t b_conv_14 = b_vals[o];
20252                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
20253                 CHECK_ACCESS(b_conv_14_ptr);
20254                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
20255                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
20256                 b_constr.data[o] = b_conv_14_conv;
20257         }
20258         FREE(b);
20259         LDKPublicKey c_ref;
20260         CHECK(c->arr_len == 33);
20261         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
20262         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
20263         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
20264         return tag_ptr(ret_conv, true);
20265 }
20266
20267 void  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(int64_t _res) {
20268         if (!ptr_is_owned(_res)) return;
20269         void* _res_ptr = untag_ptr(_res);
20270         CHECK_ACCESS(_res_ptr);
20271         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
20272         FREE(untag_ptr(_res));
20273         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
20274 }
20275
20276 void  CS_LDK_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(int64_tArray _res) {
20277         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
20278         _res_constr.datalen = _res->arr_len;
20279         if (_res_constr.datalen > 0)
20280                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
20281         else
20282                 _res_constr.data = NULL;
20283         int64_t* _res_vals = _res->elems;
20284         for (size_t x = 0; x < _res_constr.datalen; x++) {
20285                 int64_t _res_conv_49 = _res_vals[x];
20286                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
20287                 CHECK_ACCESS(_res_conv_49_ptr);
20288                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
20289                 FREE(untag_ptr(_res_conv_49));
20290                 _res_constr.data[x] = _res_conv_49_conv;
20291         }
20292         FREE(_res);
20293         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
20294 }
20295
20296 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_ok(int64_t o) {
20297         LDKInitFeatures o_conv;
20298         o_conv.inner = untag_ptr(o);
20299         o_conv.is_owned = ptr_is_owned(o);
20300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20301         o_conv = InitFeatures_clone(&o_conv);
20302         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20303         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
20304         return tag_ptr(ret_conv, true);
20305 }
20306
20307 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_err(int64_t e) {
20308         void* e_ptr = untag_ptr(e);
20309         CHECK_ACCESS(e_ptr);
20310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20312         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20313         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
20314         return tag_ptr(ret_conv, true);
20315 }
20316
20317 jboolean  CS_LDK_CResult_InitFeaturesDecodeErrorZ_is_ok(int64_t o) {
20318         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
20319         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
20320         return ret_conv;
20321 }
20322
20323 void  CS_LDK_CResult_InitFeaturesDecodeErrorZ_free(int64_t _res) {
20324         if (!ptr_is_owned(_res)) return;
20325         void* _res_ptr = untag_ptr(_res);
20326         CHECK_ACCESS(_res_ptr);
20327         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
20328         FREE(untag_ptr(_res));
20329         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
20330 }
20331
20332 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20333         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20334         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
20335         return tag_ptr(ret_conv, true);
20336 }
20337 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20338         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
20339         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20340         return ret_conv;
20341 }
20342
20343 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone(int64_t orig) {
20344         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
20345         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20346         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
20347         return tag_ptr(ret_conv, true);
20348 }
20349
20350 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_ok(int64_t o) {
20351         LDKChannelFeatures o_conv;
20352         o_conv.inner = untag_ptr(o);
20353         o_conv.is_owned = ptr_is_owned(o);
20354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20355         o_conv = ChannelFeatures_clone(&o_conv);
20356         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20357         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
20358         return tag_ptr(ret_conv, true);
20359 }
20360
20361 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_err(int64_t e) {
20362         void* e_ptr = untag_ptr(e);
20363         CHECK_ACCESS(e_ptr);
20364         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20365         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20366         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20367         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
20368         return tag_ptr(ret_conv, true);
20369 }
20370
20371 jboolean  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_is_ok(int64_t o) {
20372         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
20373         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
20374         return ret_conv;
20375 }
20376
20377 void  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_free(int64_t _res) {
20378         if (!ptr_is_owned(_res)) return;
20379         void* _res_ptr = untag_ptr(_res);
20380         CHECK_ACCESS(_res_ptr);
20381         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
20382         FREE(untag_ptr(_res));
20383         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
20384 }
20385
20386 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20387         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20388         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
20389         return tag_ptr(ret_conv, true);
20390 }
20391 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20392         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
20393         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20394         return ret_conv;
20395 }
20396
20397 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone(int64_t orig) {
20398         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
20399         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20400         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
20401         return tag_ptr(ret_conv, true);
20402 }
20403
20404 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_ok(int64_t o) {
20405         LDKNodeFeatures o_conv;
20406         o_conv.inner = untag_ptr(o);
20407         o_conv.is_owned = ptr_is_owned(o);
20408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20409         o_conv = NodeFeatures_clone(&o_conv);
20410         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20411         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
20412         return tag_ptr(ret_conv, true);
20413 }
20414
20415 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_err(int64_t e) {
20416         void* e_ptr = untag_ptr(e);
20417         CHECK_ACCESS(e_ptr);
20418         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20419         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20420         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20421         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
20422         return tag_ptr(ret_conv, true);
20423 }
20424
20425 jboolean  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_is_ok(int64_t o) {
20426         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
20427         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
20428         return ret_conv;
20429 }
20430
20431 void  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_free(int64_t _res) {
20432         if (!ptr_is_owned(_res)) return;
20433         void* _res_ptr = untag_ptr(_res);
20434         CHECK_ACCESS(_res_ptr);
20435         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
20436         FREE(untag_ptr(_res));
20437         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
20438 }
20439
20440 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20441         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20442         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
20443         return tag_ptr(ret_conv, true);
20444 }
20445 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20446         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
20447         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20448         return ret_conv;
20449 }
20450
20451 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone(int64_t orig) {
20452         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
20453         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20454         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
20455         return tag_ptr(ret_conv, true);
20456 }
20457
20458 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
20459         LDKBolt11InvoiceFeatures o_conv;
20460         o_conv.inner = untag_ptr(o);
20461         o_conv.is_owned = ptr_is_owned(o);
20462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20463         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
20464         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20465         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20466         return tag_ptr(ret_conv, true);
20467 }
20468
20469 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
20470         void* e_ptr = untag_ptr(e);
20471         CHECK_ACCESS(e_ptr);
20472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20474         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20475         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
20476         return tag_ptr(ret_conv, true);
20477 }
20478
20479 jboolean  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
20480         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20481         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20482         return ret_conv;
20483 }
20484
20485 void  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
20486         if (!ptr_is_owned(_res)) return;
20487         void* _res_ptr = untag_ptr(_res);
20488         CHECK_ACCESS(_res_ptr);
20489         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20490         FREE(untag_ptr(_res));
20491         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20492 }
20493
20494 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20495         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20496         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
20497         return tag_ptr(ret_conv, true);
20498 }
20499 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20500         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20501         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20502         return ret_conv;
20503 }
20504
20505 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
20506         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20507         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20508         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20509         return tag_ptr(ret_conv, true);
20510 }
20511
20512 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
20513         LDKBolt12InvoiceFeatures o_conv;
20514         o_conv.inner = untag_ptr(o);
20515         o_conv.is_owned = ptr_is_owned(o);
20516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20517         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
20518         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20519         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20520         return tag_ptr(ret_conv, true);
20521 }
20522
20523 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
20524         void* e_ptr = untag_ptr(e);
20525         CHECK_ACCESS(e_ptr);
20526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20528         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20529         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
20530         return tag_ptr(ret_conv, true);
20531 }
20532
20533 jboolean  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
20534         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20535         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20536         return ret_conv;
20537 }
20538
20539 void  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
20540         if (!ptr_is_owned(_res)) return;
20541         void* _res_ptr = untag_ptr(_res);
20542         CHECK_ACCESS(_res_ptr);
20543         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20544         FREE(untag_ptr(_res));
20545         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20546 }
20547
20548 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20549         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20550         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
20551         return tag_ptr(ret_conv, true);
20552 }
20553 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20554         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20555         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20556         return ret_conv;
20557 }
20558
20559 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
20560         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20561         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20562         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20563         return tag_ptr(ret_conv, true);
20564 }
20565
20566 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_ok(int64_t o) {
20567         LDKBlindedHopFeatures o_conv;
20568         o_conv.inner = untag_ptr(o);
20569         o_conv.is_owned = ptr_is_owned(o);
20570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20571         o_conv = BlindedHopFeatures_clone(&o_conv);
20572         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20573         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
20574         return tag_ptr(ret_conv, true);
20575 }
20576
20577 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_err(int64_t e) {
20578         void* e_ptr = untag_ptr(e);
20579         CHECK_ACCESS(e_ptr);
20580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20582         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20583         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
20584         return tag_ptr(ret_conv, true);
20585 }
20586
20587 jboolean  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(int64_t o) {
20588         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
20589         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
20590         return ret_conv;
20591 }
20592
20593 void  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_free(int64_t _res) {
20594         if (!ptr_is_owned(_res)) return;
20595         void* _res_ptr = untag_ptr(_res);
20596         CHECK_ACCESS(_res_ptr);
20597         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
20598         FREE(untag_ptr(_res));
20599         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
20600 }
20601
20602 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20603         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20604         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
20605         return tag_ptr(ret_conv, true);
20606 }
20607 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20608         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
20609         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20610         return ret_conv;
20611 }
20612
20613 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone(int64_t orig) {
20614         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
20615         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20616         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
20617         return tag_ptr(ret_conv, true);
20618 }
20619
20620 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(int64_t o) {
20621         LDKChannelTypeFeatures o_conv;
20622         o_conv.inner = untag_ptr(o);
20623         o_conv.is_owned = ptr_is_owned(o);
20624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20625         o_conv = ChannelTypeFeatures_clone(&o_conv);
20626         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20627         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
20628         return tag_ptr(ret_conv, true);
20629 }
20630
20631 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_err(int64_t e) {
20632         void* e_ptr = untag_ptr(e);
20633         CHECK_ACCESS(e_ptr);
20634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20636         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20637         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
20638         return tag_ptr(ret_conv, true);
20639 }
20640
20641 jboolean  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(int64_t o) {
20642         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
20643         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
20644         return ret_conv;
20645 }
20646
20647 void  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_free(int64_t _res) {
20648         if (!ptr_is_owned(_res)) return;
20649         void* _res_ptr = untag_ptr(_res);
20650         CHECK_ACCESS(_res_ptr);
20651         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
20652         FREE(untag_ptr(_res));
20653         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
20654 }
20655
20656 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20657         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20658         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
20659         return tag_ptr(ret_conv, true);
20660 }
20661 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20662         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
20663         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20664         return ret_conv;
20665 }
20666
20667 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(int64_t orig) {
20668         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
20669         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20670         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
20671         return tag_ptr(ret_conv, true);
20672 }
20673
20674 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_ok(int64_t o) {
20675         LDKOffer o_conv;
20676         o_conv.inner = untag_ptr(o);
20677         o_conv.is_owned = ptr_is_owned(o);
20678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20679         o_conv = Offer_clone(&o_conv);
20680         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20681         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
20682         return tag_ptr(ret_conv, true);
20683 }
20684
20685 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_err(int64_t e) {
20686         LDKBolt12ParseError e_conv;
20687         e_conv.inner = untag_ptr(e);
20688         e_conv.is_owned = ptr_is_owned(e);
20689         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20690         e_conv = Bolt12ParseError_clone(&e_conv);
20691         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20692         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
20693         return tag_ptr(ret_conv, true);
20694 }
20695
20696 jboolean  CS_LDK_CResult_OfferBolt12ParseErrorZ_is_ok(int64_t o) {
20697         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
20698         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
20699         return ret_conv;
20700 }
20701
20702 void  CS_LDK_CResult_OfferBolt12ParseErrorZ_free(int64_t _res) {
20703         if (!ptr_is_owned(_res)) return;
20704         void* _res_ptr = untag_ptr(_res);
20705         CHECK_ACCESS(_res_ptr);
20706         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
20707         FREE(untag_ptr(_res));
20708         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
20709 }
20710
20711 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
20712         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20713         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
20714         return tag_ptr(ret_conv, true);
20715 }
20716 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone_ptr(int64_t arg) {
20717         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
20718         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
20719         return ret_conv;
20720 }
20721
20722 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone(int64_t orig) {
20723         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
20724         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20725         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
20726         return tag_ptr(ret_conv, true);
20727 }
20728
20729 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
20730         LDKPublicKey o_ref;
20731         CHECK(o->arr_len == 33);
20732         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
20733         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20734         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
20735         return tag_ptr(ret_conv, true);
20736 }
20737
20738 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_err(int32_t e) {
20739         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
20740         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20741         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
20742         return tag_ptr(ret_conv, true);
20743 }
20744
20745 jboolean  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_is_ok(int64_t o) {
20746         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
20747         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
20748         return ret_conv;
20749 }
20750
20751 void  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_free(int64_t _res) {
20752         if (!ptr_is_owned(_res)) return;
20753         void* _res_ptr = untag_ptr(_res);
20754         CHECK_ACCESS(_res_ptr);
20755         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
20756         FREE(untag_ptr(_res));
20757         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
20758 }
20759
20760 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
20761         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20762         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
20763         return tag_ptr(ret_conv, true);
20764 }
20765 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
20766         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
20767         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
20768         return ret_conv;
20769 }
20770
20771 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone(int64_t orig) {
20772         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
20773         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20774         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
20775         return tag_ptr(ret_conv, true);
20776 }
20777
20778 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_ok(int64_t o) {
20779         LDKNodeId o_conv;
20780         o_conv.inner = untag_ptr(o);
20781         o_conv.is_owned = ptr_is_owned(o);
20782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20783         o_conv = NodeId_clone(&o_conv);
20784         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20785         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
20786         return tag_ptr(ret_conv, true);
20787 }
20788
20789 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_err(int64_t e) {
20790         void* e_ptr = untag_ptr(e);
20791         CHECK_ACCESS(e_ptr);
20792         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20793         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20794         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20795         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
20796         return tag_ptr(ret_conv, true);
20797 }
20798
20799 jboolean  CS_LDK_CResult_NodeIdDecodeErrorZ_is_ok(int64_t o) {
20800         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
20801         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
20802         return ret_conv;
20803 }
20804
20805 void  CS_LDK_CResult_NodeIdDecodeErrorZ_free(int64_t _res) {
20806         if (!ptr_is_owned(_res)) return;
20807         void* _res_ptr = untag_ptr(_res);
20808         CHECK_ACCESS(_res_ptr);
20809         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
20810         FREE(untag_ptr(_res));
20811         CResult_NodeIdDecodeErrorZ_free(_res_conv);
20812 }
20813
20814 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
20815         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20816         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
20817         return tag_ptr(ret_conv, true);
20818 }
20819 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone_ptr(int64_t arg) {
20820         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
20821         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
20822         return ret_conv;
20823 }
20824
20825 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone(int64_t orig) {
20826         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
20827         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20828         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
20829         return tag_ptr(ret_conv, true);
20830 }
20831
20832 int64_t  CS_LDK_COption_NetworkUpdateZ_some(int64_t o) {
20833         void* o_ptr = untag_ptr(o);
20834         CHECK_ACCESS(o_ptr);
20835         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
20836         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
20837         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20838         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
20839         int64_t ret_ref = tag_ptr(ret_copy, true);
20840         return ret_ref;
20841 }
20842
20843 int64_t  CS_LDK_COption_NetworkUpdateZ_none() {
20844         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20845         *ret_copy = COption_NetworkUpdateZ_none();
20846         int64_t ret_ref = tag_ptr(ret_copy, true);
20847         return ret_ref;
20848 }
20849
20850 void  CS_LDK_COption_NetworkUpdateZ_free(int64_t _res) {
20851         if (!ptr_is_owned(_res)) return;
20852         void* _res_ptr = untag_ptr(_res);
20853         CHECK_ACCESS(_res_ptr);
20854         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
20855         FREE(untag_ptr(_res));
20856         COption_NetworkUpdateZ_free(_res_conv);
20857 }
20858
20859 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
20860         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20861         *ret_copy = COption_NetworkUpdateZ_clone(arg);
20862         int64_t ret_ref = tag_ptr(ret_copy, true);
20863         return ret_ref;
20864 }
20865 int64_t  CS_LDK_COption_NetworkUpdateZ_clone_ptr(int64_t arg) {
20866         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
20867         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
20868         return ret_conv;
20869 }
20870
20871 int64_t  CS_LDK_COption_NetworkUpdateZ_clone(int64_t orig) {
20872         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
20873         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20874         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
20875         int64_t ret_ref = tag_ptr(ret_copy, true);
20876         return ret_ref;
20877 }
20878
20879 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(int64_t o) {
20880         void* o_ptr = untag_ptr(o);
20881         CHECK_ACCESS(o_ptr);
20882         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
20883         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
20884         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20885         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
20886         return tag_ptr(ret_conv, true);
20887 }
20888
20889 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_err(int64_t e) {
20890         void* e_ptr = untag_ptr(e);
20891         CHECK_ACCESS(e_ptr);
20892         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20893         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20894         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20895         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
20896         return tag_ptr(ret_conv, true);
20897 }
20898
20899 jboolean  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(int64_t o) {
20900         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
20901         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20902         return ret_conv;
20903 }
20904
20905 void  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_free(int64_t _res) {
20906         if (!ptr_is_owned(_res)) return;
20907         void* _res_ptr = untag_ptr(_res);
20908         CHECK_ACCESS(_res_ptr);
20909         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20910         FREE(untag_ptr(_res));
20911         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20912 }
20913
20914 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20915         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20916         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20917         return tag_ptr(ret_conv, true);
20918 }
20919 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(int64_t arg) {
20920         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
20921         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20922         return ret_conv;
20923 }
20924
20925 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(int64_t orig) {
20926         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
20927         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20928         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20929         return tag_ptr(ret_conv, true);
20930 }
20931
20932 int64_t  CS_LDK_COption_UtxoLookupZ_some(int64_t o) {
20933         void* o_ptr = untag_ptr(o);
20934         CHECK_ACCESS(o_ptr);
20935         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
20936         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
20937                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20938                 LDKUtxoLookup_JCalls_cloned(&o_conv);
20939         }
20940         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20941         *ret_copy = COption_UtxoLookupZ_some(o_conv);
20942         int64_t ret_ref = tag_ptr(ret_copy, true);
20943         return ret_ref;
20944 }
20945
20946 int64_t  CS_LDK_COption_UtxoLookupZ_none() {
20947         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20948         *ret_copy = COption_UtxoLookupZ_none();
20949         int64_t ret_ref = tag_ptr(ret_copy, true);
20950         return ret_ref;
20951 }
20952
20953 void  CS_LDK_COption_UtxoLookupZ_free(int64_t _res) {
20954         if (!ptr_is_owned(_res)) return;
20955         void* _res_ptr = untag_ptr(_res);
20956         CHECK_ACCESS(_res_ptr);
20957         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
20958         FREE(untag_ptr(_res));
20959         COption_UtxoLookupZ_free(_res_conv);
20960 }
20961
20962 int64_t  CS_LDK_CResult_NoneLightningErrorZ_ok() {
20963         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20964         *ret_conv = CResult_NoneLightningErrorZ_ok();
20965         return tag_ptr(ret_conv, true);
20966 }
20967
20968 int64_t  CS_LDK_CResult_NoneLightningErrorZ_err(int64_t e) {
20969         LDKLightningError e_conv;
20970         e_conv.inner = untag_ptr(e);
20971         e_conv.is_owned = ptr_is_owned(e);
20972         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20973         e_conv = LightningError_clone(&e_conv);
20974         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20975         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
20976         return tag_ptr(ret_conv, true);
20977 }
20978
20979 jboolean  CS_LDK_CResult_NoneLightningErrorZ_is_ok(int64_t o) {
20980         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
20981         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
20982         return ret_conv;
20983 }
20984
20985 void  CS_LDK_CResult_NoneLightningErrorZ_free(int64_t _res) {
20986         if (!ptr_is_owned(_res)) return;
20987         void* _res_ptr = untag_ptr(_res);
20988         CHECK_ACCESS(_res_ptr);
20989         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
20990         FREE(untag_ptr(_res));
20991         CResult_NoneLightningErrorZ_free(_res_conv);
20992 }
20993
20994 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
20995         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20996         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
20997         return tag_ptr(ret_conv, true);
20998 }
20999 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone_ptr(int64_t arg) {
21000         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
21001         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
21002         return ret_conv;
21003 }
21004
21005 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone(int64_t orig) {
21006         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
21007         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21008         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
21009         return tag_ptr(ret_conv, true);
21010 }
21011
21012 int64_t  CS_LDK_CResult_boolLightningErrorZ_ok(jboolean o) {
21013         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21014         *ret_conv = CResult_boolLightningErrorZ_ok(o);
21015         return tag_ptr(ret_conv, true);
21016 }
21017
21018 int64_t  CS_LDK_CResult_boolLightningErrorZ_err(int64_t e) {
21019         LDKLightningError e_conv;
21020         e_conv.inner = untag_ptr(e);
21021         e_conv.is_owned = ptr_is_owned(e);
21022         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21023         e_conv = LightningError_clone(&e_conv);
21024         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21025         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
21026         return tag_ptr(ret_conv, true);
21027 }
21028
21029 jboolean  CS_LDK_CResult_boolLightningErrorZ_is_ok(int64_t o) {
21030         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
21031         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
21032         return ret_conv;
21033 }
21034
21035 void  CS_LDK_CResult_boolLightningErrorZ_free(int64_t _res) {
21036         if (!ptr_is_owned(_res)) return;
21037         void* _res_ptr = untag_ptr(_res);
21038         CHECK_ACCESS(_res_ptr);
21039         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
21040         FREE(untag_ptr(_res));
21041         CResult_boolLightningErrorZ_free(_res_conv);
21042 }
21043
21044 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
21045         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21046         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
21047         return tag_ptr(ret_conv, true);
21048 }
21049 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone_ptr(int64_t arg) {
21050         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
21051         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
21052         return ret_conv;
21053 }
21054
21055 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone(int64_t orig) {
21056         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
21057         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21058         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
21059         return tag_ptr(ret_conv, true);
21060 }
21061
21062 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
21063         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
21064         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
21065         return tag_ptr(ret_conv, true);
21066 }
21067 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(int64_t arg) {
21068         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
21069         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
21070         return ret_conv;
21071 }
21072
21073 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(int64_t orig) {
21074         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
21075         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
21076         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
21077         return tag_ptr(ret_conv, true);
21078 }
21079
21080 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(int64_t a, int64_t b, int64_t c) {
21081         LDKChannelAnnouncement a_conv;
21082         a_conv.inner = untag_ptr(a);
21083         a_conv.is_owned = ptr_is_owned(a);
21084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21085         a_conv = ChannelAnnouncement_clone(&a_conv);
21086         LDKChannelUpdate b_conv;
21087         b_conv.inner = untag_ptr(b);
21088         b_conv.is_owned = ptr_is_owned(b);
21089         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21090         b_conv = ChannelUpdate_clone(&b_conv);
21091         LDKChannelUpdate c_conv;
21092         c_conv.inner = untag_ptr(c);
21093         c_conv.is_owned = ptr_is_owned(c);
21094         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
21095         c_conv = ChannelUpdate_clone(&c_conv);
21096         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
21097         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
21098         return tag_ptr(ret_conv, true);
21099 }
21100
21101 void  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(int64_t _res) {
21102         if (!ptr_is_owned(_res)) return;
21103         void* _res_ptr = untag_ptr(_res);
21104         CHECK_ACCESS(_res_ptr);
21105         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
21106         FREE(untag_ptr(_res));
21107         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
21108 }
21109
21110 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(int64_t o) {
21111         void* o_ptr = untag_ptr(o);
21112         CHECK_ACCESS(o_ptr);
21113         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
21114         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
21115         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21116         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
21117         int64_t ret_ref = tag_ptr(ret_copy, true);
21118         return ret_ref;
21119 }
21120
21121 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
21122         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21123         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
21124         int64_t ret_ref = tag_ptr(ret_copy, true);
21125         return ret_ref;
21126 }
21127
21128 void  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(int64_t _res) {
21129         if (!ptr_is_owned(_res)) return;
21130         void* _res_ptr = untag_ptr(_res);
21131         CHECK_ACCESS(_res_ptr);
21132         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
21133         FREE(untag_ptr(_res));
21134         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
21135 }
21136
21137 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
21138         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21139         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
21140         int64_t ret_ref = tag_ptr(ret_copy, true);
21141         return ret_ref;
21142 }
21143 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(int64_t arg) {
21144         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
21145         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
21146         return ret_conv;
21147 }
21148
21149 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(int64_t orig) {
21150         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
21151         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21152         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
21153         int64_t ret_ref = tag_ptr(ret_copy, true);
21154         return ret_ref;
21155 }
21156
21157 void  CS_LDK_CVec_MessageSendEventZ_free(int64_tArray _res) {
21158         LDKCVec_MessageSendEventZ _res_constr;
21159         _res_constr.datalen = _res->arr_len;
21160         if (_res_constr.datalen > 0)
21161                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
21162         else
21163                 _res_constr.data = NULL;
21164         int64_t* _res_vals = _res->elems;
21165         for (size_t s = 0; s < _res_constr.datalen; s++) {
21166                 int64_t _res_conv_18 = _res_vals[s];
21167                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
21168                 CHECK_ACCESS(_res_conv_18_ptr);
21169                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
21170                 FREE(untag_ptr(_res_conv_18));
21171                 _res_constr.data[s] = _res_conv_18_conv;
21172         }
21173         FREE(_res);
21174         CVec_MessageSendEventZ_free(_res_constr);
21175 }
21176
21177 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_ok(int64_t o) {
21178         LDKChannelUpdateInfo o_conv;
21179         o_conv.inner = untag_ptr(o);
21180         o_conv.is_owned = ptr_is_owned(o);
21181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21182         o_conv = ChannelUpdateInfo_clone(&o_conv);
21183         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21184         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
21185         return tag_ptr(ret_conv, true);
21186 }
21187
21188 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_err(int64_t e) {
21189         void* e_ptr = untag_ptr(e);
21190         CHECK_ACCESS(e_ptr);
21191         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21192         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21193         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21194         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
21195         return tag_ptr(ret_conv, true);
21196 }
21197
21198 jboolean  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(int64_t o) {
21199         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
21200         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
21201         return ret_conv;
21202 }
21203
21204 void  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_free(int64_t _res) {
21205         if (!ptr_is_owned(_res)) return;
21206         void* _res_ptr = untag_ptr(_res);
21207         CHECK_ACCESS(_res_ptr);
21208         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
21209         FREE(untag_ptr(_res));
21210         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
21211 }
21212
21213 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
21214         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21215         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
21216         return tag_ptr(ret_conv, true);
21217 }
21218 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21219         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
21220         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
21221         return ret_conv;
21222 }
21223
21224 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone(int64_t orig) {
21225         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
21226         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21227         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
21228         return tag_ptr(ret_conv, true);
21229 }
21230
21231 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_ok(int64_t o) {
21232         LDKChannelInfo o_conv;
21233         o_conv.inner = untag_ptr(o);
21234         o_conv.is_owned = ptr_is_owned(o);
21235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21236         o_conv = ChannelInfo_clone(&o_conv);
21237         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21238         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
21239         return tag_ptr(ret_conv, true);
21240 }
21241
21242 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_err(int64_t e) {
21243         void* e_ptr = untag_ptr(e);
21244         CHECK_ACCESS(e_ptr);
21245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21247         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21248         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
21249         return tag_ptr(ret_conv, true);
21250 }
21251
21252 jboolean  CS_LDK_CResult_ChannelInfoDecodeErrorZ_is_ok(int64_t o) {
21253         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
21254         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
21255         return ret_conv;
21256 }
21257
21258 void  CS_LDK_CResult_ChannelInfoDecodeErrorZ_free(int64_t _res) {
21259         if (!ptr_is_owned(_res)) return;
21260         void* _res_ptr = untag_ptr(_res);
21261         CHECK_ACCESS(_res_ptr);
21262         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
21263         FREE(untag_ptr(_res));
21264         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
21265 }
21266
21267 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
21268         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21269         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
21270         return tag_ptr(ret_conv, true);
21271 }
21272 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21273         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
21274         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
21275         return ret_conv;
21276 }
21277
21278 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone(int64_t orig) {
21279         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
21280         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21281         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
21282         return tag_ptr(ret_conv, true);
21283 }
21284
21285 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_ok(int64_t o) {
21286         LDKRoutingFees o_conv;
21287         o_conv.inner = untag_ptr(o);
21288         o_conv.is_owned = ptr_is_owned(o);
21289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21290         o_conv = RoutingFees_clone(&o_conv);
21291         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21292         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
21293         return tag_ptr(ret_conv, true);
21294 }
21295
21296 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_err(int64_t e) {
21297         void* e_ptr = untag_ptr(e);
21298         CHECK_ACCESS(e_ptr);
21299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21301         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21302         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
21303         return tag_ptr(ret_conv, true);
21304 }
21305
21306 jboolean  CS_LDK_CResult_RoutingFeesDecodeErrorZ_is_ok(int64_t o) {
21307         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
21308         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
21309         return ret_conv;
21310 }
21311
21312 void  CS_LDK_CResult_RoutingFeesDecodeErrorZ_free(int64_t _res) {
21313         if (!ptr_is_owned(_res)) return;
21314         void* _res_ptr = untag_ptr(_res);
21315         CHECK_ACCESS(_res_ptr);
21316         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
21317         FREE(untag_ptr(_res));
21318         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
21319 }
21320
21321 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
21322         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21323         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
21324         return tag_ptr(ret_conv, true);
21325 }
21326 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone_ptr(int64_t arg) {
21327         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
21328         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
21329         return ret_conv;
21330 }
21331
21332 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone(int64_t orig) {
21333         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
21334         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21335         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
21336         return tag_ptr(ret_conv, true);
21337 }
21338
21339 void  CS_LDK_CVec_SocketAddressZ_free(int64_tArray _res) {
21340         LDKCVec_SocketAddressZ _res_constr;
21341         _res_constr.datalen = _res->arr_len;
21342         if (_res_constr.datalen > 0)
21343                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21344         else
21345                 _res_constr.data = NULL;
21346         int64_t* _res_vals = _res->elems;
21347         for (size_t p = 0; p < _res_constr.datalen; p++) {
21348                 int64_t _res_conv_15 = _res_vals[p];
21349                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
21350                 CHECK_ACCESS(_res_conv_15_ptr);
21351                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
21352                 FREE(untag_ptr(_res_conv_15));
21353                 _res_constr.data[p] = _res_conv_15_conv;
21354         }
21355         FREE(_res);
21356         CVec_SocketAddressZ_free(_res_constr);
21357 }
21358
21359 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(int64_t o) {
21360         LDKNodeAnnouncementInfo o_conv;
21361         o_conv.inner = untag_ptr(o);
21362         o_conv.is_owned = ptr_is_owned(o);
21363         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21364         o_conv = NodeAnnouncementInfo_clone(&o_conv);
21365         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21366         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
21367         return tag_ptr(ret_conv, true);
21368 }
21369
21370 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_err(int64_t e) {
21371         void* e_ptr = untag_ptr(e);
21372         CHECK_ACCESS(e_ptr);
21373         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21374         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21375         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21376         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
21377         return tag_ptr(ret_conv, true);
21378 }
21379
21380 jboolean  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(int64_t o) {
21381         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
21382         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
21383         return ret_conv;
21384 }
21385
21386 void  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_free(int64_t _res) {
21387         if (!ptr_is_owned(_res)) return;
21388         void* _res_ptr = untag_ptr(_res);
21389         CHECK_ACCESS(_res_ptr);
21390         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
21391         FREE(untag_ptr(_res));
21392         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
21393 }
21394
21395 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
21396         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21397         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
21398         return tag_ptr(ret_conv, true);
21399 }
21400 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21401         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
21402         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
21403         return ret_conv;
21404 }
21405
21406 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(int64_t orig) {
21407         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
21408         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21409         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
21410         return tag_ptr(ret_conv, true);
21411 }
21412
21413 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_ok(int64_t o) {
21414         LDKNodeAlias o_conv;
21415         o_conv.inner = untag_ptr(o);
21416         o_conv.is_owned = ptr_is_owned(o);
21417         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21418         o_conv = NodeAlias_clone(&o_conv);
21419         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21420         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
21421         return tag_ptr(ret_conv, true);
21422 }
21423
21424 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_err(int64_t e) {
21425         void* e_ptr = untag_ptr(e);
21426         CHECK_ACCESS(e_ptr);
21427         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21428         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21429         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21430         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
21431         return tag_ptr(ret_conv, true);
21432 }
21433
21434 jboolean  CS_LDK_CResult_NodeAliasDecodeErrorZ_is_ok(int64_t o) {
21435         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
21436         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
21437         return ret_conv;
21438 }
21439
21440 void  CS_LDK_CResult_NodeAliasDecodeErrorZ_free(int64_t _res) {
21441         if (!ptr_is_owned(_res)) return;
21442         void* _res_ptr = untag_ptr(_res);
21443         CHECK_ACCESS(_res_ptr);
21444         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
21445         FREE(untag_ptr(_res));
21446         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
21447 }
21448
21449 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
21450         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21451         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
21452         return tag_ptr(ret_conv, true);
21453 }
21454 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone_ptr(int64_t arg) {
21455         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
21456         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
21457         return ret_conv;
21458 }
21459
21460 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone(int64_t orig) {
21461         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
21462         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21463         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
21464         return tag_ptr(ret_conv, true);
21465 }
21466
21467 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_ok(int64_t o) {
21468         LDKNodeInfo o_conv;
21469         o_conv.inner = untag_ptr(o);
21470         o_conv.is_owned = ptr_is_owned(o);
21471         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21472         o_conv = NodeInfo_clone(&o_conv);
21473         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21474         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
21475         return tag_ptr(ret_conv, true);
21476 }
21477
21478 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_err(int64_t e) {
21479         void* e_ptr = untag_ptr(e);
21480         CHECK_ACCESS(e_ptr);
21481         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21482         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21483         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21484         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
21485         return tag_ptr(ret_conv, true);
21486 }
21487
21488 jboolean  CS_LDK_CResult_NodeInfoDecodeErrorZ_is_ok(int64_t o) {
21489         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
21490         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
21491         return ret_conv;
21492 }
21493
21494 void  CS_LDK_CResult_NodeInfoDecodeErrorZ_free(int64_t _res) {
21495         if (!ptr_is_owned(_res)) return;
21496         void* _res_ptr = untag_ptr(_res);
21497         CHECK_ACCESS(_res_ptr);
21498         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
21499         FREE(untag_ptr(_res));
21500         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
21501 }
21502
21503 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
21504         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21505         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
21506         return tag_ptr(ret_conv, true);
21507 }
21508 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21509         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
21510         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
21511         return ret_conv;
21512 }
21513
21514 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone(int64_t orig) {
21515         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
21516         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21517         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
21518         return tag_ptr(ret_conv, true);
21519 }
21520
21521 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_ok(int64_t o) {
21522         LDKNetworkGraph o_conv;
21523         o_conv.inner = untag_ptr(o);
21524         o_conv.is_owned = ptr_is_owned(o);
21525         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21526         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
21527         
21528         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21529         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
21530         return tag_ptr(ret_conv, true);
21531 }
21532
21533 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_err(int64_t e) {
21534         void* e_ptr = untag_ptr(e);
21535         CHECK_ACCESS(e_ptr);
21536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21538         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21539         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
21540         return tag_ptr(ret_conv, true);
21541 }
21542
21543 jboolean  CS_LDK_CResult_NetworkGraphDecodeErrorZ_is_ok(int64_t o) {
21544         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
21545         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
21546         return ret_conv;
21547 }
21548
21549 void  CS_LDK_CResult_NetworkGraphDecodeErrorZ_free(int64_t _res) {
21550         if (!ptr_is_owned(_res)) return;
21551         void* _res_ptr = untag_ptr(_res);
21552         CHECK_ACCESS(_res_ptr);
21553         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
21554         FREE(untag_ptr(_res));
21555         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
21556 }
21557
21558 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_some(int64_tArray o) {
21559         LDKCVec_SocketAddressZ o_constr;
21560         o_constr.datalen = o->arr_len;
21561         if (o_constr.datalen > 0)
21562                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21563         else
21564                 o_constr.data = NULL;
21565         int64_t* o_vals = o->elems;
21566         for (size_t p = 0; p < o_constr.datalen; p++) {
21567                 int64_t o_conv_15 = o_vals[p];
21568                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
21569                 CHECK_ACCESS(o_conv_15_ptr);
21570                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
21571                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
21572                 o_constr.data[p] = o_conv_15_conv;
21573         }
21574         FREE(o);
21575         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21576         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
21577         int64_t ret_ref = tag_ptr(ret_copy, true);
21578         return ret_ref;
21579 }
21580
21581 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_none() {
21582         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21583         *ret_copy = COption_CVec_SocketAddressZZ_none();
21584         int64_t ret_ref = tag_ptr(ret_copy, true);
21585         return ret_ref;
21586 }
21587
21588 void  CS_LDK_COption_CVec_SocketAddressZZ_free(int64_t _res) {
21589         if (!ptr_is_owned(_res)) return;
21590         void* _res_ptr = untag_ptr(_res);
21591         CHECK_ACCESS(_res_ptr);
21592         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
21593         FREE(untag_ptr(_res));
21594         COption_CVec_SocketAddressZZ_free(_res_conv);
21595 }
21596
21597 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
21598         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21599         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
21600         int64_t ret_ref = tag_ptr(ret_copy, true);
21601         return ret_ref;
21602 }
21603 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone_ptr(int64_t arg) {
21604         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
21605         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
21606         return ret_conv;
21607 }
21608
21609 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone(int64_t orig) {
21610         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
21611         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21612         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
21613         int64_t ret_ref = tag_ptr(ret_copy, true);
21614         return ret_ref;
21615 }
21616
21617 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(int64_t o) {
21618         LDKPendingHTLCInfo o_conv;
21619         o_conv.inner = untag_ptr(o);
21620         o_conv.is_owned = ptr_is_owned(o);
21621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21622         o_conv = PendingHTLCInfo_clone(&o_conv);
21623         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21624         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
21625         return tag_ptr(ret_conv, true);
21626 }
21627
21628 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_err(int64_t e) {
21629         LDKInboundHTLCErr e_conv;
21630         e_conv.inner = untag_ptr(e);
21631         e_conv.is_owned = ptr_is_owned(e);
21632         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21633         // WARNING: we need a move here but no clone is available for LDKInboundHTLCErr
21634         
21635         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21636         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
21637         return tag_ptr(ret_conv, true);
21638 }
21639
21640 jboolean  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(int64_t o) {
21641         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
21642         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
21643         return ret_conv;
21644 }
21645
21646 void  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_free(int64_t _res) {
21647         if (!ptr_is_owned(_res)) return;
21648         void* _res_ptr = untag_ptr(_res);
21649         CHECK_ACCESS(_res_ptr);
21650         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
21651         FREE(untag_ptr(_res));
21652         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
21653 }
21654
21655 void  CS_LDK_CVec_HTLCOutputInCommitmentZ_free(int64_tArray _res) {
21656         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
21657         _res_constr.datalen = _res->arr_len;
21658         if (_res_constr.datalen > 0)
21659                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
21660         else
21661                 _res_constr.data = NULL;
21662         int64_t* _res_vals = _res->elems;
21663         for (size_t y = 0; y < _res_constr.datalen; y++) {
21664                 int64_t _res_conv_24 = _res_vals[y];
21665                 LDKHTLCOutputInCommitment _res_conv_24_conv;
21666                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
21667                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
21668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
21669                 _res_constr.data[y] = _res_conv_24_conv;
21670         }
21671         FREE(_res);
21672         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
21673 }
21674
21675 void  CS_LDK_CVec_HTLCDescriptorZ_free(int64_tArray _res) {
21676         LDKCVec_HTLCDescriptorZ _res_constr;
21677         _res_constr.datalen = _res->arr_len;
21678         if (_res_constr.datalen > 0)
21679                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
21680         else
21681                 _res_constr.data = NULL;
21682         int64_t* _res_vals = _res->elems;
21683         for (size_t q = 0; q < _res_constr.datalen; q++) {
21684                 int64_t _res_conv_16 = _res_vals[q];
21685                 LDKHTLCDescriptor _res_conv_16_conv;
21686                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21687                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21688                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21689                 _res_constr.data[q] = _res_conv_16_conv;
21690         }
21691         FREE(_res);
21692         CVec_HTLCDescriptorZ_free(_res_constr);
21693 }
21694
21695 void  CS_LDK_CVec_UtxoZ_free(int64_tArray _res) {
21696         LDKCVec_UtxoZ _res_constr;
21697         _res_constr.datalen = _res->arr_len;
21698         if (_res_constr.datalen > 0)
21699                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21700         else
21701                 _res_constr.data = NULL;
21702         int64_t* _res_vals = _res->elems;
21703         for (size_t g = 0; g < _res_constr.datalen; g++) {
21704                 int64_t _res_conv_6 = _res_vals[g];
21705                 LDKUtxo _res_conv_6_conv;
21706                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21707                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21709                 _res_constr.data[g] = _res_conv_6_conv;
21710         }
21711         FREE(_res);
21712         CVec_UtxoZ_free(_res_constr);
21713 }
21714
21715 int64_t  CS_LDK_COption_TxOutZ_some(int64_t o) {
21716         void* o_ptr = untag_ptr(o);
21717         CHECK_ACCESS(o_ptr);
21718         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
21719         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
21720         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21721         *ret_copy = COption_TxOutZ_some(o_conv);
21722         int64_t ret_ref = tag_ptr(ret_copy, true);
21723         return ret_ref;
21724 }
21725
21726 int64_t  CS_LDK_COption_TxOutZ_none() {
21727         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21728         *ret_copy = COption_TxOutZ_none();
21729         int64_t ret_ref = tag_ptr(ret_copy, true);
21730         return ret_ref;
21731 }
21732
21733 void  CS_LDK_COption_TxOutZ_free(int64_t _res) {
21734         if (!ptr_is_owned(_res)) return;
21735         void* _res_ptr = untag_ptr(_res);
21736         CHECK_ACCESS(_res_ptr);
21737         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
21738         FREE(untag_ptr(_res));
21739         COption_TxOutZ_free(_res_conv);
21740 }
21741
21742 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
21743         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21744         *ret_copy = COption_TxOutZ_clone(arg);
21745         int64_t ret_ref = tag_ptr(ret_copy, true);
21746         return ret_ref;
21747 }
21748 int64_t  CS_LDK_COption_TxOutZ_clone_ptr(int64_t arg) {
21749         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
21750         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
21751         return ret_conv;
21752 }
21753
21754 int64_t  CS_LDK_COption_TxOutZ_clone(int64_t orig) {
21755         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
21756         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21757         *ret_copy = COption_TxOutZ_clone(orig_conv);
21758         int64_t ret_ref = tag_ptr(ret_copy, true);
21759         return ret_ref;
21760 }
21761
21762 void  CS_LDK_CVec_InputZ_free(int64_tArray _res) {
21763         LDKCVec_InputZ _res_constr;
21764         _res_constr.datalen = _res->arr_len;
21765         if (_res_constr.datalen > 0)
21766                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
21767         else
21768                 _res_constr.data = NULL;
21769         int64_t* _res_vals = _res->elems;
21770         for (size_t h = 0; h < _res_constr.datalen; h++) {
21771                 int64_t _res_conv_7 = _res_vals[h];
21772                 LDKInput _res_conv_7_conv;
21773                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
21774                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
21775                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
21776                 _res_constr.data[h] = _res_conv_7_conv;
21777         }
21778         FREE(_res);
21779         CVec_InputZ_free(_res_constr);
21780 }
21781
21782 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_ok(int64_t o) {
21783         LDKCoinSelection 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 = CoinSelection_clone(&o_conv);
21788         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21789         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
21790         return tag_ptr(ret_conv, true);
21791 }
21792
21793 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_err() {
21794         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21795         *ret_conv = CResult_CoinSelectionNoneZ_err();
21796         return tag_ptr(ret_conv, true);
21797 }
21798
21799 jboolean  CS_LDK_CResult_CoinSelectionNoneZ_is_ok(int64_t o) {
21800         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
21801         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
21802         return ret_conv;
21803 }
21804
21805 void  CS_LDK_CResult_CoinSelectionNoneZ_free(int64_t _res) {
21806         if (!ptr_is_owned(_res)) return;
21807         void* _res_ptr = untag_ptr(_res);
21808         CHECK_ACCESS(_res_ptr);
21809         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
21810         FREE(untag_ptr(_res));
21811         CResult_CoinSelectionNoneZ_free(_res_conv);
21812 }
21813
21814 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
21815         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21816         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
21817         return tag_ptr(ret_conv, true);
21818 }
21819 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone_ptr(int64_t arg) {
21820         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
21821         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
21822         return ret_conv;
21823 }
21824
21825 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone(int64_t orig) {
21826         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
21827         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21828         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
21829         return tag_ptr(ret_conv, true);
21830 }
21831
21832 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_ok(int64_tArray o) {
21833         LDKCVec_UtxoZ o_constr;
21834         o_constr.datalen = o->arr_len;
21835         if (o_constr.datalen > 0)
21836                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21837         else
21838                 o_constr.data = NULL;
21839         int64_t* o_vals = o->elems;
21840         for (size_t g = 0; g < o_constr.datalen; g++) {
21841                 int64_t o_conv_6 = o_vals[g];
21842                 LDKUtxo o_conv_6_conv;
21843                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
21844                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
21845                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
21846                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
21847                 o_constr.data[g] = o_conv_6_conv;
21848         }
21849         FREE(o);
21850         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21851         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
21852         return tag_ptr(ret_conv, true);
21853 }
21854
21855 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_err() {
21856         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21857         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
21858         return tag_ptr(ret_conv, true);
21859 }
21860
21861 jboolean  CS_LDK_CResult_CVec_UtxoZNoneZ_is_ok(int64_t o) {
21862         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
21863         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
21864         return ret_conv;
21865 }
21866
21867 void  CS_LDK_CResult_CVec_UtxoZNoneZ_free(int64_t _res) {
21868         if (!ptr_is_owned(_res)) return;
21869         void* _res_ptr = untag_ptr(_res);
21870         CHECK_ACCESS(_res_ptr);
21871         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
21872         FREE(untag_ptr(_res));
21873         CResult_CVec_UtxoZNoneZ_free(_res_conv);
21874 }
21875
21876 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
21877         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21878         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
21879         return tag_ptr(ret_conv, true);
21880 }
21881 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone_ptr(int64_t arg) {
21882         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
21883         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
21884         return ret_conv;
21885 }
21886
21887 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone(int64_t orig) {
21888         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
21889         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21890         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
21891         return tag_ptr(ret_conv, true);
21892 }
21893
21894 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
21895         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21896         *ret_conv = C2Tuple_u64u16Z_clone(arg);
21897         return tag_ptr(ret_conv, true);
21898 }
21899 int64_t  CS_LDK_C2Tuple_u64u16Z_clone_ptr(int64_t arg) {
21900         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
21901         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
21902         return ret_conv;
21903 }
21904
21905 int64_t  CS_LDK_C2Tuple_u64u16Z_clone(int64_t orig) {
21906         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
21907         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21908         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
21909         return tag_ptr(ret_conv, true);
21910 }
21911
21912 int64_t  CS_LDK_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
21913         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21914         *ret_conv = C2Tuple_u64u16Z_new(a, b);
21915         return tag_ptr(ret_conv, true);
21916 }
21917
21918 void  CS_LDK_C2Tuple_u64u16Z_free(int64_t _res) {
21919         if (!ptr_is_owned(_res)) return;
21920         void* _res_ptr = untag_ptr(_res);
21921         CHECK_ACCESS(_res_ptr);
21922         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
21923         FREE(untag_ptr(_res));
21924         C2Tuple_u64u16Z_free(_res_conv);
21925 }
21926
21927 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_some(int64_t o) {
21928         void* o_ptr = untag_ptr(o);
21929         CHECK_ACCESS(o_ptr);
21930         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
21931         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
21932         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21933         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
21934         int64_t ret_ref = tag_ptr(ret_copy, true);
21935         return ret_ref;
21936 }
21937
21938 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_none() {
21939         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21940         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
21941         int64_t ret_ref = tag_ptr(ret_copy, true);
21942         return ret_ref;
21943 }
21944
21945 void  CS_LDK_COption_C2Tuple_u64u16ZZ_free(int64_t _res) {
21946         if (!ptr_is_owned(_res)) return;
21947         void* _res_ptr = untag_ptr(_res);
21948         CHECK_ACCESS(_res_ptr);
21949         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
21950         FREE(untag_ptr(_res));
21951         COption_C2Tuple_u64u16ZZ_free(_res_conv);
21952 }
21953
21954 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
21955         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21956         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
21957         int64_t ret_ref = tag_ptr(ret_copy, true);
21958         return ret_ref;
21959 }
21960 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone_ptr(int64_t arg) {
21961         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
21962         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
21963         return ret_conv;
21964 }
21965
21966 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone(int64_t orig) {
21967         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
21968         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21969         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
21970         int64_t ret_ref = tag_ptr(ret_copy, true);
21971         return ret_ref;
21972 }
21973
21974 int64_t  CS_LDK_COption_ChannelShutdownStateZ_some(int32_t o) {
21975         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
21976         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21977         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
21978         int64_t ret_ref = tag_ptr(ret_copy, true);
21979         return ret_ref;
21980 }
21981
21982 int64_t  CS_LDK_COption_ChannelShutdownStateZ_none() {
21983         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21984         *ret_copy = COption_ChannelShutdownStateZ_none();
21985         int64_t ret_ref = tag_ptr(ret_copy, true);
21986         return ret_ref;
21987 }
21988
21989 void  CS_LDK_COption_ChannelShutdownStateZ_free(int64_t _res) {
21990         if (!ptr_is_owned(_res)) return;
21991         void* _res_ptr = untag_ptr(_res);
21992         CHECK_ACCESS(_res_ptr);
21993         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
21994         FREE(untag_ptr(_res));
21995         COption_ChannelShutdownStateZ_free(_res_conv);
21996 }
21997
21998 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
21999         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
22000         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
22001         int64_t ret_ref = tag_ptr(ret_copy, true);
22002         return ret_ref;
22003 }
22004 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone_ptr(int64_t arg) {
22005         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
22006         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
22007         return ret_conv;
22008 }
22009
22010 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone(int64_t orig) {
22011         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
22012         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
22013         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
22014         int64_t ret_ref = tag_ptr(ret_copy, true);
22015         return ret_ref;
22016 }
22017
22018 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
22019         LDKThirtyTwoBytes o_ref;
22020         CHECK(o->arr_len == 32);
22021         memcpy(o_ref.data, o->elems, 32); FREE(o);
22022         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22023         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
22024         return tag_ptr(ret_conv, true);
22025 }
22026
22027 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_err(int64_t e) {
22028         void* e_ptr = untag_ptr(e);
22029         CHECK_ACCESS(e_ptr);
22030         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
22031         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
22032         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22033         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
22034         return tag_ptr(ret_conv, true);
22035 }
22036
22037 jboolean  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(int64_t o) {
22038         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
22039         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
22040         return ret_conv;
22041 }
22042
22043 void  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_free(int64_t _res) {
22044         if (!ptr_is_owned(_res)) return;
22045         void* _res_ptr = untag_ptr(_res);
22046         CHECK_ACCESS(_res_ptr);
22047         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
22048         FREE(untag_ptr(_res));
22049         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
22050 }
22051
22052 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
22053         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22054         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
22055         return tag_ptr(ret_conv, true);
22056 }
22057 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(int64_t arg) {
22058         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
22059         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
22060         return ret_conv;
22061 }
22062
22063 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone(int64_t orig) {
22064         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
22065         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22066         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
22067         return tag_ptr(ret_conv, true);
22068 }
22069
22070 void  CS_LDK_CVec_RecentPaymentDetailsZ_free(int64_tArray _res) {
22071         LDKCVec_RecentPaymentDetailsZ _res_constr;
22072         _res_constr.datalen = _res->arr_len;
22073         if (_res_constr.datalen > 0)
22074                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
22075         else
22076                 _res_constr.data = NULL;
22077         int64_t* _res_vals = _res->elems;
22078         for (size_t w = 0; w < _res_constr.datalen; w++) {
22079                 int64_t _res_conv_22 = _res_vals[w];
22080                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
22081                 CHECK_ACCESS(_res_conv_22_ptr);
22082                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
22083                 FREE(untag_ptr(_res_conv_22));
22084                 _res_constr.data[w] = _res_conv_22_conv;
22085         }
22086         FREE(_res);
22087         CVec_RecentPaymentDetailsZ_free(_res_constr);
22088 }
22089
22090 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_ok() {
22091         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22092         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
22093         return tag_ptr(ret_conv, true);
22094 }
22095
22096 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_err(int64_t e) {
22097         void* e_ptr = untag_ptr(e);
22098         CHECK_ACCESS(e_ptr);
22099         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22100         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22101         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22102         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
22103         return tag_ptr(ret_conv, true);
22104 }
22105
22106 jboolean  CS_LDK_CResult_NonePaymentSendFailureZ_is_ok(int64_t o) {
22107         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
22108         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
22109         return ret_conv;
22110 }
22111
22112 void  CS_LDK_CResult_NonePaymentSendFailureZ_free(int64_t _res) {
22113         if (!ptr_is_owned(_res)) return;
22114         void* _res_ptr = untag_ptr(_res);
22115         CHECK_ACCESS(_res_ptr);
22116         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
22117         FREE(untag_ptr(_res));
22118         CResult_NonePaymentSendFailureZ_free(_res_conv);
22119 }
22120
22121 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
22122         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22123         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
22124         return tag_ptr(ret_conv, true);
22125 }
22126 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone_ptr(int64_t arg) {
22127         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
22128         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
22129         return ret_conv;
22130 }
22131
22132 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone(int64_t orig) {
22133         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
22134         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22135         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
22136         return tag_ptr(ret_conv, true);
22137 }
22138
22139 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_ok() {
22140         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22141         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
22142         return tag_ptr(ret_conv, true);
22143 }
22144
22145 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_err(int32_t e) {
22146         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
22147         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22148         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
22149         return tag_ptr(ret_conv, true);
22150 }
22151
22152 jboolean  CS_LDK_CResult_NoneRetryableSendFailureZ_is_ok(int64_t o) {
22153         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
22154         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
22155         return ret_conv;
22156 }
22157
22158 void  CS_LDK_CResult_NoneRetryableSendFailureZ_free(int64_t _res) {
22159         if (!ptr_is_owned(_res)) return;
22160         void* _res_ptr = untag_ptr(_res);
22161         CHECK_ACCESS(_res_ptr);
22162         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
22163         FREE(untag_ptr(_res));
22164         CResult_NoneRetryableSendFailureZ_free(_res_conv);
22165 }
22166
22167 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
22168         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22169         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
22170         return tag_ptr(ret_conv, true);
22171 }
22172 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone_ptr(int64_t arg) {
22173         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
22174         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
22175         return ret_conv;
22176 }
22177
22178 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone(int64_t orig) {
22179         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
22180         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22181         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
22182         return tag_ptr(ret_conv, true);
22183 }
22184
22185 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
22186         LDKThirtyTwoBytes o_ref;
22187         CHECK(o->arr_len == 32);
22188         memcpy(o_ref.data, o->elems, 32); FREE(o);
22189         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22190         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
22191         return tag_ptr(ret_conv, true);
22192 }
22193
22194 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(int64_t e) {
22195         void* e_ptr = untag_ptr(e);
22196         CHECK_ACCESS(e_ptr);
22197         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22198         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22199         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22200         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
22201         return tag_ptr(ret_conv, true);
22202 }
22203
22204 jboolean  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(int64_t o) {
22205         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
22206         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
22207         return ret_conv;
22208 }
22209
22210 void  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(int64_t _res) {
22211         if (!ptr_is_owned(_res)) return;
22212         void* _res_ptr = untag_ptr(_res);
22213         CHECK_ACCESS(_res_ptr);
22214         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
22215         FREE(untag_ptr(_res));
22216         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
22217 }
22218
22219 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
22220         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22221         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
22222         return tag_ptr(ret_conv, true);
22223 }
22224 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(int64_t arg) {
22225         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
22226         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
22227         return ret_conv;
22228 }
22229
22230 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(int64_t orig) {
22231         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
22232         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22233         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
22234         return tag_ptr(ret_conv, true);
22235 }
22236
22237 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
22238         LDKThirtyTwoBytes o_ref;
22239         CHECK(o->arr_len == 32);
22240         memcpy(o_ref.data, o->elems, 32); FREE(o);
22241         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22242         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
22243         return tag_ptr(ret_conv, true);
22244 }
22245
22246 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(int32_t e) {
22247         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
22248         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22249         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
22250         return tag_ptr(ret_conv, true);
22251 }
22252
22253 jboolean  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(int64_t o) {
22254         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
22255         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
22256         return ret_conv;
22257 }
22258
22259 void  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(int64_t _res) {
22260         if (!ptr_is_owned(_res)) return;
22261         void* _res_ptr = untag_ptr(_res);
22262         CHECK_ACCESS(_res_ptr);
22263         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
22264         FREE(untag_ptr(_res));
22265         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
22266 }
22267
22268 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
22269         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22270         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
22271         return tag_ptr(ret_conv, true);
22272 }
22273 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(int64_t arg) {
22274         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
22275         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
22276         return ret_conv;
22277 }
22278
22279 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(int64_t orig) {
22280         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
22281         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22282         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
22283         return tag_ptr(ret_conv, true);
22284 }
22285
22286 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
22287         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
22288         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
22289         return tag_ptr(ret_conv, true);
22290 }
22291 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(int64_t arg) {
22292         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
22293         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
22294         return ret_conv;
22295 }
22296
22297 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(int64_t orig) {
22298         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
22299         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
22300         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
22301         return tag_ptr(ret_conv, true);
22302 }
22303
22304 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
22305         LDKThirtyTwoBytes a_ref;
22306         CHECK(a->arr_len == 32);
22307         memcpy(a_ref.data, a->elems, 32); FREE(a);
22308         LDKThirtyTwoBytes b_ref;
22309         CHECK(b->arr_len == 32);
22310         memcpy(b_ref.data, b->elems, 32); FREE(b);
22311         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
22312         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
22313         return tag_ptr(ret_conv, true);
22314 }
22315
22316 void  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(int64_t _res) {
22317         if (!ptr_is_owned(_res)) return;
22318         void* _res_ptr = untag_ptr(_res);
22319         CHECK_ACCESS(_res_ptr);
22320         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
22321         FREE(untag_ptr(_res));
22322         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
22323 }
22324
22325 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(int64_t o) {
22326         void* o_ptr = untag_ptr(o);
22327         CHECK_ACCESS(o_ptr);
22328         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22329         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22330         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22331         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
22332         return tag_ptr(ret_conv, true);
22333 }
22334
22335 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(int64_t e) {
22336         void* e_ptr = untag_ptr(e);
22337         CHECK_ACCESS(e_ptr);
22338         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22339         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22340         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22341         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
22342         return tag_ptr(ret_conv, true);
22343 }
22344
22345 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(int64_t o) {
22346         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
22347         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
22348         return ret_conv;
22349 }
22350
22351 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(int64_t _res) {
22352         if (!ptr_is_owned(_res)) return;
22353         void* _res_ptr = untag_ptr(_res);
22354         CHECK_ACCESS(_res_ptr);
22355         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
22356         FREE(untag_ptr(_res));
22357         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
22358 }
22359
22360 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
22361         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22362         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
22363         return tag_ptr(ret_conv, true);
22364 }
22365 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(int64_t arg) {
22366         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
22367         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
22368         return ret_conv;
22369 }
22370
22371 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(int64_t orig) {
22372         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
22373         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22374         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
22375         return tag_ptr(ret_conv, true);
22376 }
22377
22378 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(int64_tArray _res) {
22379         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
22380         _res_constr.datalen = _res->arr_len;
22381         if (_res_constr.datalen > 0)
22382                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22383         else
22384                 _res_constr.data = NULL;
22385         int64_t* _res_vals = _res->elems;
22386         for (size_t o = 0; o < _res_constr.datalen; o++) {
22387                 int64_t _res_conv_40 = _res_vals[o];
22388                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22389                 CHECK_ACCESS(_res_conv_40_ptr);
22390                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
22391                 FREE(untag_ptr(_res_conv_40));
22392                 _res_constr.data[o] = _res_conv_40_conv;
22393         }
22394         FREE(_res);
22395         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
22396 }
22397
22398 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(int64_tArray o) {
22399         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
22400         o_constr.datalen = o->arr_len;
22401         if (o_constr.datalen > 0)
22402                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22403         else
22404                 o_constr.data = NULL;
22405         int64_t* o_vals = o->elems;
22406         for (size_t o = 0; o < o_constr.datalen; o++) {
22407                 int64_t o_conv_40 = o_vals[o];
22408                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
22409                 CHECK_ACCESS(o_conv_40_ptr);
22410                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
22411                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
22412                 o_constr.data[o] = o_conv_40_conv;
22413         }
22414         FREE(o);
22415         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22416         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
22417         return tag_ptr(ret_conv, true);
22418 }
22419
22420 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(int64_t e) {
22421         void* e_ptr = untag_ptr(e);
22422         CHECK_ACCESS(e_ptr);
22423         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
22424         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
22425         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22426         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
22427         return tag_ptr(ret_conv, true);
22428 }
22429
22430 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(int64_t o) {
22431         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
22432         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
22433         return ret_conv;
22434 }
22435
22436 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(int64_t _res) {
22437         if (!ptr_is_owned(_res)) return;
22438         void* _res_ptr = untag_ptr(_res);
22439         CHECK_ACCESS(_res_ptr);
22440         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
22441         FREE(untag_ptr(_res));
22442         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
22443 }
22444
22445 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
22446         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22447         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
22448         return tag_ptr(ret_conv, true);
22449 }
22450 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(int64_t arg) {
22451         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
22452         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
22453         return ret_conv;
22454 }
22455
22456 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(int64_t orig) {
22457         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
22458         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22459         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
22460         return tag_ptr(ret_conv, true);
22461 }
22462
22463 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
22464         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22465         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
22466         return tag_ptr(ret_conv, true);
22467 }
22468 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(int64_t arg) {
22469         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
22470         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
22471         return ret_conv;
22472 }
22473
22474 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(int64_t orig) {
22475         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
22476         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22477         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
22478         return tag_ptr(ret_conv, true);
22479 }
22480
22481 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
22482         LDKThirtyTwoBytes a_ref;
22483         CHECK(a->arr_len == 32);
22484         memcpy(a_ref.data, a->elems, 32); FREE(a);
22485         LDKPublicKey b_ref;
22486         CHECK(b->arr_len == 33);
22487         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
22488         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22489         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
22490         return tag_ptr(ret_conv, true);
22491 }
22492
22493 void  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(int64_t _res) {
22494         if (!ptr_is_owned(_res)) return;
22495         void* _res_ptr = untag_ptr(_res);
22496         CHECK_ACCESS(_res_ptr);
22497         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
22498         FREE(untag_ptr(_res));
22499         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
22500 }
22501
22502 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(int64_tArray _res) {
22503         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
22504         _res_constr.datalen = _res->arr_len;
22505         if (_res_constr.datalen > 0)
22506                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
22507         else
22508                 _res_constr.data = NULL;
22509         int64_t* _res_vals = _res->elems;
22510         for (size_t j = 0; j < _res_constr.datalen; j++) {
22511                 int64_t _res_conv_35 = _res_vals[j];
22512                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
22513                 CHECK_ACCESS(_res_conv_35_ptr);
22514                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
22515                 FREE(untag_ptr(_res_conv_35));
22516                 _res_constr.data[j] = _res_conv_35_conv;
22517         }
22518         FREE(_res);
22519         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
22520 }
22521
22522 int64_t  CS_LDK_COption_StrZ_some(jstring o) {
22523         LDKStr o_conv = str_ref_to_owned_c(o);
22524         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22525         *ret_copy = COption_StrZ_some(o_conv);
22526         int64_t ret_ref = tag_ptr(ret_copy, true);
22527         return ret_ref;
22528 }
22529
22530 int64_t  CS_LDK_COption_StrZ_none() {
22531         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22532         *ret_copy = COption_StrZ_none();
22533         int64_t ret_ref = tag_ptr(ret_copy, true);
22534         return ret_ref;
22535 }
22536
22537 void  CS_LDK_COption_StrZ_free(int64_t _res) {
22538         if (!ptr_is_owned(_res)) return;
22539         void* _res_ptr = untag_ptr(_res);
22540         CHECK_ACCESS(_res_ptr);
22541         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
22542         FREE(untag_ptr(_res));
22543         COption_StrZ_free(_res_conv);
22544 }
22545
22546 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
22547         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22548         *ret_copy = COption_StrZ_clone(arg);
22549         int64_t ret_ref = tag_ptr(ret_copy, true);
22550         return ret_ref;
22551 }
22552 int64_t  CS_LDK_COption_StrZ_clone_ptr(int64_t arg) {
22553         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
22554         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
22555         return ret_conv;
22556 }
22557
22558 int64_t  CS_LDK_COption_StrZ_clone(int64_t orig) {
22559         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
22560         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22561         *ret_copy = COption_StrZ_clone(orig_conv);
22562         int64_t ret_ref = tag_ptr(ret_copy, true);
22563         return ret_ref;
22564 }
22565
22566 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_ok() {
22567         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22568         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22569         return tag_ptr(ret_conv, true);
22570 }
22571
22572 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_err(int32_t e) {
22573         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22574         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22575         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22576         return tag_ptr(ret_conv, true);
22577 }
22578
22579 jboolean  CS_LDK_CResult_NoneBolt12SemanticErrorZ_is_ok(int64_t o) {
22580         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22581         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22582         return ret_conv;
22583 }
22584
22585 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_free(int64_t _res) {
22586         if (!ptr_is_owned(_res)) return;
22587         void* _res_ptr = untag_ptr(_res);
22588         CHECK_ACCESS(_res_ptr);
22589         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22590         FREE(untag_ptr(_res));
22591         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22592 }
22593
22594 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22595         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22596         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22597         return tag_ptr(ret_conv, true);
22598 }
22599 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
22600         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22601         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22602         return ret_conv;
22603 }
22604
22605 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone(int64_t orig) {
22606         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22607         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22608         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22609         return tag_ptr(ret_conv, true);
22610 }
22611
22612 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(int64_t o) {
22613         void* o_ptr = untag_ptr(o);
22614         CHECK_ACCESS(o_ptr);
22615         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22616         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22617         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22618         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
22619         return tag_ptr(ret_conv, true);
22620 }
22621
22622 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
22623         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22624         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
22625         return tag_ptr(ret_conv, true);
22626 }
22627
22628 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(int64_t o) {
22629         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
22630         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
22631         return ret_conv;
22632 }
22633
22634 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(int64_t _res) {
22635         if (!ptr_is_owned(_res)) return;
22636         void* _res_ptr = untag_ptr(_res);
22637         CHECK_ACCESS(_res_ptr);
22638         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
22639         FREE(untag_ptr(_res));
22640         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
22641 }
22642
22643 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
22644         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22645         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
22646         return tag_ptr(ret_conv, true);
22647 }
22648 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(int64_t arg) {
22649         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
22650         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
22651         return ret_conv;
22652 }
22653
22654 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(int64_t orig) {
22655         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
22656         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22657         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
22658         return tag_ptr(ret_conv, true);
22659 }
22660
22661 int64_t  CS_LDK_COption_OffersMessageZ_some(int64_t o) {
22662         void* o_ptr = untag_ptr(o);
22663         CHECK_ACCESS(o_ptr);
22664         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
22665         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
22666         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22667         *ret_copy = COption_OffersMessageZ_some(o_conv);
22668         int64_t ret_ref = tag_ptr(ret_copy, true);
22669         return ret_ref;
22670 }
22671
22672 int64_t  CS_LDK_COption_OffersMessageZ_none() {
22673         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22674         *ret_copy = COption_OffersMessageZ_none();
22675         int64_t ret_ref = tag_ptr(ret_copy, true);
22676         return ret_ref;
22677 }
22678
22679 void  CS_LDK_COption_OffersMessageZ_free(int64_t _res) {
22680         if (!ptr_is_owned(_res)) return;
22681         void* _res_ptr = untag_ptr(_res);
22682         CHECK_ACCESS(_res_ptr);
22683         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
22684         FREE(untag_ptr(_res));
22685         COption_OffersMessageZ_free(_res_conv);
22686 }
22687
22688 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
22689         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22690         *ret_copy = COption_OffersMessageZ_clone(arg);
22691         int64_t ret_ref = tag_ptr(ret_copy, true);
22692         return ret_ref;
22693 }
22694 int64_t  CS_LDK_COption_OffersMessageZ_clone_ptr(int64_t arg) {
22695         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
22696         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
22697         return ret_conv;
22698 }
22699
22700 int64_t  CS_LDK_COption_OffersMessageZ_clone(int64_t orig) {
22701         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
22702         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22703         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
22704         int64_t ret_ref = tag_ptr(ret_copy, true);
22705         return ret_ref;
22706 }
22707
22708 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
22709         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22710         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
22711         return tag_ptr(ret_conv, true);
22712 }
22713 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(int64_t arg) {
22714         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
22715         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
22716         return ret_conv;
22717 }
22718
22719 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(int64_t orig) {
22720         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
22721         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22722         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
22723         return tag_ptr(ret_conv, true);
22724 }
22725
22726 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
22727         void* a_ptr = untag_ptr(a);
22728         CHECK_ACCESS(a_ptr);
22729         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
22730         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
22731         void* b_ptr = untag_ptr(b);
22732         CHECK_ACCESS(b_ptr);
22733         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
22734         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
22735         LDKBlindedPath c_conv;
22736         c_conv.inner = untag_ptr(c);
22737         c_conv.is_owned = ptr_is_owned(c);
22738         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22739         c_conv = BlindedPath_clone(&c_conv);
22740         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22741         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
22742         return tag_ptr(ret_conv, true);
22743 }
22744
22745 void  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_free(int64_t _res) {
22746         if (!ptr_is_owned(_res)) return;
22747         void* _res_ptr = untag_ptr(_res);
22748         CHECK_ACCESS(_res_ptr);
22749         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
22750         FREE(untag_ptr(_res));
22751         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
22752 }
22753
22754 void  CS_LDK_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(int64_tArray _res) {
22755         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
22756         _res_constr.datalen = _res->arr_len;
22757         if (_res_constr.datalen > 0)
22758                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
22759         else
22760                 _res_constr.data = NULL;
22761         int64_t* _res_vals = _res->elems;
22762         for (size_t x = 0; x < _res_constr.datalen; x++) {
22763                 int64_t _res_conv_49 = _res_vals[x];
22764                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22765                 CHECK_ACCESS(_res_conv_49_ptr);
22766                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
22767                 FREE(untag_ptr(_res_conv_49));
22768                 _res_constr.data[x] = _res_conv_49_conv;
22769         }
22770         FREE(_res);
22771         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
22772 }
22773
22774 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(int64_t o) {
22775         LDKCounterpartyForwardingInfo o_conv;
22776         o_conv.inner = untag_ptr(o);
22777         o_conv.is_owned = ptr_is_owned(o);
22778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22779         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
22780         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22781         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
22782         return tag_ptr(ret_conv, true);
22783 }
22784
22785 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(int64_t e) {
22786         void* e_ptr = untag_ptr(e);
22787         CHECK_ACCESS(e_ptr);
22788         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22789         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22790         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22791         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
22792         return tag_ptr(ret_conv, true);
22793 }
22794
22795 jboolean  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(int64_t o) {
22796         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
22797         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
22798         return ret_conv;
22799 }
22800
22801 void  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(int64_t _res) {
22802         if (!ptr_is_owned(_res)) return;
22803         void* _res_ptr = untag_ptr(_res);
22804         CHECK_ACCESS(_res_ptr);
22805         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
22806         FREE(untag_ptr(_res));
22807         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
22808 }
22809
22810 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
22811         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22812         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
22813         return tag_ptr(ret_conv, true);
22814 }
22815 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(int64_t arg) {
22816         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
22817         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
22818         return ret_conv;
22819 }
22820
22821 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(int64_t orig) {
22822         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
22823         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22824         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
22825         return tag_ptr(ret_conv, true);
22826 }
22827
22828 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_ok(int64_t o) {
22829         LDKChannelCounterparty o_conv;
22830         o_conv.inner = untag_ptr(o);
22831         o_conv.is_owned = ptr_is_owned(o);
22832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22833         o_conv = ChannelCounterparty_clone(&o_conv);
22834         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22835         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
22836         return tag_ptr(ret_conv, true);
22837 }
22838
22839 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_err(int64_t e) {
22840         void* e_ptr = untag_ptr(e);
22841         CHECK_ACCESS(e_ptr);
22842         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22843         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22844         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22845         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
22846         return tag_ptr(ret_conv, true);
22847 }
22848
22849 jboolean  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(int64_t o) {
22850         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
22851         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
22852         return ret_conv;
22853 }
22854
22855 void  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_free(int64_t _res) {
22856         if (!ptr_is_owned(_res)) return;
22857         void* _res_ptr = untag_ptr(_res);
22858         CHECK_ACCESS(_res_ptr);
22859         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
22860         FREE(untag_ptr(_res));
22861         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
22862 }
22863
22864 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
22865         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22866         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
22867         return tag_ptr(ret_conv, true);
22868 }
22869 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(int64_t arg) {
22870         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
22871         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
22872         return ret_conv;
22873 }
22874
22875 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone(int64_t orig) {
22876         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
22877         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22878         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
22879         return tag_ptr(ret_conv, true);
22880 }
22881
22882 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_ok(int64_t o) {
22883         LDKChannelDetails o_conv;
22884         o_conv.inner = untag_ptr(o);
22885         o_conv.is_owned = ptr_is_owned(o);
22886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22887         o_conv = ChannelDetails_clone(&o_conv);
22888         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22889         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
22890         return tag_ptr(ret_conv, true);
22891 }
22892
22893 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_err(int64_t e) {
22894         void* e_ptr = untag_ptr(e);
22895         CHECK_ACCESS(e_ptr);
22896         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22897         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22898         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22899         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
22900         return tag_ptr(ret_conv, true);
22901 }
22902
22903 jboolean  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_is_ok(int64_t o) {
22904         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
22905         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
22906         return ret_conv;
22907 }
22908
22909 void  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_free(int64_t _res) {
22910         if (!ptr_is_owned(_res)) return;
22911         void* _res_ptr = untag_ptr(_res);
22912         CHECK_ACCESS(_res_ptr);
22913         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
22914         FREE(untag_ptr(_res));
22915         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
22916 }
22917
22918 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
22919         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22920         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
22921         return tag_ptr(ret_conv, true);
22922 }
22923 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(int64_t arg) {
22924         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
22925         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
22926         return ret_conv;
22927 }
22928
22929 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone(int64_t orig) {
22930         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
22931         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22932         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
22933         return tag_ptr(ret_conv, true);
22934 }
22935
22936 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_ok(int64_t o) {
22937         LDKPhantomRouteHints o_conv;
22938         o_conv.inner = untag_ptr(o);
22939         o_conv.is_owned = ptr_is_owned(o);
22940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22941         o_conv = PhantomRouteHints_clone(&o_conv);
22942         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22943         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
22944         return tag_ptr(ret_conv, true);
22945 }
22946
22947 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_err(int64_t e) {
22948         void* e_ptr = untag_ptr(e);
22949         CHECK_ACCESS(e_ptr);
22950         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22951         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22952         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22953         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
22954         return tag_ptr(ret_conv, true);
22955 }
22956
22957 jboolean  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(int64_t o) {
22958         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
22959         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
22960         return ret_conv;
22961 }
22962
22963 void  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_free(int64_t _res) {
22964         if (!ptr_is_owned(_res)) return;
22965         void* _res_ptr = untag_ptr(_res);
22966         CHECK_ACCESS(_res_ptr);
22967         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
22968         FREE(untag_ptr(_res));
22969         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
22970 }
22971
22972 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
22973         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22974         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
22975         return tag_ptr(ret_conv, true);
22976 }
22977 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(int64_t arg) {
22978         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
22979         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
22980         return ret_conv;
22981 }
22982
22983 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone(int64_t orig) {
22984         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
22985         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22986         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
22987         return tag_ptr(ret_conv, true);
22988 }
22989
22990 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_ok(int64_t o) {
22991         LDKBlindedForward o_conv;
22992         o_conv.inner = untag_ptr(o);
22993         o_conv.is_owned = ptr_is_owned(o);
22994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22995         o_conv = BlindedForward_clone(&o_conv);
22996         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22997         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
22998         return tag_ptr(ret_conv, true);
22999 }
23000
23001 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_err(int64_t e) {
23002         void* e_ptr = untag_ptr(e);
23003         CHECK_ACCESS(e_ptr);
23004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23006         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
23007         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
23008         return tag_ptr(ret_conv, true);
23009 }
23010
23011 jboolean  CS_LDK_CResult_BlindedForwardDecodeErrorZ_is_ok(int64_t o) {
23012         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
23013         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
23014         return ret_conv;
23015 }
23016
23017 void  CS_LDK_CResult_BlindedForwardDecodeErrorZ_free(int64_t _res) {
23018         if (!ptr_is_owned(_res)) return;
23019         void* _res_ptr = untag_ptr(_res);
23020         CHECK_ACCESS(_res_ptr);
23021         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
23022         FREE(untag_ptr(_res));
23023         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
23024 }
23025
23026 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
23027         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
23028         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
23029         return tag_ptr(ret_conv, true);
23030 }
23031 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone_ptr(int64_t arg) {
23032         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
23033         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
23034         return ret_conv;
23035 }
23036
23037 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone(int64_t orig) {
23038         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
23039         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
23040         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
23041         return tag_ptr(ret_conv, true);
23042 }
23043
23044 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_ok(int64_t o) {
23045         void* o_ptr = untag_ptr(o);
23046         CHECK_ACCESS(o_ptr);
23047         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
23048         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
23049         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23050         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
23051         return tag_ptr(ret_conv, true);
23052 }
23053
23054 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_err(int64_t e) {
23055         void* e_ptr = untag_ptr(e);
23056         CHECK_ACCESS(e_ptr);
23057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23059         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23060         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
23061         return tag_ptr(ret_conv, true);
23062 }
23063
23064 jboolean  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(int64_t o) {
23065         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
23066         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
23067         return ret_conv;
23068 }
23069
23070 void  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_free(int64_t _res) {
23071         if (!ptr_is_owned(_res)) return;
23072         void* _res_ptr = untag_ptr(_res);
23073         CHECK_ACCESS(_res_ptr);
23074         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
23075         FREE(untag_ptr(_res));
23076         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
23077 }
23078
23079 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
23080         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23081         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
23082         return tag_ptr(ret_conv, true);
23083 }
23084 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(int64_t arg) {
23085         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
23086         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
23087         return ret_conv;
23088 }
23089
23090 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone(int64_t orig) {
23091         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
23092         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23093         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
23094         return tag_ptr(ret_conv, true);
23095 }
23096
23097 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_ok(int64_t o) {
23098         LDKPendingHTLCInfo o_conv;
23099         o_conv.inner = untag_ptr(o);
23100         o_conv.is_owned = ptr_is_owned(o);
23101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23102         o_conv = PendingHTLCInfo_clone(&o_conv);
23103         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23104         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
23105         return tag_ptr(ret_conv, true);
23106 }
23107
23108 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_err(int64_t e) {
23109         void* e_ptr = untag_ptr(e);
23110         CHECK_ACCESS(e_ptr);
23111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23113         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23114         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
23115         return tag_ptr(ret_conv, true);
23116 }
23117
23118 jboolean  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(int64_t o) {
23119         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
23120         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
23121         return ret_conv;
23122 }
23123
23124 void  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_free(int64_t _res) {
23125         if (!ptr_is_owned(_res)) return;
23126         void* _res_ptr = untag_ptr(_res);
23127         CHECK_ACCESS(_res_ptr);
23128         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
23129         FREE(untag_ptr(_res));
23130         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
23131 }
23132
23133 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
23134         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23135         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
23136         return tag_ptr(ret_conv, true);
23137 }
23138 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23139         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
23140         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
23141         return ret_conv;
23142 }
23143
23144 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone(int64_t orig) {
23145         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
23146         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23147         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
23148         return tag_ptr(ret_conv, true);
23149 }
23150
23151 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_ok(int32_t o) {
23152         LDKBlindedFailure o_conv = LDKBlindedFailure_from_cs(o);
23153         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23154         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
23155         return tag_ptr(ret_conv, true);
23156 }
23157
23158 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_err(int64_t e) {
23159         void* e_ptr = untag_ptr(e);
23160         CHECK_ACCESS(e_ptr);
23161         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23162         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23163         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23164         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
23165         return tag_ptr(ret_conv, true);
23166 }
23167
23168 jboolean  CS_LDK_CResult_BlindedFailureDecodeErrorZ_is_ok(int64_t o) {
23169         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
23170         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
23171         return ret_conv;
23172 }
23173
23174 void  CS_LDK_CResult_BlindedFailureDecodeErrorZ_free(int64_t _res) {
23175         if (!ptr_is_owned(_res)) return;
23176         void* _res_ptr = untag_ptr(_res);
23177         CHECK_ACCESS(_res_ptr);
23178         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
23179         FREE(untag_ptr(_res));
23180         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
23181 }
23182
23183 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
23184         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23185         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
23186         return tag_ptr(ret_conv, true);
23187 }
23188 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone_ptr(int64_t arg) {
23189         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
23190         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
23191         return ret_conv;
23192 }
23193
23194 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone(int64_t orig) {
23195         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
23196         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23197         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
23198         return tag_ptr(ret_conv, true);
23199 }
23200
23201 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_ok(int32_t o) {
23202         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
23203         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23204         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
23205         return tag_ptr(ret_conv, true);
23206 }
23207
23208 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_err(int64_t e) {
23209         void* e_ptr = untag_ptr(e);
23210         CHECK_ACCESS(e_ptr);
23211         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23212         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23213         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23214         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
23215         return tag_ptr(ret_conv, true);
23216 }
23217
23218 jboolean  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(int64_t o) {
23219         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
23220         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
23221         return ret_conv;
23222 }
23223
23224 void  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_free(int64_t _res) {
23225         if (!ptr_is_owned(_res)) return;
23226         void* _res_ptr = untag_ptr(_res);
23227         CHECK_ACCESS(_res_ptr);
23228         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
23229         FREE(untag_ptr(_res));
23230         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
23231 }
23232
23233 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
23234         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23235         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
23236         return tag_ptr(ret_conv, true);
23237 }
23238 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(int64_t arg) {
23239         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
23240         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
23241         return ret_conv;
23242 }
23243
23244 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone(int64_t orig) {
23245         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
23246         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23247         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
23248         return tag_ptr(ret_conv, true);
23249 }
23250
23251 void  CS_LDK_CVec_ChannelMonitorZ_free(int64_tArray _res) {
23252         LDKCVec_ChannelMonitorZ _res_constr;
23253         _res_constr.datalen = _res->arr_len;
23254         if (_res_constr.datalen > 0)
23255                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
23256         else
23257                 _res_constr.data = NULL;
23258         int64_t* _res_vals = _res->elems;
23259         for (size_t q = 0; q < _res_constr.datalen; q++) {
23260                 int64_t _res_conv_16 = _res_vals[q];
23261                 LDKChannelMonitor _res_conv_16_conv;
23262                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23263                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23264                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23265                 _res_constr.data[q] = _res_conv_16_conv;
23266         }
23267         FREE(_res);
23268         CVec_ChannelMonitorZ_free(_res_constr);
23269 }
23270
23271 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, int64_t b) {
23272         LDKThirtyTwoBytes a_ref;
23273         CHECK(a->arr_len == 32);
23274         memcpy(a_ref.data, a->elems, 32); FREE(a);
23275         LDKChannelManager b_conv;
23276         b_conv.inner = untag_ptr(b);
23277         b_conv.is_owned = ptr_is_owned(b);
23278         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23279         // WARNING: we need a move here but no clone is available for LDKChannelManager
23280         
23281         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
23282         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
23283         return tag_ptr(ret_conv, true);
23284 }
23285
23286 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(int64_t _res) {
23287         if (!ptr_is_owned(_res)) return;
23288         void* _res_ptr = untag_ptr(_res);
23289         CHECK_ACCESS(_res_ptr);
23290         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
23291         FREE(untag_ptr(_res));
23292         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
23293 }
23294
23295 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(int64_t o) {
23296         void* o_ptr = untag_ptr(o);
23297         CHECK_ACCESS(o_ptr);
23298         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
23299         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
23300         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
23301         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
23302         return tag_ptr(ret_conv, true);
23303 }
23304
23305 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(int64_t e) {
23306         void* e_ptr = untag_ptr(e);
23307         CHECK_ACCESS(e_ptr);
23308         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23309         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23310         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
23311         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
23312         return tag_ptr(ret_conv, true);
23313 }
23314
23315 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(int64_t o) {
23316         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
23317         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
23318         return ret_conv;
23319 }
23320
23321 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(int64_t _res) {
23322         if (!ptr_is_owned(_res)) return;
23323         void* _res_ptr = untag_ptr(_res);
23324         CHECK_ACCESS(_res_ptr);
23325         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
23326         FREE(untag_ptr(_res));
23327         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
23328 }
23329
23330 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(int64_t o) {
23331         void* o_ptr = untag_ptr(o);
23332         CHECK_ACCESS(o_ptr);
23333         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23334         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23335         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23336         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
23337         return tag_ptr(ret_conv, true);
23338 }
23339
23340 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_err(int64_t e) {
23341         void* e_ptr = untag_ptr(e);
23342         CHECK_ACCESS(e_ptr);
23343         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23344         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23345         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23346         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
23347         return tag_ptr(ret_conv, true);
23348 }
23349
23350 jboolean  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(int64_t o) {
23351         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
23352         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
23353         return ret_conv;
23354 }
23355
23356 void  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_free(int64_t _res) {
23357         if (!ptr_is_owned(_res)) return;
23358         void* _res_ptr = untag_ptr(_res);
23359         CHECK_ACCESS(_res_ptr);
23360         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
23361         FREE(untag_ptr(_res));
23362         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
23363 }
23364
23365 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
23366         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23367         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
23368         return tag_ptr(ret_conv, true);
23369 }
23370 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(int64_t arg) {
23371         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
23372         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
23373         return ret_conv;
23374 }
23375
23376 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(int64_t orig) {
23377         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
23378         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23379         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
23380         return tag_ptr(ret_conv, true);
23381 }
23382
23383 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_ok(int64_t o) {
23384         LDKChannelConfig o_conv;
23385         o_conv.inner = untag_ptr(o);
23386         o_conv.is_owned = ptr_is_owned(o);
23387         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23388         o_conv = ChannelConfig_clone(&o_conv);
23389         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23390         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
23391         return tag_ptr(ret_conv, true);
23392 }
23393
23394 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_err(int64_t e) {
23395         void* e_ptr = untag_ptr(e);
23396         CHECK_ACCESS(e_ptr);
23397         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23398         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23399         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23400         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
23401         return tag_ptr(ret_conv, true);
23402 }
23403
23404 jboolean  CS_LDK_CResult_ChannelConfigDecodeErrorZ_is_ok(int64_t o) {
23405         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
23406         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
23407         return ret_conv;
23408 }
23409
23410 void  CS_LDK_CResult_ChannelConfigDecodeErrorZ_free(int64_t _res) {
23411         if (!ptr_is_owned(_res)) return;
23412         void* _res_ptr = untag_ptr(_res);
23413         CHECK_ACCESS(_res_ptr);
23414         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
23415         FREE(untag_ptr(_res));
23416         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
23417 }
23418
23419 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
23420         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23421         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
23422         return tag_ptr(ret_conv, true);
23423 }
23424 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone_ptr(int64_t arg) {
23425         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
23426         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
23427         return ret_conv;
23428 }
23429
23430 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone(int64_t orig) {
23431         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
23432         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23433         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
23434         return tag_ptr(ret_conv, true);
23435 }
23436
23437 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_some(int64_t o) {
23438         void* o_ptr = untag_ptr(o);
23439         CHECK_ACCESS(o_ptr);
23440         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23441         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23442         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23443         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
23444         int64_t ret_ref = tag_ptr(ret_copy, true);
23445         return ret_ref;
23446 }
23447
23448 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_none() {
23449         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23450         *ret_copy = COption_MaxDustHTLCExposureZ_none();
23451         int64_t ret_ref = tag_ptr(ret_copy, true);
23452         return ret_ref;
23453 }
23454
23455 void  CS_LDK_COption_MaxDustHTLCExposureZ_free(int64_t _res) {
23456         if (!ptr_is_owned(_res)) return;
23457         void* _res_ptr = untag_ptr(_res);
23458         CHECK_ACCESS(_res_ptr);
23459         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
23460         FREE(untag_ptr(_res));
23461         COption_MaxDustHTLCExposureZ_free(_res_conv);
23462 }
23463
23464 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
23465         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23466         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
23467         int64_t ret_ref = tag_ptr(ret_copy, true);
23468         return ret_ref;
23469 }
23470 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone_ptr(int64_t arg) {
23471         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
23472         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
23473         return ret_conv;
23474 }
23475
23476 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone(int64_t orig) {
23477         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
23478         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23479         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
23480         int64_t ret_ref = tag_ptr(ret_copy, true);
23481         return ret_ref;
23482 }
23483
23484 int64_t  CS_LDK_COption_APIErrorZ_some(int64_t o) {
23485         void* o_ptr = untag_ptr(o);
23486         CHECK_ACCESS(o_ptr);
23487         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
23488         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
23489         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23490         *ret_copy = COption_APIErrorZ_some(o_conv);
23491         int64_t ret_ref = tag_ptr(ret_copy, true);
23492         return ret_ref;
23493 }
23494
23495 int64_t  CS_LDK_COption_APIErrorZ_none() {
23496         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23497         *ret_copy = COption_APIErrorZ_none();
23498         int64_t ret_ref = tag_ptr(ret_copy, true);
23499         return ret_ref;
23500 }
23501
23502 void  CS_LDK_COption_APIErrorZ_free(int64_t _res) {
23503         if (!ptr_is_owned(_res)) return;
23504         void* _res_ptr = untag_ptr(_res);
23505         CHECK_ACCESS(_res_ptr);
23506         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
23507         FREE(untag_ptr(_res));
23508         COption_APIErrorZ_free(_res_conv);
23509 }
23510
23511 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
23512         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23513         *ret_copy = COption_APIErrorZ_clone(arg);
23514         int64_t ret_ref = tag_ptr(ret_copy, true);
23515         return ret_ref;
23516 }
23517 int64_t  CS_LDK_COption_APIErrorZ_clone_ptr(int64_t arg) {
23518         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
23519         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
23520         return ret_conv;
23521 }
23522
23523 int64_t  CS_LDK_COption_APIErrorZ_clone(int64_t orig) {
23524         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
23525         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23526         *ret_copy = COption_APIErrorZ_clone(orig_conv);
23527         int64_t ret_ref = tag_ptr(ret_copy, true);
23528         return ret_ref;
23529 }
23530
23531 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_ok(int64_t o) {
23532         void* o_ptr = untag_ptr(o);
23533         CHECK_ACCESS(o_ptr);
23534         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
23535         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
23536         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23537         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
23538         return tag_ptr(ret_conv, true);
23539 }
23540
23541 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_err(int64_t e) {
23542         void* e_ptr = untag_ptr(e);
23543         CHECK_ACCESS(e_ptr);
23544         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23545         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23546         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23547         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
23548         return tag_ptr(ret_conv, true);
23549 }
23550
23551 jboolean  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_is_ok(int64_t o) {
23552         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
23553         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
23554         return ret_conv;
23555 }
23556
23557 void  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_free(int64_t _res) {
23558         if (!ptr_is_owned(_res)) return;
23559         void* _res_ptr = untag_ptr(_res);
23560         CHECK_ACCESS(_res_ptr);
23561         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
23562         FREE(untag_ptr(_res));
23563         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
23564 }
23565
23566 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
23567         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23568         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
23569         return tag_ptr(ret_conv, true);
23570 }
23571 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(int64_t arg) {
23572         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
23573         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
23574         return ret_conv;
23575 }
23576
23577 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone(int64_t orig) {
23578         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
23579         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23580         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
23581         return tag_ptr(ret_conv, true);
23582 }
23583
23584 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(int64_t o) {
23585         LDKChannelMonitorUpdate o_conv;
23586         o_conv.inner = untag_ptr(o);
23587         o_conv.is_owned = ptr_is_owned(o);
23588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23589         o_conv = ChannelMonitorUpdate_clone(&o_conv);
23590         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23591         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
23592         return tag_ptr(ret_conv, true);
23593 }
23594
23595 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_err(int64_t e) {
23596         void* e_ptr = untag_ptr(e);
23597         CHECK_ACCESS(e_ptr);
23598         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23599         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23600         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23601         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
23602         return tag_ptr(ret_conv, true);
23603 }
23604
23605 jboolean  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(int64_t o) {
23606         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
23607         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
23608         return ret_conv;
23609 }
23610
23611 void  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_free(int64_t _res) {
23612         if (!ptr_is_owned(_res)) return;
23613         void* _res_ptr = untag_ptr(_res);
23614         CHECK_ACCESS(_res_ptr);
23615         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
23616         FREE(untag_ptr(_res));
23617         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
23618 }
23619
23620 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
23621         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23622         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
23623         return tag_ptr(ret_conv, true);
23624 }
23625 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
23626         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
23627         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
23628         return ret_conv;
23629 }
23630
23631 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(int64_t orig) {
23632         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
23633         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23634         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
23635         return tag_ptr(ret_conv, true);
23636 }
23637
23638 int64_t  CS_LDK_COption_MonitorEventZ_some(int64_t o) {
23639         void* o_ptr = untag_ptr(o);
23640         CHECK_ACCESS(o_ptr);
23641         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
23642         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
23643         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23644         *ret_copy = COption_MonitorEventZ_some(o_conv);
23645         int64_t ret_ref = tag_ptr(ret_copy, true);
23646         return ret_ref;
23647 }
23648
23649 int64_t  CS_LDK_COption_MonitorEventZ_none() {
23650         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23651         *ret_copy = COption_MonitorEventZ_none();
23652         int64_t ret_ref = tag_ptr(ret_copy, true);
23653         return ret_ref;
23654 }
23655
23656 void  CS_LDK_COption_MonitorEventZ_free(int64_t _res) {
23657         if (!ptr_is_owned(_res)) return;
23658         void* _res_ptr = untag_ptr(_res);
23659         CHECK_ACCESS(_res_ptr);
23660         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
23661         FREE(untag_ptr(_res));
23662         COption_MonitorEventZ_free(_res_conv);
23663 }
23664
23665 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
23666         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23667         *ret_copy = COption_MonitorEventZ_clone(arg);
23668         int64_t ret_ref = tag_ptr(ret_copy, true);
23669         return ret_ref;
23670 }
23671 int64_t  CS_LDK_COption_MonitorEventZ_clone_ptr(int64_t arg) {
23672         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
23673         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
23674         return ret_conv;
23675 }
23676
23677 int64_t  CS_LDK_COption_MonitorEventZ_clone(int64_t orig) {
23678         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
23679         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23680         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
23681         int64_t ret_ref = tag_ptr(ret_copy, true);
23682         return ret_ref;
23683 }
23684
23685 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_ok(int64_t o) {
23686         void* o_ptr = untag_ptr(o);
23687         CHECK_ACCESS(o_ptr);
23688         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
23689         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
23690         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23691         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
23692         return tag_ptr(ret_conv, true);
23693 }
23694
23695 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_err(int64_t e) {
23696         void* e_ptr = untag_ptr(e);
23697         CHECK_ACCESS(e_ptr);
23698         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23699         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23700         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23701         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
23702         return tag_ptr(ret_conv, true);
23703 }
23704
23705 jboolean  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(int64_t o) {
23706         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
23707         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
23708         return ret_conv;
23709 }
23710
23711 void  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_free(int64_t _res) {
23712         if (!ptr_is_owned(_res)) return;
23713         void* _res_ptr = untag_ptr(_res);
23714         CHECK_ACCESS(_res_ptr);
23715         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
23716         FREE(untag_ptr(_res));
23717         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
23718 }
23719
23720 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
23721         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23722         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
23723         return tag_ptr(ret_conv, true);
23724 }
23725 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(int64_t arg) {
23726         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
23727         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
23728         return ret_conv;
23729 }
23730
23731 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone(int64_t orig) {
23732         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
23733         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23734         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
23735         return tag_ptr(ret_conv, true);
23736 }
23737
23738 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_ok(int64_t o) {
23739         LDKHTLCUpdate o_conv;
23740         o_conv.inner = untag_ptr(o);
23741         o_conv.is_owned = ptr_is_owned(o);
23742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23743         o_conv = HTLCUpdate_clone(&o_conv);
23744         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23745         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
23746         return tag_ptr(ret_conv, true);
23747 }
23748
23749 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_err(int64_t e) {
23750         void* e_ptr = untag_ptr(e);
23751         CHECK_ACCESS(e_ptr);
23752         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23753         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23754         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23755         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
23756         return tag_ptr(ret_conv, true);
23757 }
23758
23759 jboolean  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_is_ok(int64_t o) {
23760         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
23761         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
23762         return ret_conv;
23763 }
23764
23765 void  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_free(int64_t _res) {
23766         if (!ptr_is_owned(_res)) return;
23767         void* _res_ptr = untag_ptr(_res);
23768         CHECK_ACCESS(_res_ptr);
23769         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
23770         FREE(untag_ptr(_res));
23771         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
23772 }
23773
23774 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
23775         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23776         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
23777         return tag_ptr(ret_conv, true);
23778 }
23779 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
23780         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
23781         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
23782         return ret_conv;
23783 }
23784
23785 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone(int64_t orig) {
23786         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
23787         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23788         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
23789         return tag_ptr(ret_conv, true);
23790 }
23791
23792 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
23793         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23794         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
23795         return tag_ptr(ret_conv, true);
23796 }
23797 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(int64_t arg) {
23798         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
23799         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
23800         return ret_conv;
23801 }
23802
23803 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone(int64_t orig) {
23804         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
23805         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23806         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
23807         return tag_ptr(ret_conv, true);
23808 }
23809
23810 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_new(int64_t a, int8_tArray b) {
23811         LDKOutPoint a_conv;
23812         a_conv.inner = untag_ptr(a);
23813         a_conv.is_owned = ptr_is_owned(a);
23814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23815         a_conv = OutPoint_clone(&a_conv);
23816         LDKCVec_u8Z b_ref;
23817         b_ref.datalen = b->arr_len;
23818         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23819         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23820         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23821         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
23822         return tag_ptr(ret_conv, true);
23823 }
23824
23825 void  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_free(int64_t _res) {
23826         if (!ptr_is_owned(_res)) return;
23827         void* _res_ptr = untag_ptr(_res);
23828         CHECK_ACCESS(_res_ptr);
23829         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
23830         FREE(untag_ptr(_res));
23831         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
23832 }
23833
23834 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
23835         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23836         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
23837         return tag_ptr(ret_conv, true);
23838 }
23839 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone_ptr(int64_t arg) {
23840         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
23841         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
23842         return ret_conv;
23843 }
23844
23845 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone(int64_t orig) {
23846         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
23847         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23848         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
23849         return tag_ptr(ret_conv, true);
23850 }
23851
23852 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
23853         LDKCVec_u8Z b_ref;
23854         b_ref.datalen = b->arr_len;
23855         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23856         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23857         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23858         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
23859         return tag_ptr(ret_conv, true);
23860 }
23861
23862 void  CS_LDK_C2Tuple_u32CVec_u8ZZ_free(int64_t _res) {
23863         if (!ptr_is_owned(_res)) return;
23864         void* _res_ptr = untag_ptr(_res);
23865         CHECK_ACCESS(_res_ptr);
23866         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
23867         FREE(untag_ptr(_res));
23868         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
23869 }
23870
23871 void  CS_LDK_CVec_C2Tuple_u32CVec_u8ZZZ_free(int64_tArray _res) {
23872         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
23873         _res_constr.datalen = _res->arr_len;
23874         if (_res_constr.datalen > 0)
23875                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23876         else
23877                 _res_constr.data = NULL;
23878         int64_t* _res_vals = _res->elems;
23879         for (size_t x = 0; x < _res_constr.datalen; x++) {
23880                 int64_t _res_conv_23 = _res_vals[x];
23881                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
23882                 CHECK_ACCESS(_res_conv_23_ptr);
23883                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
23884                 FREE(untag_ptr(_res_conv_23));
23885                 _res_constr.data[x] = _res_conv_23_conv;
23886         }
23887         FREE(_res);
23888         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
23889 }
23890
23891 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
23892         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23893         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
23894         return tag_ptr(ret_conv, true);
23895 }
23896 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(int64_t arg) {
23897         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
23898         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
23899         return ret_conv;
23900 }
23901
23902 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(int64_t orig) {
23903         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
23904         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23905         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
23906         return tag_ptr(ret_conv, true);
23907 }
23908
23909 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(int8_tArray a, int64_tArray b) {
23910         LDKThirtyTwoBytes a_ref;
23911         CHECK(a->arr_len == 32);
23912         memcpy(a_ref.data, a->elems, 32); FREE(a);
23913         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
23914         b_constr.datalen = b->arr_len;
23915         if (b_constr.datalen > 0)
23916                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23917         else
23918                 b_constr.data = NULL;
23919         int64_t* b_vals = b->elems;
23920         for (size_t x = 0; x < b_constr.datalen; x++) {
23921                 int64_t b_conv_23 = b_vals[x];
23922                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
23923                 CHECK_ACCESS(b_conv_23_ptr);
23924                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
23925                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
23926                 b_constr.data[x] = b_conv_23_conv;
23927         }
23928         FREE(b);
23929         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23930         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
23931         return tag_ptr(ret_conv, true);
23932 }
23933
23934 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(int64_t _res) {
23935         if (!ptr_is_owned(_res)) return;
23936         void* _res_ptr = untag_ptr(_res);
23937         CHECK_ACCESS(_res_ptr);
23938         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
23939         FREE(untag_ptr(_res));
23940         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
23941 }
23942
23943 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(int64_tArray _res) {
23944         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
23945         _res_constr.datalen = _res->arr_len;
23946         if (_res_constr.datalen > 0)
23947                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
23948         else
23949                 _res_constr.data = NULL;
23950         int64_t* _res_vals = _res->elems;
23951         for (size_t a = 0; a < _res_constr.datalen; a++) {
23952                 int64_t _res_conv_52 = _res_vals[a];
23953                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
23954                 CHECK_ACCESS(_res_conv_52_ptr);
23955                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
23956                 FREE(untag_ptr(_res_conv_52));
23957                 _res_constr.data[a] = _res_conv_52_conv;
23958         }
23959         FREE(_res);
23960         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
23961 }
23962
23963 void  CS_LDK_CVec_CommitmentTransactionZ_free(int64_tArray _res) {
23964         LDKCVec_CommitmentTransactionZ _res_constr;
23965         _res_constr.datalen = _res->arr_len;
23966         if (_res_constr.datalen > 0)
23967                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
23968         else
23969                 _res_constr.data = NULL;
23970         int64_t* _res_vals = _res->elems;
23971         for (size_t x = 0; x < _res_constr.datalen; x++) {
23972                 int64_t _res_conv_23 = _res_vals[x];
23973                 LDKCommitmentTransaction _res_conv_23_conv;
23974                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
23975                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
23976                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
23977                 _res_constr.data[x] = _res_conv_23_conv;
23978         }
23979         FREE(_res);
23980         CVec_CommitmentTransactionZ_free(_res_constr);
23981 }
23982
23983 void  CS_LDK_CVec_TransactionZ_free(ptrArray _res) {
23984         LDKCVec_TransactionZ _res_constr;
23985         _res_constr.datalen = _res->arr_len;
23986         if (_res_constr.datalen > 0)
23987                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
23988         else
23989                 _res_constr.data = NULL;
23990         int8_tArray* _res_vals = (void*) _res->elems;
23991         for (size_t i = 0; i < _res_constr.datalen; i++) {
23992                 int8_tArray _res_conv_8 = _res_vals[i];
23993                 LDKTransaction _res_conv_8_ref;
23994                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
23995                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
23996                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
23997                 _res_conv_8_ref.data_is_owned = true;
23998                 _res_constr.data[i] = _res_conv_8_ref;
23999         }
24000         FREE(_res);
24001         CVec_TransactionZ_free(_res_constr);
24002 }
24003
24004 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
24005         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
24006         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
24007         return tag_ptr(ret_conv, true);
24008 }
24009 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone_ptr(int64_t arg) {
24010         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
24011         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
24012         return ret_conv;
24013 }
24014
24015 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone(int64_t orig) {
24016         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
24017         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
24018         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
24019         return tag_ptr(ret_conv, true);
24020 }
24021
24022 int64_t  CS_LDK_C2Tuple_u32TxOutZ_new(int32_t a, int64_t b) {
24023         void* b_ptr = untag_ptr(b);
24024         CHECK_ACCESS(b_ptr);
24025         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
24026         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
24027         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
24028         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
24029         return tag_ptr(ret_conv, true);
24030 }
24031
24032 void  CS_LDK_C2Tuple_u32TxOutZ_free(int64_t _res) {
24033         if (!ptr_is_owned(_res)) return;
24034         void* _res_ptr = untag_ptr(_res);
24035         CHECK_ACCESS(_res_ptr);
24036         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
24037         FREE(untag_ptr(_res));
24038         C2Tuple_u32TxOutZ_free(_res_conv);
24039 }
24040
24041 void  CS_LDK_CVec_C2Tuple_u32TxOutZZ_free(int64_tArray _res) {
24042         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
24043         _res_constr.datalen = _res->arr_len;
24044         if (_res_constr.datalen > 0)
24045                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
24046         else
24047                 _res_constr.data = NULL;
24048         int64_t* _res_vals = _res->elems;
24049         for (size_t u = 0; u < _res_constr.datalen; u++) {
24050                 int64_t _res_conv_20 = _res_vals[u];
24051                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
24052                 CHECK_ACCESS(_res_conv_20_ptr);
24053                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
24054                 FREE(untag_ptr(_res_conv_20));
24055                 _res_constr.data[u] = _res_conv_20_conv;
24056         }
24057         FREE(_res);
24058         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
24059 }
24060
24061 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
24062         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
24063         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
24064         return tag_ptr(ret_conv, true);
24065 }
24066 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(int64_t arg) {
24067         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
24068         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
24069         return ret_conv;
24070 }
24071
24072 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(int64_t orig) {
24073         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
24074         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
24075         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
24076         return tag_ptr(ret_conv, true);
24077 }
24078
24079 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, int64_tArray b) {
24080         LDKThirtyTwoBytes a_ref;
24081         CHECK(a->arr_len == 32);
24082         memcpy(a_ref.data, a->elems, 32); FREE(a);
24083         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
24084         b_constr.datalen = b->arr_len;
24085         if (b_constr.datalen > 0)
24086                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
24087         else
24088                 b_constr.data = NULL;
24089         int64_t* b_vals = b->elems;
24090         for (size_t u = 0; u < b_constr.datalen; u++) {
24091                 int64_t b_conv_20 = b_vals[u];
24092                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
24093                 CHECK_ACCESS(b_conv_20_ptr);
24094                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
24095                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
24096                 b_constr.data[u] = b_conv_20_conv;
24097         }
24098         FREE(b);
24099         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
24100         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
24101         return tag_ptr(ret_conv, true);
24102 }
24103
24104 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(int64_t _res) {
24105         if (!ptr_is_owned(_res)) return;
24106         void* _res_ptr = untag_ptr(_res);
24107         CHECK_ACCESS(_res_ptr);
24108         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
24109         FREE(untag_ptr(_res));
24110         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
24111 }
24112
24113 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(int64_tArray _res) {
24114         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
24115         _res_constr.datalen = _res->arr_len;
24116         if (_res_constr.datalen > 0)
24117                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
24118         else
24119                 _res_constr.data = NULL;
24120         int64_t* _res_vals = _res->elems;
24121         for (size_t x = 0; x < _res_constr.datalen; x++) {
24122                 int64_t _res_conv_49 = _res_vals[x];
24123                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
24124                 CHECK_ACCESS(_res_conv_49_ptr);
24125                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
24126                 FREE(untag_ptr(_res_conv_49));
24127                 _res_constr.data[x] = _res_conv_49_conv;
24128         }
24129         FREE(_res);
24130         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
24131 }
24132
24133 void  CS_LDK_CVec_BalanceZ_free(int64_tArray _res) {
24134         LDKCVec_BalanceZ _res_constr;
24135         _res_constr.datalen = _res->arr_len;
24136         if (_res_constr.datalen > 0)
24137                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
24138         else
24139                 _res_constr.data = NULL;
24140         int64_t* _res_vals = _res->elems;
24141         for (size_t j = 0; j < _res_constr.datalen; j++) {
24142                 int64_t _res_conv_9 = _res_vals[j];
24143                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
24144                 CHECK_ACCESS(_res_conv_9_ptr);
24145                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
24146                 FREE(untag_ptr(_res_conv_9));
24147                 _res_constr.data[j] = _res_conv_9_conv;
24148         }
24149         FREE(_res);
24150         CVec_BalanceZ_free(_res_constr);
24151 }
24152
24153 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
24154         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
24155         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
24156         return tag_ptr(ret_conv, true);
24157 }
24158 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(int64_t arg) {
24159         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
24160         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
24161         return ret_conv;
24162 }
24163
24164 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(int64_t orig) {
24165         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
24166         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
24167         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
24168         return tag_ptr(ret_conv, true);
24169 }
24170
24171 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, int64_t b) {
24172         LDKThirtyTwoBytes a_ref;
24173         CHECK(a->arr_len == 32);
24174         memcpy(a_ref.data, a->elems, 32); FREE(a);
24175         LDKChannelMonitor b_conv;
24176         b_conv.inner = untag_ptr(b);
24177         b_conv.is_owned = ptr_is_owned(b);
24178         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24179         b_conv = ChannelMonitor_clone(&b_conv);
24180         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
24181         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
24182         return tag_ptr(ret_conv, true);
24183 }
24184
24185 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(int64_t _res) {
24186         if (!ptr_is_owned(_res)) return;
24187         void* _res_ptr = untag_ptr(_res);
24188         CHECK_ACCESS(_res_ptr);
24189         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
24190         FREE(untag_ptr(_res));
24191         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
24192 }
24193
24194 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(int64_t o) {
24195         void* o_ptr = untag_ptr(o);
24196         CHECK_ACCESS(o_ptr);
24197         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
24198         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
24199         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24200         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
24201         return tag_ptr(ret_conv, true);
24202 }
24203
24204 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(int64_t e) {
24205         void* e_ptr = untag_ptr(e);
24206         CHECK_ACCESS(e_ptr);
24207         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24208         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24209         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24210         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
24211         return tag_ptr(ret_conv, true);
24212 }
24213
24214 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(int64_t o) {
24215         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
24216         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
24217         return ret_conv;
24218 }
24219
24220 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(int64_t _res) {
24221         if (!ptr_is_owned(_res)) return;
24222         void* _res_ptr = untag_ptr(_res);
24223         CHECK_ACCESS(_res_ptr);
24224         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
24225         FREE(untag_ptr(_res));
24226         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
24227 }
24228
24229 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
24230         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24231         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
24232         return tag_ptr(ret_conv, true);
24233 }
24234 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(int64_t arg) {
24235         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
24236         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
24237         return ret_conv;
24238 }
24239
24240 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(int64_t orig) {
24241         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
24242         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24243         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
24244         return tag_ptr(ret_conv, true);
24245 }
24246
24247 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
24248         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
24249         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
24250         return tag_ptr(ret_conv, true);
24251 }
24252 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone_ptr(int64_t arg) {
24253         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
24254         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
24255         return ret_conv;
24256 }
24257
24258 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone(int64_t orig) {
24259         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
24260         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
24261         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
24262         return tag_ptr(ret_conv, true);
24263 }
24264
24265 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, int64_t b) {
24266         LDKPublicKey a_ref;
24267         CHECK(a->arr_len == 33);
24268         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24269         void* b_ptr = untag_ptr(b);
24270         CHECK_ACCESS(b_ptr);
24271         LDKType b_conv = *(LDKType*)(b_ptr);
24272         if (b_conv.free == LDKType_JCalls_free) {
24273                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24274                 LDKType_JCalls_cloned(&b_conv);
24275         }
24276         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
24277         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
24278         return tag_ptr(ret_conv, true);
24279 }
24280
24281 void  CS_LDK_C2Tuple_PublicKeyTypeZ_free(int64_t _res) {
24282         if (!ptr_is_owned(_res)) return;
24283         void* _res_ptr = untag_ptr(_res);
24284         CHECK_ACCESS(_res_ptr);
24285         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
24286         FREE(untag_ptr(_res));
24287         C2Tuple_PublicKeyTypeZ_free(_res_conv);
24288 }
24289
24290 void  CS_LDK_CVec_C2Tuple_PublicKeyTypeZZ_free(int64_tArray _res) {
24291         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
24292         _res_constr.datalen = _res->arr_len;
24293         if (_res_constr.datalen > 0)
24294                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
24295         else
24296                 _res_constr.data = NULL;
24297         int64_t* _res_vals = _res->elems;
24298         for (size_t z = 0; z < _res_constr.datalen; z++) {
24299                 int64_t _res_conv_25 = _res_vals[z];
24300                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
24301                 CHECK_ACCESS(_res_conv_25_ptr);
24302                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
24303                 FREE(untag_ptr(_res_conv_25));
24304                 _res_constr.data[z] = _res_conv_25_conv;
24305         }
24306         FREE(_res);
24307         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
24308 }
24309
24310 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
24311         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24312         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
24313         return tag_ptr(ret_conv, true);
24314 }
24315 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(int64_t arg) {
24316         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
24317         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
24318         return ret_conv;
24319 }
24320
24321 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(int64_t orig) {
24322         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
24323         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24324         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
24325         return tag_ptr(ret_conv, true);
24326 }
24327
24328 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, int64_tArray b) {
24329         LDKPublicKey a_ref;
24330         CHECK(a->arr_len == 33);
24331         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24332         LDKCVec_SocketAddressZ b_constr;
24333         b_constr.datalen = b->arr_len;
24334         if (b_constr.datalen > 0)
24335                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24336         else
24337                 b_constr.data = NULL;
24338         int64_t* b_vals = b->elems;
24339         for (size_t p = 0; p < b_constr.datalen; p++) {
24340                 int64_t b_conv_15 = b_vals[p];
24341                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
24342                 CHECK_ACCESS(b_conv_15_ptr);
24343                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
24344                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
24345                 b_constr.data[p] = b_conv_15_conv;
24346         }
24347         FREE(b);
24348         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24349         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
24350         return tag_ptr(ret_conv, true);
24351 }
24352
24353 void  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(int64_t _res) {
24354         if (!ptr_is_owned(_res)) return;
24355         void* _res_ptr = untag_ptr(_res);
24356         CHECK_ACCESS(_res_ptr);
24357         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
24358         FREE(untag_ptr(_res));
24359         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
24360 }
24361
24362 void  CS_LDK_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(int64_tArray _res) {
24363         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
24364         _res_constr.datalen = _res->arr_len;
24365         if (_res_constr.datalen > 0)
24366                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
24367         else
24368                 _res_constr.data = NULL;
24369         int64_t* _res_vals = _res->elems;
24370         for (size_t o = 0; o < _res_constr.datalen; o++) {
24371                 int64_t _res_conv_40 = _res_vals[o];
24372                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24373                 CHECK_ACCESS(_res_conv_40_ptr);
24374                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
24375                 FREE(untag_ptr(_res_conv_40));
24376                 _res_constr.data[o] = _res_conv_40_conv;
24377         }
24378         FREE(_res);
24379         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
24380 }
24381
24382 int64_t  CS_LDK_COption_OnionMessageContentsZ_some(int64_t o) {
24383         void* o_ptr = untag_ptr(o);
24384         CHECK_ACCESS(o_ptr);
24385         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
24386         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
24387                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24388                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
24389         }
24390         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24391         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
24392         int64_t ret_ref = tag_ptr(ret_copy, true);
24393         return ret_ref;
24394 }
24395
24396 int64_t  CS_LDK_COption_OnionMessageContentsZ_none() {
24397         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24398         *ret_copy = COption_OnionMessageContentsZ_none();
24399         int64_t ret_ref = tag_ptr(ret_copy, true);
24400         return ret_ref;
24401 }
24402
24403 void  CS_LDK_COption_OnionMessageContentsZ_free(int64_t _res) {
24404         if (!ptr_is_owned(_res)) return;
24405         void* _res_ptr = untag_ptr(_res);
24406         CHECK_ACCESS(_res_ptr);
24407         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
24408         FREE(untag_ptr(_res));
24409         COption_OnionMessageContentsZ_free(_res_conv);
24410 }
24411
24412 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
24413         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24414         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
24415         int64_t ret_ref = tag_ptr(ret_copy, true);
24416         return ret_ref;
24417 }
24418 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone_ptr(int64_t arg) {
24419         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
24420         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
24421         return ret_conv;
24422 }
24423
24424 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone(int64_t orig) {
24425         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
24426         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24427         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
24428         int64_t ret_ref = tag_ptr(ret_copy, true);
24429         return ret_ref;
24430 }
24431
24432 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(int64_t o) {
24433         void* o_ptr = untag_ptr(o);
24434         CHECK_ACCESS(o_ptr);
24435         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
24436         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
24437         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24438         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
24439         return tag_ptr(ret_conv, true);
24440 }
24441
24442 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(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_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24448         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
24449         return tag_ptr(ret_conv, true);
24450 }
24451
24452 jboolean  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(int64_t o) {
24453         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
24454         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
24455         return ret_conv;
24456 }
24457
24458 void  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(int64_t _res) {
24459         if (!ptr_is_owned(_res)) return;
24460         void* _res_ptr = untag_ptr(_res);
24461         CHECK_ACCESS(_res_ptr);
24462         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
24463         FREE(untag_ptr(_res));
24464         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
24465 }
24466
24467 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
24468         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24469         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
24470         return tag_ptr(ret_conv, true);
24471 }
24472 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(int64_t arg) {
24473         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
24474         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
24475         return ret_conv;
24476 }
24477
24478 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(int64_t orig) {
24479         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
24480         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24481         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
24482         return tag_ptr(ret_conv, true);
24483 }
24484
24485 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
24486         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24487         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
24488         return tag_ptr(ret_conv, true);
24489 }
24490 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(int64_t arg) {
24491         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
24492         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
24493         return ret_conv;
24494 }
24495
24496 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(int64_t orig) {
24497         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
24498         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24499         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
24500         return tag_ptr(ret_conv, true);
24501 }
24502
24503 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
24504         void* a_ptr = untag_ptr(a);
24505         CHECK_ACCESS(a_ptr);
24506         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
24507         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
24508                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24509                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
24510         }
24511         void* b_ptr = untag_ptr(b);
24512         CHECK_ACCESS(b_ptr);
24513         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24514         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24515         LDKBlindedPath c_conv;
24516         c_conv.inner = untag_ptr(c);
24517         c_conv.is_owned = ptr_is_owned(c);
24518         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24519         c_conv = BlindedPath_clone(&c_conv);
24520         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24521         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24522         return tag_ptr(ret_conv, true);
24523 }
24524
24525 void  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(int64_t _res) {
24526         if (!ptr_is_owned(_res)) return;
24527         void* _res_ptr = untag_ptr(_res);
24528         CHECK_ACCESS(_res_ptr);
24529         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
24530         FREE(untag_ptr(_res));
24531         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
24532 }
24533
24534 void  CS_LDK_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(int64_tArray _res) {
24535         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
24536         _res_constr.datalen = _res->arr_len;
24537         if (_res_constr.datalen > 0)
24538                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
24539         else
24540                 _res_constr.data = NULL;
24541         int64_t* _res_vals = _res->elems;
24542         for (size_t e = 0; e < _res_constr.datalen; e++) {
24543                 int64_t _res_conv_56 = _res_vals[e];
24544                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
24545                 CHECK_ACCESS(_res_conv_56_ptr);
24546                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
24547                 FREE(untag_ptr(_res_conv_56));
24548                 _res_constr.data[e] = _res_conv_56_conv;
24549         }
24550         FREE(_res);
24551         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
24552 }
24553
24554 int64_t  CS_LDK_COption_TypeZ_some(int64_t o) {
24555         void* o_ptr = untag_ptr(o);
24556         CHECK_ACCESS(o_ptr);
24557         LDKType o_conv = *(LDKType*)(o_ptr);
24558         if (o_conv.free == LDKType_JCalls_free) {
24559                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24560                 LDKType_JCalls_cloned(&o_conv);
24561         }
24562         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24563         *ret_copy = COption_TypeZ_some(o_conv);
24564         int64_t ret_ref = tag_ptr(ret_copy, true);
24565         return ret_ref;
24566 }
24567
24568 int64_t  CS_LDK_COption_TypeZ_none() {
24569         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24570         *ret_copy = COption_TypeZ_none();
24571         int64_t ret_ref = tag_ptr(ret_copy, true);
24572         return ret_ref;
24573 }
24574
24575 void  CS_LDK_COption_TypeZ_free(int64_t _res) {
24576         if (!ptr_is_owned(_res)) return;
24577         void* _res_ptr = untag_ptr(_res);
24578         CHECK_ACCESS(_res_ptr);
24579         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
24580         FREE(untag_ptr(_res));
24581         COption_TypeZ_free(_res_conv);
24582 }
24583
24584 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
24585         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24586         *ret_copy = COption_TypeZ_clone(arg);
24587         int64_t ret_ref = tag_ptr(ret_copy, true);
24588         return ret_ref;
24589 }
24590 int64_t  CS_LDK_COption_TypeZ_clone_ptr(int64_t arg) {
24591         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
24592         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
24593         return ret_conv;
24594 }
24595
24596 int64_t  CS_LDK_COption_TypeZ_clone(int64_t orig) {
24597         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
24598         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24599         *ret_copy = COption_TypeZ_clone(orig_conv);
24600         int64_t ret_ref = tag_ptr(ret_copy, true);
24601         return ret_ref;
24602 }
24603
24604 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_ok(int64_t o) {
24605         void* o_ptr = untag_ptr(o);
24606         CHECK_ACCESS(o_ptr);
24607         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
24608         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
24609         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24610         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
24611         return tag_ptr(ret_conv, true);
24612 }
24613
24614 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_err(int64_t e) {
24615         void* e_ptr = untag_ptr(e);
24616         CHECK_ACCESS(e_ptr);
24617         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24618         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24619         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24620         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
24621         return tag_ptr(ret_conv, true);
24622 }
24623
24624 jboolean  CS_LDK_CResult_COption_TypeZDecodeErrorZ_is_ok(int64_t o) {
24625         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
24626         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
24627         return ret_conv;
24628 }
24629
24630 void  CS_LDK_CResult_COption_TypeZDecodeErrorZ_free(int64_t _res) {
24631         if (!ptr_is_owned(_res)) return;
24632         void* _res_ptr = untag_ptr(_res);
24633         CHECK_ACCESS(_res_ptr);
24634         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
24635         FREE(untag_ptr(_res));
24636         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
24637 }
24638
24639 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
24640         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24641         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
24642         return tag_ptr(ret_conv, true);
24643 }
24644 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone_ptr(int64_t arg) {
24645         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
24646         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
24647         return ret_conv;
24648 }
24649
24650 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone(int64_t orig) {
24651         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
24652         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24653         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
24654         return tag_ptr(ret_conv, true);
24655 }
24656
24657 int64_t  CS_LDK_COption_SocketAddressZ_some(int64_t o) {
24658         void* o_ptr = untag_ptr(o);
24659         CHECK_ACCESS(o_ptr);
24660         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
24661         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
24662         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24663         *ret_copy = COption_SocketAddressZ_some(o_conv);
24664         int64_t ret_ref = tag_ptr(ret_copy, true);
24665         return ret_ref;
24666 }
24667
24668 int64_t  CS_LDK_COption_SocketAddressZ_none() {
24669         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24670         *ret_copy = COption_SocketAddressZ_none();
24671         int64_t ret_ref = tag_ptr(ret_copy, true);
24672         return ret_ref;
24673 }
24674
24675 void  CS_LDK_COption_SocketAddressZ_free(int64_t _res) {
24676         if (!ptr_is_owned(_res)) return;
24677         void* _res_ptr = untag_ptr(_res);
24678         CHECK_ACCESS(_res_ptr);
24679         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
24680         FREE(untag_ptr(_res));
24681         COption_SocketAddressZ_free(_res_conv);
24682 }
24683
24684 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
24685         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24686         *ret_copy = COption_SocketAddressZ_clone(arg);
24687         int64_t ret_ref = tag_ptr(ret_copy, true);
24688         return ret_ref;
24689 }
24690 int64_t  CS_LDK_COption_SocketAddressZ_clone_ptr(int64_t arg) {
24691         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
24692         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
24693         return ret_conv;
24694 }
24695
24696 int64_t  CS_LDK_COption_SocketAddressZ_clone(int64_t orig) {
24697         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
24698         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24699         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
24700         int64_t ret_ref = tag_ptr(ret_copy, true);
24701         return ret_ref;
24702 }
24703
24704 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
24705         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24706         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
24707         return tag_ptr(ret_conv, true);
24708 }
24709 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(int64_t arg) {
24710         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
24711         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
24712         return ret_conv;
24713 }
24714
24715 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(int64_t orig) {
24716         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
24717         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24718         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
24719         return tag_ptr(ret_conv, true);
24720 }
24721
24722 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, int64_t b) {
24723         LDKPublicKey a_ref;
24724         CHECK(a->arr_len == 33);
24725         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24726         void* b_ptr = untag_ptr(b);
24727         CHECK_ACCESS(b_ptr);
24728         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
24729         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
24730         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24731         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
24732         return tag_ptr(ret_conv, true);
24733 }
24734
24735 void  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(int64_t _res) {
24736         if (!ptr_is_owned(_res)) return;
24737         void* _res_ptr = untag_ptr(_res);
24738         CHECK_ACCESS(_res_ptr);
24739         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
24740         FREE(untag_ptr(_res));
24741         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
24742 }
24743
24744 void  CS_LDK_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(int64_tArray _res) {
24745         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
24746         _res_constr.datalen = _res->arr_len;
24747         if (_res_constr.datalen > 0)
24748                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
24749         else
24750                 _res_constr.data = NULL;
24751         int64_t* _res_vals = _res->elems;
24752         for (size_t r = 0; r < _res_constr.datalen; r++) {
24753                 int64_t _res_conv_43 = _res_vals[r];
24754                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
24755                 CHECK_ACCESS(_res_conv_43_ptr);
24756                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
24757                 FREE(untag_ptr(_res_conv_43));
24758                 _res_constr.data[r] = _res_conv_43_conv;
24759         }
24760         FREE(_res);
24761         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
24762 }
24763
24764 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
24765         LDKCVec_u8Z o_ref;
24766         o_ref.datalen = o->arr_len;
24767         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24768         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24769         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24770         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
24771         return tag_ptr(ret_conv, true);
24772 }
24773
24774 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_err(int64_t e) {
24775         LDKPeerHandleError e_conv;
24776         e_conv.inner = untag_ptr(e);
24777         e_conv.is_owned = ptr_is_owned(e);
24778         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24779         e_conv = PeerHandleError_clone(&e_conv);
24780         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24781         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
24782         return tag_ptr(ret_conv, true);
24783 }
24784
24785 jboolean  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(int64_t o) {
24786         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
24787         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
24788         return ret_conv;
24789 }
24790
24791 void  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_free(int64_t _res) {
24792         if (!ptr_is_owned(_res)) return;
24793         void* _res_ptr = untag_ptr(_res);
24794         CHECK_ACCESS(_res_ptr);
24795         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
24796         FREE(untag_ptr(_res));
24797         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
24798 }
24799
24800 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
24801         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24802         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
24803         return tag_ptr(ret_conv, true);
24804 }
24805 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(int64_t arg) {
24806         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
24807         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
24808         return ret_conv;
24809 }
24810
24811 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone(int64_t orig) {
24812         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
24813         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24814         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
24815         return tag_ptr(ret_conv, true);
24816 }
24817
24818 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_ok() {
24819         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24820         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
24821         return tag_ptr(ret_conv, true);
24822 }
24823
24824 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_err(int64_t e) {
24825         LDKPeerHandleError e_conv;
24826         e_conv.inner = untag_ptr(e);
24827         e_conv.is_owned = ptr_is_owned(e);
24828         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24829         e_conv = PeerHandleError_clone(&e_conv);
24830         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24831         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
24832         return tag_ptr(ret_conv, true);
24833 }
24834
24835 jboolean  CS_LDK_CResult_NonePeerHandleErrorZ_is_ok(int64_t o) {
24836         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
24837         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
24838         return ret_conv;
24839 }
24840
24841 void  CS_LDK_CResult_NonePeerHandleErrorZ_free(int64_t _res) {
24842         if (!ptr_is_owned(_res)) return;
24843         void* _res_ptr = untag_ptr(_res);
24844         CHECK_ACCESS(_res_ptr);
24845         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
24846         FREE(untag_ptr(_res));
24847         CResult_NonePeerHandleErrorZ_free(_res_conv);
24848 }
24849
24850 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
24851         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24852         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
24853         return tag_ptr(ret_conv, true);
24854 }
24855 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone_ptr(int64_t arg) {
24856         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
24857         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
24858         return ret_conv;
24859 }
24860
24861 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone(int64_t orig) {
24862         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
24863         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24864         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
24865         return tag_ptr(ret_conv, true);
24866 }
24867
24868 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
24869         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24870         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
24871         return tag_ptr(ret_conv, true);
24872 }
24873
24874 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_err(int64_t e) {
24875         LDKPeerHandleError e_conv;
24876         e_conv.inner = untag_ptr(e);
24877         e_conv.is_owned = ptr_is_owned(e);
24878         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24879         e_conv = PeerHandleError_clone(&e_conv);
24880         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24881         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
24882         return tag_ptr(ret_conv, true);
24883 }
24884
24885 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_is_ok(int64_t o) {
24886         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
24887         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
24888         return ret_conv;
24889 }
24890
24891 void  CS_LDK_CResult_boolPeerHandleErrorZ_free(int64_t _res) {
24892         if (!ptr_is_owned(_res)) return;
24893         void* _res_ptr = untag_ptr(_res);
24894         CHECK_ACCESS(_res_ptr);
24895         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
24896         FREE(untag_ptr(_res));
24897         CResult_boolPeerHandleErrorZ_free(_res_conv);
24898 }
24899
24900 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
24901         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24902         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
24903         return tag_ptr(ret_conv, true);
24904 }
24905 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone_ptr(int64_t arg) {
24906         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
24907         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
24908         return ret_conv;
24909 }
24910
24911 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone(int64_t orig) {
24912         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
24913         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24914         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
24915         return tag_ptr(ret_conv, true);
24916 }
24917
24918 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
24919         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24920         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
24921         return tag_ptr(ret_conv, true);
24922 }
24923
24924 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_err(int64_t e) {
24925         void* e_ptr = untag_ptr(e);
24926         CHECK_ACCESS(e_ptr);
24927         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
24928         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
24929         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24930         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
24931         return tag_ptr(ret_conv, true);
24932 }
24933
24934 jboolean  CS_LDK_CResult_u32GraphSyncErrorZ_is_ok(int64_t o) {
24935         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
24936         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
24937         return ret_conv;
24938 }
24939
24940 void  CS_LDK_CResult_u32GraphSyncErrorZ_free(int64_t _res) {
24941         if (!ptr_is_owned(_res)) return;
24942         void* _res_ptr = untag_ptr(_res);
24943         CHECK_ACCESS(_res_ptr);
24944         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
24945         FREE(untag_ptr(_res));
24946         CResult_u32GraphSyncErrorZ_free(_res_conv);
24947 }
24948
24949 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
24950         LDKCVec_u8Z o_ref;
24951         o_ref.datalen = o->arr_len;
24952         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24953         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24954         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24955         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
24956         return tag_ptr(ret_conv, true);
24957 }
24958
24959 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_err(int32_t e) {
24960         LDKIOError e_conv = LDKIOError_from_cs(e);
24961         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24962         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
24963         return tag_ptr(ret_conv, true);
24964 }
24965
24966 jboolean  CS_LDK_CResult_CVec_u8ZIOErrorZ_is_ok(int64_t o) {
24967         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
24968         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
24969         return ret_conv;
24970 }
24971
24972 void  CS_LDK_CResult_CVec_u8ZIOErrorZ_free(int64_t _res) {
24973         if (!ptr_is_owned(_res)) return;
24974         void* _res_ptr = untag_ptr(_res);
24975         CHECK_ACCESS(_res_ptr);
24976         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
24977         FREE(untag_ptr(_res));
24978         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
24979 }
24980
24981 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
24982         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24983         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
24984         return tag_ptr(ret_conv, true);
24985 }
24986 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone_ptr(int64_t arg) {
24987         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
24988         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
24989         return ret_conv;
24990 }
24991
24992 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone(int64_t orig) {
24993         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
24994         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24995         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
24996         return tag_ptr(ret_conv, true);
24997 }
24998
24999 void  CS_LDK_CVec_StrZ_free(ptrArray _res) {
25000         LDKCVec_StrZ _res_constr;
25001         _res_constr.datalen = _res->arr_len;
25002         if (_res_constr.datalen > 0)
25003                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
25004         else
25005                 _res_constr.data = NULL;
25006         jstring* _res_vals = (void*) _res->elems;
25007         for (size_t i = 0; i < _res_constr.datalen; i++) {
25008                 jstring _res_conv_8 = _res_vals[i];
25009                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
25010                 _res_constr.data[i] = dummy;
25011         }
25012         FREE(_res);
25013         CVec_StrZ_free(_res_constr);
25014 }
25015
25016 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
25017         LDKCVec_StrZ o_constr;
25018         o_constr.datalen = o->arr_len;
25019         if (o_constr.datalen > 0)
25020                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
25021         else
25022                 o_constr.data = NULL;
25023         jstring* o_vals = (void*) o->elems;
25024         for (size_t i = 0; i < o_constr.datalen; i++) {
25025                 jstring o_conv_8 = o_vals[i];
25026                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
25027                 o_constr.data[i] = o_conv_8_conv;
25028         }
25029         FREE(o);
25030         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25031         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
25032         return tag_ptr(ret_conv, true);
25033 }
25034
25035 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_err(int32_t e) {
25036         LDKIOError e_conv = LDKIOError_from_cs(e);
25037         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25038         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
25039         return tag_ptr(ret_conv, true);
25040 }
25041
25042 jboolean  CS_LDK_CResult_CVec_StrZIOErrorZ_is_ok(int64_t o) {
25043         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
25044         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
25045         return ret_conv;
25046 }
25047
25048 void  CS_LDK_CResult_CVec_StrZIOErrorZ_free(int64_t _res) {
25049         if (!ptr_is_owned(_res)) return;
25050         void* _res_ptr = untag_ptr(_res);
25051         CHECK_ACCESS(_res_ptr);
25052         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
25053         FREE(untag_ptr(_res));
25054         CResult_CVec_StrZIOErrorZ_free(_res_conv);
25055 }
25056
25057 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
25058         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25059         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
25060         return tag_ptr(ret_conv, true);
25061 }
25062 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone_ptr(int64_t arg) {
25063         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
25064         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
25065         return ret_conv;
25066 }
25067
25068 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone(int64_t orig) {
25069         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
25070         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25071         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
25072         return tag_ptr(ret_conv, true);
25073 }
25074
25075 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(int64_tArray _res) {
25076         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
25077         _res_constr.datalen = _res->arr_len;
25078         if (_res_constr.datalen > 0)
25079                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
25080         else
25081                 _res_constr.data = NULL;
25082         int64_t* _res_vals = _res->elems;
25083         for (size_t o = 0; o < _res_constr.datalen; o++) {
25084                 int64_t _res_conv_40 = _res_vals[o];
25085                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
25086                 CHECK_ACCESS(_res_conv_40_ptr);
25087                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
25088                 FREE(untag_ptr(_res_conv_40));
25089                 _res_constr.data[o] = _res_conv_40_conv;
25090         }
25091         FREE(_res);
25092         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
25093 }
25094
25095 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(int64_tArray o) {
25096         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
25097         o_constr.datalen = o->arr_len;
25098         if (o_constr.datalen > 0)
25099                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
25100         else
25101                 o_constr.data = NULL;
25102         int64_t* o_vals = o->elems;
25103         for (size_t o = 0; o < o_constr.datalen; o++) {
25104                 int64_t o_conv_40 = o_vals[o];
25105                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
25106                 CHECK_ACCESS(o_conv_40_ptr);
25107                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
25108                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
25109                 o_constr.data[o] = o_conv_40_conv;
25110         }
25111         FREE(o);
25112         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25113         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
25114         return tag_ptr(ret_conv, true);
25115 }
25116
25117 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(int32_t e) {
25118         LDKIOError e_conv = LDKIOError_from_cs(e);
25119         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25120         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
25121         return tag_ptr(ret_conv, true);
25122 }
25123
25124 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(int64_t o) {
25125         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
25126         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
25127         return ret_conv;
25128 }
25129
25130 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(int64_t _res) {
25131         if (!ptr_is_owned(_res)) return;
25132         void* _res_ptr = untag_ptr(_res);
25133         CHECK_ACCESS(_res_ptr);
25134         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
25135         FREE(untag_ptr(_res));
25136         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
25137 }
25138
25139 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
25140         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25141         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
25142         return tag_ptr(ret_conv, true);
25143 }
25144 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(int64_t arg) {
25145         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
25146         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
25147         return ret_conv;
25148 }
25149
25150 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(int64_t orig) {
25151         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
25152         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25153         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
25154         return tag_ptr(ret_conv, true);
25155 }
25156
25157 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(int64_t o) {
25158         void* o_ptr = untag_ptr(o);
25159         CHECK_ACCESS(o_ptr);
25160         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
25161         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
25162         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25163         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
25164         return tag_ptr(ret_conv, true);
25165 }
25166
25167 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(int32_t e) {
25168         LDKIOError e_conv = LDKIOError_from_cs(e);
25169         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25170         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
25171         return tag_ptr(ret_conv, true);
25172 }
25173
25174 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(int64_t o) {
25175         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
25176         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
25177         return ret_conv;
25178 }
25179
25180 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(int64_t _res) {
25181         if (!ptr_is_owned(_res)) return;
25182         void* _res_ptr = untag_ptr(_res);
25183         CHECK_ACCESS(_res_ptr);
25184         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
25185         FREE(untag_ptr(_res));
25186         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
25187 }
25188
25189 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
25190         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25191         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
25192         return tag_ptr(ret_conv, true);
25193 }
25194 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(int64_t arg) {
25195         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
25196         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
25197         return ret_conv;
25198 }
25199
25200 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(int64_t orig) {
25201         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
25202         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25203         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
25204         return tag_ptr(ret_conv, true);
25205 }
25206
25207 int64_t  CS_LDK_COption_SecretKeyZ_some(int8_tArray o) {
25208         LDKSecretKey o_ref;
25209         CHECK(o->arr_len == 32);
25210         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
25211         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25212         *ret_copy = COption_SecretKeyZ_some(o_ref);
25213         int64_t ret_ref = tag_ptr(ret_copy, true);
25214         return ret_ref;
25215 }
25216
25217 int64_t  CS_LDK_COption_SecretKeyZ_none() {
25218         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25219         *ret_copy = COption_SecretKeyZ_none();
25220         int64_t ret_ref = tag_ptr(ret_copy, true);
25221         return ret_ref;
25222 }
25223
25224 void  CS_LDK_COption_SecretKeyZ_free(int64_t _res) {
25225         if (!ptr_is_owned(_res)) return;
25226         void* _res_ptr = untag_ptr(_res);
25227         CHECK_ACCESS(_res_ptr);
25228         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
25229         FREE(untag_ptr(_res));
25230         COption_SecretKeyZ_free(_res_conv);
25231 }
25232
25233 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
25234         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25235         *ret_copy = COption_SecretKeyZ_clone(arg);
25236         int64_t ret_ref = tag_ptr(ret_copy, true);
25237         return ret_ref;
25238 }
25239 int64_t  CS_LDK_COption_SecretKeyZ_clone_ptr(int64_t arg) {
25240         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
25241         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
25242         return ret_conv;
25243 }
25244
25245 int64_t  CS_LDK_COption_SecretKeyZ_clone(int64_t orig) {
25246         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
25247         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25248         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
25249         int64_t ret_ref = tag_ptr(ret_copy, true);
25250         return ret_ref;
25251 }
25252
25253 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_ok(int64_t o) {
25254         LDKVerifiedInvoiceRequest o_conv;
25255         o_conv.inner = untag_ptr(o);
25256         o_conv.is_owned = ptr_is_owned(o);
25257         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25258         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
25259         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25260         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
25261         return tag_ptr(ret_conv, true);
25262 }
25263
25264 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_err() {
25265         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25266         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
25267         return tag_ptr(ret_conv, true);
25268 }
25269
25270 jboolean  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_is_ok(int64_t o) {
25271         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
25272         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
25273         return ret_conv;
25274 }
25275
25276 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_free(int64_t _res) {
25277         if (!ptr_is_owned(_res)) return;
25278         void* _res_ptr = untag_ptr(_res);
25279         CHECK_ACCESS(_res_ptr);
25280         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
25281         FREE(untag_ptr(_res));
25282         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
25283 }
25284
25285 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
25286         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25287         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
25288         return tag_ptr(ret_conv, true);
25289 }
25290 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(int64_t arg) {
25291         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
25292         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
25293         return ret_conv;
25294 }
25295
25296 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone(int64_t orig) {
25297         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
25298         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25299         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
25300         return tag_ptr(ret_conv, true);
25301 }
25302
25303 int32_t  CS_LDK_COption_NoneZ_some() {
25304         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_some());
25305         return ret_conv;
25306 }
25307
25308 int32_t  CS_LDK_COption_NoneZ_none() {
25309         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_none());
25310         return ret_conv;
25311 }
25312
25313 void  CS_LDK_COption_NoneZ_free(int32_t _res) {
25314         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_cs(_res);
25315         COption_NoneZ_free(_res_conv);
25316 }
25317
25318 void  CS_LDK_CVec_WitnessZ_free(ptrArray _res) {
25319         LDKCVec_WitnessZ _res_constr;
25320         _res_constr.datalen = _res->arr_len;
25321         if (_res_constr.datalen > 0)
25322                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
25323         else
25324                 _res_constr.data = NULL;
25325         int8_tArray* _res_vals = (void*) _res->elems;
25326         for (size_t i = 0; i < _res_constr.datalen; i++) {
25327                 int8_tArray _res_conv_8 = _res_vals[i];
25328                 LDKWitness _res_conv_8_ref;
25329                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
25330                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
25331                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
25332                 _res_conv_8_ref.data_is_owned = true;
25333                 _res_constr.data[i] = _res_conv_8_ref;
25334         }
25335         FREE(_res);
25336         CVec_WitnessZ_free(_res_constr);
25337 }
25338
25339 int64_t  CS_LDK_COption_i64Z_some(int64_t o) {
25340         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25341         *ret_copy = COption_i64Z_some(o);
25342         int64_t ret_ref = tag_ptr(ret_copy, true);
25343         return ret_ref;
25344 }
25345
25346 int64_t  CS_LDK_COption_i64Z_none() {
25347         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25348         *ret_copy = COption_i64Z_none();
25349         int64_t ret_ref = tag_ptr(ret_copy, true);
25350         return ret_ref;
25351 }
25352
25353 void  CS_LDK_COption_i64Z_free(int64_t _res) {
25354         if (!ptr_is_owned(_res)) return;
25355         void* _res_ptr = untag_ptr(_res);
25356         CHECK_ACCESS(_res_ptr);
25357         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
25358         FREE(untag_ptr(_res));
25359         COption_i64Z_free(_res_conv);
25360 }
25361
25362 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
25363         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25364         *ret_copy = COption_i64Z_clone(arg);
25365         int64_t ret_ref = tag_ptr(ret_copy, true);
25366         return ret_ref;
25367 }
25368 int64_t  CS_LDK_COption_i64Z_clone_ptr(int64_t arg) {
25369         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
25370         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
25371         return ret_conv;
25372 }
25373
25374 int64_t  CS_LDK_COption_i64Z_clone(int64_t orig) {
25375         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
25376         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25377         *ret_copy = COption_i64Z_clone(orig_conv);
25378         int64_t ret_ref = tag_ptr(ret_copy, true);
25379         return ret_ref;
25380 }
25381
25382 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_ok(int64_t o) {
25383         void* o_ptr = untag_ptr(o);
25384         CHECK_ACCESS(o_ptr);
25385         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25386         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25387         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25388         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
25389         return tag_ptr(ret_conv, true);
25390 }
25391
25392 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_err(int64_t e) {
25393         void* e_ptr = untag_ptr(e);
25394         CHECK_ACCESS(e_ptr);
25395         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25396         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25397         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25398         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
25399         return tag_ptr(ret_conv, true);
25400 }
25401
25402 jboolean  CS_LDK_CResult_SocketAddressDecodeErrorZ_is_ok(int64_t o) {
25403         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
25404         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
25405         return ret_conv;
25406 }
25407
25408 void  CS_LDK_CResult_SocketAddressDecodeErrorZ_free(int64_t _res) {
25409         if (!ptr_is_owned(_res)) return;
25410         void* _res_ptr = untag_ptr(_res);
25411         CHECK_ACCESS(_res_ptr);
25412         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
25413         FREE(untag_ptr(_res));
25414         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
25415 }
25416
25417 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
25418         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25419         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
25420         return tag_ptr(ret_conv, true);
25421 }
25422 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone_ptr(int64_t arg) {
25423         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
25424         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
25425         return ret_conv;
25426 }
25427
25428 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone(int64_t orig) {
25429         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
25430         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25431         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
25432         return tag_ptr(ret_conv, true);
25433 }
25434
25435 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_ok(int64_t o) {
25436         void* o_ptr = untag_ptr(o);
25437         CHECK_ACCESS(o_ptr);
25438         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25439         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25440         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25441         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
25442         return tag_ptr(ret_conv, true);
25443 }
25444
25445 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_err(int32_t e) {
25446         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_cs(e);
25447         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25448         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
25449         return tag_ptr(ret_conv, true);
25450 }
25451
25452 jboolean  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(int64_t o) {
25453         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
25454         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
25455         return ret_conv;
25456 }
25457
25458 void  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_free(int64_t _res) {
25459         if (!ptr_is_owned(_res)) return;
25460         void* _res_ptr = untag_ptr(_res);
25461         CHECK_ACCESS(_res_ptr);
25462         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
25463         FREE(untag_ptr(_res));
25464         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
25465 }
25466
25467 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
25468         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25469         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
25470         return tag_ptr(ret_conv, true);
25471 }
25472 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(int64_t arg) {
25473         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
25474         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
25475         return ret_conv;
25476 }
25477
25478 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone(int64_t orig) {
25479         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
25480         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25481         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
25482         return tag_ptr(ret_conv, true);
25483 }
25484
25485 void  CS_LDK_CVec_UpdateAddHTLCZ_free(int64_tArray _res) {
25486         LDKCVec_UpdateAddHTLCZ _res_constr;
25487         _res_constr.datalen = _res->arr_len;
25488         if (_res_constr.datalen > 0)
25489                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
25490         else
25491                 _res_constr.data = NULL;
25492         int64_t* _res_vals = _res->elems;
25493         for (size_t p = 0; p < _res_constr.datalen; p++) {
25494                 int64_t _res_conv_15 = _res_vals[p];
25495                 LDKUpdateAddHTLC _res_conv_15_conv;
25496                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
25497                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
25498                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
25499                 _res_constr.data[p] = _res_conv_15_conv;
25500         }
25501         FREE(_res);
25502         CVec_UpdateAddHTLCZ_free(_res_constr);
25503 }
25504
25505 void  CS_LDK_CVec_UpdateFulfillHTLCZ_free(int64_tArray _res) {
25506         LDKCVec_UpdateFulfillHTLCZ _res_constr;
25507         _res_constr.datalen = _res->arr_len;
25508         if (_res_constr.datalen > 0)
25509                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
25510         else
25511                 _res_constr.data = NULL;
25512         int64_t* _res_vals = _res->elems;
25513         for (size_t t = 0; t < _res_constr.datalen; t++) {
25514                 int64_t _res_conv_19 = _res_vals[t];
25515                 LDKUpdateFulfillHTLC _res_conv_19_conv;
25516                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
25517                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
25518                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
25519                 _res_constr.data[t] = _res_conv_19_conv;
25520         }
25521         FREE(_res);
25522         CVec_UpdateFulfillHTLCZ_free(_res_constr);
25523 }
25524
25525 void  CS_LDK_CVec_UpdateFailHTLCZ_free(int64_tArray _res) {
25526         LDKCVec_UpdateFailHTLCZ _res_constr;
25527         _res_constr.datalen = _res->arr_len;
25528         if (_res_constr.datalen > 0)
25529                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
25530         else
25531                 _res_constr.data = NULL;
25532         int64_t* _res_vals = _res->elems;
25533         for (size_t q = 0; q < _res_constr.datalen; q++) {
25534                 int64_t _res_conv_16 = _res_vals[q];
25535                 LDKUpdateFailHTLC _res_conv_16_conv;
25536                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25537                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25538                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25539                 _res_constr.data[q] = _res_conv_16_conv;
25540         }
25541         FREE(_res);
25542         CVec_UpdateFailHTLCZ_free(_res_constr);
25543 }
25544
25545 void  CS_LDK_CVec_UpdateFailMalformedHTLCZ_free(int64_tArray _res) {
25546         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
25547         _res_constr.datalen = _res->arr_len;
25548         if (_res_constr.datalen > 0)
25549                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
25550         else
25551                 _res_constr.data = NULL;
25552         int64_t* _res_vals = _res->elems;
25553         for (size_t z = 0; z < _res_constr.datalen; z++) {
25554                 int64_t _res_conv_25 = _res_vals[z];
25555                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
25556                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
25557                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
25558                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
25559                 _res_constr.data[z] = _res_conv_25_conv;
25560         }
25561         FREE(_res);
25562         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
25563 }
25564
25565 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_ok(int64_t o) {
25566         LDKAcceptChannel 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 = AcceptChannel_clone(&o_conv);
25571         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25572         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_err(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_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25582         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
25583         return tag_ptr(ret_conv, true);
25584 }
25585
25586 jboolean  CS_LDK_CResult_AcceptChannelDecodeErrorZ_is_ok(int64_t o) {
25587         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
25588         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
25589         return ret_conv;
25590 }
25591
25592 void  CS_LDK_CResult_AcceptChannelDecodeErrorZ_free(int64_t _res) {
25593         if (!ptr_is_owned(_res)) return;
25594         void* _res_ptr = untag_ptr(_res);
25595         CHECK_ACCESS(_res_ptr);
25596         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
25597         FREE(untag_ptr(_res));
25598         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
25599 }
25600
25601 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
25602         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25603         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
25604         return tag_ptr(ret_conv, true);
25605 }
25606 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone_ptr(int64_t arg) {
25607         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
25608         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
25609         return ret_conv;
25610 }
25611
25612 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone(int64_t orig) {
25613         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
25614         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25615         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
25616         return tag_ptr(ret_conv, true);
25617 }
25618
25619 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_ok(int64_t o) {
25620         LDKAcceptChannelV2 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 = AcceptChannelV2_clone(&o_conv);
25625         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25626         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
25627         return tag_ptr(ret_conv, true);
25628 }
25629
25630 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_err(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_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25636         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
25637         return tag_ptr(ret_conv, true);
25638 }
25639
25640 jboolean  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_is_ok(int64_t o) {
25641         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
25642         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
25643         return ret_conv;
25644 }
25645
25646 void  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_free(int64_t _res) {
25647         if (!ptr_is_owned(_res)) return;
25648         void* _res_ptr = untag_ptr(_res);
25649         CHECK_ACCESS(_res_ptr);
25650         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
25651         FREE(untag_ptr(_res));
25652         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
25653 }
25654
25655 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
25656         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25657         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
25658         return tag_ptr(ret_conv, true);
25659 }
25660 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
25661         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
25662         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
25663         return ret_conv;
25664 }
25665
25666 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone(int64_t orig) {
25667         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
25668         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25669         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
25670         return tag_ptr(ret_conv, true);
25671 }
25672
25673 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_ok(int64_t o) {
25674         LDKStfu 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 = Stfu_clone(&o_conv);
25679         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25680         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
25681         return tag_ptr(ret_conv, true);
25682 }
25683
25684 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_err(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_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25690         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
25691         return tag_ptr(ret_conv, true);
25692 }
25693
25694 jboolean  CS_LDK_CResult_StfuDecodeErrorZ_is_ok(int64_t o) {
25695         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
25696         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
25697         return ret_conv;
25698 }
25699
25700 void  CS_LDK_CResult_StfuDecodeErrorZ_free(int64_t _res) {
25701         if (!ptr_is_owned(_res)) return;
25702         void* _res_ptr = untag_ptr(_res);
25703         CHECK_ACCESS(_res_ptr);
25704         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
25705         FREE(untag_ptr(_res));
25706         CResult_StfuDecodeErrorZ_free(_res_conv);
25707 }
25708
25709 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
25710         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25711         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
25712         return tag_ptr(ret_conv, true);
25713 }
25714 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone_ptr(int64_t arg) {
25715         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
25716         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
25717         return ret_conv;
25718 }
25719
25720 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone(int64_t orig) {
25721         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
25722         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25723         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
25724         return tag_ptr(ret_conv, true);
25725 }
25726
25727 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_ok(int64_t o) {
25728         LDKSplice 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 = Splice_clone(&o_conv);
25733         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25734         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
25735         return tag_ptr(ret_conv, true);
25736 }
25737
25738 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_err(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_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25744         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
25745         return tag_ptr(ret_conv, true);
25746 }
25747
25748 jboolean  CS_LDK_CResult_SpliceDecodeErrorZ_is_ok(int64_t o) {
25749         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
25750         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
25751         return ret_conv;
25752 }
25753
25754 void  CS_LDK_CResult_SpliceDecodeErrorZ_free(int64_t _res) {
25755         if (!ptr_is_owned(_res)) return;
25756         void* _res_ptr = untag_ptr(_res);
25757         CHECK_ACCESS(_res_ptr);
25758         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
25759         FREE(untag_ptr(_res));
25760         CResult_SpliceDecodeErrorZ_free(_res_conv);
25761 }
25762
25763 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
25764         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25765         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
25766         return tag_ptr(ret_conv, true);
25767 }
25768 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone_ptr(int64_t arg) {
25769         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
25770         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
25771         return ret_conv;
25772 }
25773
25774 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone(int64_t orig) {
25775         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
25776         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25777         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
25778         return tag_ptr(ret_conv, true);
25779 }
25780
25781 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_ok(int64_t o) {
25782         LDKSpliceAck 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 = SpliceAck_clone(&o_conv);
25787         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25788         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
25789         return tag_ptr(ret_conv, true);
25790 }
25791
25792 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_err(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_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25798         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
25799         return tag_ptr(ret_conv, true);
25800 }
25801
25802 jboolean  CS_LDK_CResult_SpliceAckDecodeErrorZ_is_ok(int64_t o) {
25803         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
25804         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
25805         return ret_conv;
25806 }
25807
25808 void  CS_LDK_CResult_SpliceAckDecodeErrorZ_free(int64_t _res) {
25809         if (!ptr_is_owned(_res)) return;
25810         void* _res_ptr = untag_ptr(_res);
25811         CHECK_ACCESS(_res_ptr);
25812         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
25813         FREE(untag_ptr(_res));
25814         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
25815 }
25816
25817 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
25818         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25819         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
25820         return tag_ptr(ret_conv, true);
25821 }
25822 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone_ptr(int64_t arg) {
25823         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
25824         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
25825         return ret_conv;
25826 }
25827
25828 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone(int64_t orig) {
25829         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
25830         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25831         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
25832         return tag_ptr(ret_conv, true);
25833 }
25834
25835 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_ok(int64_t o) {
25836         LDKSpliceLocked 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 = SpliceLocked_clone(&o_conv);
25841         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25842         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
25843         return tag_ptr(ret_conv, true);
25844 }
25845
25846 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_err(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_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25852         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
25853         return tag_ptr(ret_conv, true);
25854 }
25855
25856 jboolean  CS_LDK_CResult_SpliceLockedDecodeErrorZ_is_ok(int64_t o) {
25857         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
25858         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
25859         return ret_conv;
25860 }
25861
25862 void  CS_LDK_CResult_SpliceLockedDecodeErrorZ_free(int64_t _res) {
25863         if (!ptr_is_owned(_res)) return;
25864         void* _res_ptr = untag_ptr(_res);
25865         CHECK_ACCESS(_res_ptr);
25866         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
25867         FREE(untag_ptr(_res));
25868         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
25869 }
25870
25871 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
25872         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25873         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
25874         return tag_ptr(ret_conv, true);
25875 }
25876 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone_ptr(int64_t arg) {
25877         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
25878         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
25879         return ret_conv;
25880 }
25881
25882 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone(int64_t orig) {
25883         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
25884         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25885         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
25886         return tag_ptr(ret_conv, true);
25887 }
25888
25889 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_ok(int64_t o) {
25890         LDKTxAddInput 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 = TxAddInput_clone(&o_conv);
25895         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25896         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
25897         return tag_ptr(ret_conv, true);
25898 }
25899
25900 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_err(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_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25906         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
25907         return tag_ptr(ret_conv, true);
25908 }
25909
25910 jboolean  CS_LDK_CResult_TxAddInputDecodeErrorZ_is_ok(int64_t o) {
25911         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
25912         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
25913         return ret_conv;
25914 }
25915
25916 void  CS_LDK_CResult_TxAddInputDecodeErrorZ_free(int64_t _res) {
25917         if (!ptr_is_owned(_res)) return;
25918         void* _res_ptr = untag_ptr(_res);
25919         CHECK_ACCESS(_res_ptr);
25920         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
25921         FREE(untag_ptr(_res));
25922         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
25923 }
25924
25925 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
25926         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25927         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
25928         return tag_ptr(ret_conv, true);
25929 }
25930 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone_ptr(int64_t arg) {
25931         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
25932         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
25933         return ret_conv;
25934 }
25935
25936 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone(int64_t orig) {
25937         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
25938         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25939         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
25940         return tag_ptr(ret_conv, true);
25941 }
25942
25943 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_ok(int64_t o) {
25944         LDKTxAddOutput o_conv;
25945         o_conv.inner = untag_ptr(o);
25946         o_conv.is_owned = ptr_is_owned(o);
25947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25948         o_conv = TxAddOutput_clone(&o_conv);
25949         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25950         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
25951         return tag_ptr(ret_conv, true);
25952 }
25953
25954 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_err(int64_t e) {
25955         void* e_ptr = untag_ptr(e);
25956         CHECK_ACCESS(e_ptr);
25957         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25958         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25959         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25960         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
25961         return tag_ptr(ret_conv, true);
25962 }
25963
25964 jboolean  CS_LDK_CResult_TxAddOutputDecodeErrorZ_is_ok(int64_t o) {
25965         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
25966         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
25967         return ret_conv;
25968 }
25969
25970 void  CS_LDK_CResult_TxAddOutputDecodeErrorZ_free(int64_t _res) {
25971         if (!ptr_is_owned(_res)) return;
25972         void* _res_ptr = untag_ptr(_res);
25973         CHECK_ACCESS(_res_ptr);
25974         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
25975         FREE(untag_ptr(_res));
25976         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
25977 }
25978
25979 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
25980         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25981         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
25982         return tag_ptr(ret_conv, true);
25983 }
25984 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone_ptr(int64_t arg) {
25985         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
25986         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
25987         return ret_conv;
25988 }
25989
25990 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone(int64_t orig) {
25991         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
25992         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25993         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
25994         return tag_ptr(ret_conv, true);
25995 }
25996
25997 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_ok(int64_t o) {
25998         LDKTxRemoveInput o_conv;
25999         o_conv.inner = untag_ptr(o);
26000         o_conv.is_owned = ptr_is_owned(o);
26001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26002         o_conv = TxRemoveInput_clone(&o_conv);
26003         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26004         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
26005         return tag_ptr(ret_conv, true);
26006 }
26007
26008 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_err(int64_t e) {
26009         void* e_ptr = untag_ptr(e);
26010         CHECK_ACCESS(e_ptr);
26011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26013         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26014         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
26015         return tag_ptr(ret_conv, true);
26016 }
26017
26018 jboolean  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_is_ok(int64_t o) {
26019         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
26020         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
26021         return ret_conv;
26022 }
26023
26024 void  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_free(int64_t _res) {
26025         if (!ptr_is_owned(_res)) return;
26026         void* _res_ptr = untag_ptr(_res);
26027         CHECK_ACCESS(_res_ptr);
26028         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
26029         FREE(untag_ptr(_res));
26030         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
26031 }
26032
26033 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
26034         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26035         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
26036         return tag_ptr(ret_conv, true);
26037 }
26038 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(int64_t arg) {
26039         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
26040         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
26041         return ret_conv;
26042 }
26043
26044 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone(int64_t orig) {
26045         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
26046         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26047         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
26048         return tag_ptr(ret_conv, true);
26049 }
26050
26051 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_ok(int64_t o) {
26052         LDKTxRemoveOutput o_conv;
26053         o_conv.inner = untag_ptr(o);
26054         o_conv.is_owned = ptr_is_owned(o);
26055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26056         o_conv = TxRemoveOutput_clone(&o_conv);
26057         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26058         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
26059         return tag_ptr(ret_conv, true);
26060 }
26061
26062 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_err(int64_t e) {
26063         void* e_ptr = untag_ptr(e);
26064         CHECK_ACCESS(e_ptr);
26065         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26066         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26067         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26068         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
26069         return tag_ptr(ret_conv, true);
26070 }
26071
26072 jboolean  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_is_ok(int64_t o) {
26073         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
26074         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
26075         return ret_conv;
26076 }
26077
26078 void  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_free(int64_t _res) {
26079         if (!ptr_is_owned(_res)) return;
26080         void* _res_ptr = untag_ptr(_res);
26081         CHECK_ACCESS(_res_ptr);
26082         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
26083         FREE(untag_ptr(_res));
26084         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
26085 }
26086
26087 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
26088         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26089         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
26090         return tag_ptr(ret_conv, true);
26091 }
26092 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(int64_t arg) {
26093         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
26094         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
26095         return ret_conv;
26096 }
26097
26098 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone(int64_t orig) {
26099         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
26100         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26101         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
26102         return tag_ptr(ret_conv, true);
26103 }
26104
26105 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_ok(int64_t o) {
26106         LDKTxComplete o_conv;
26107         o_conv.inner = untag_ptr(o);
26108         o_conv.is_owned = ptr_is_owned(o);
26109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26110         o_conv = TxComplete_clone(&o_conv);
26111         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26112         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
26113         return tag_ptr(ret_conv, true);
26114 }
26115
26116 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_err(int64_t e) {
26117         void* e_ptr = untag_ptr(e);
26118         CHECK_ACCESS(e_ptr);
26119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26121         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26122         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
26123         return tag_ptr(ret_conv, true);
26124 }
26125
26126 jboolean  CS_LDK_CResult_TxCompleteDecodeErrorZ_is_ok(int64_t o) {
26127         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
26128         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
26129         return ret_conv;
26130 }
26131
26132 void  CS_LDK_CResult_TxCompleteDecodeErrorZ_free(int64_t _res) {
26133         if (!ptr_is_owned(_res)) return;
26134         void* _res_ptr = untag_ptr(_res);
26135         CHECK_ACCESS(_res_ptr);
26136         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
26137         FREE(untag_ptr(_res));
26138         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
26139 }
26140
26141 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
26142         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26143         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
26144         return tag_ptr(ret_conv, true);
26145 }
26146 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone_ptr(int64_t arg) {
26147         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
26148         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
26149         return ret_conv;
26150 }
26151
26152 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone(int64_t orig) {
26153         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
26154         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26155         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
26156         return tag_ptr(ret_conv, true);
26157 }
26158
26159 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_ok(int64_t o) {
26160         LDKTxSignatures o_conv;
26161         o_conv.inner = untag_ptr(o);
26162         o_conv.is_owned = ptr_is_owned(o);
26163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26164         o_conv = TxSignatures_clone(&o_conv);
26165         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26166         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
26167         return tag_ptr(ret_conv, true);
26168 }
26169
26170 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_err(int64_t e) {
26171         void* e_ptr = untag_ptr(e);
26172         CHECK_ACCESS(e_ptr);
26173         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26174         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26175         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26176         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
26177         return tag_ptr(ret_conv, true);
26178 }
26179
26180 jboolean  CS_LDK_CResult_TxSignaturesDecodeErrorZ_is_ok(int64_t o) {
26181         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
26182         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
26183         return ret_conv;
26184 }
26185
26186 void  CS_LDK_CResult_TxSignaturesDecodeErrorZ_free(int64_t _res) {
26187         if (!ptr_is_owned(_res)) return;
26188         void* _res_ptr = untag_ptr(_res);
26189         CHECK_ACCESS(_res_ptr);
26190         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
26191         FREE(untag_ptr(_res));
26192         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
26193 }
26194
26195 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
26196         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26197         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
26198         return tag_ptr(ret_conv, true);
26199 }
26200 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
26201         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
26202         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
26203         return ret_conv;
26204 }
26205
26206 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone(int64_t orig) {
26207         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
26208         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26209         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
26210         return tag_ptr(ret_conv, true);
26211 }
26212
26213 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_ok(int64_t o) {
26214         LDKTxInitRbf o_conv;
26215         o_conv.inner = untag_ptr(o);
26216         o_conv.is_owned = ptr_is_owned(o);
26217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26218         o_conv = TxInitRbf_clone(&o_conv);
26219         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26220         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
26221         return tag_ptr(ret_conv, true);
26222 }
26223
26224 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_err(int64_t e) {
26225         void* e_ptr = untag_ptr(e);
26226         CHECK_ACCESS(e_ptr);
26227         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26228         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26229         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26230         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
26231         return tag_ptr(ret_conv, true);
26232 }
26233
26234 jboolean  CS_LDK_CResult_TxInitRbfDecodeErrorZ_is_ok(int64_t o) {
26235         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
26236         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
26237         return ret_conv;
26238 }
26239
26240 void  CS_LDK_CResult_TxInitRbfDecodeErrorZ_free(int64_t _res) {
26241         if (!ptr_is_owned(_res)) return;
26242         void* _res_ptr = untag_ptr(_res);
26243         CHECK_ACCESS(_res_ptr);
26244         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
26245         FREE(untag_ptr(_res));
26246         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
26247 }
26248
26249 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
26250         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26251         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
26252         return tag_ptr(ret_conv, true);
26253 }
26254 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone_ptr(int64_t arg) {
26255         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
26256         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
26257         return ret_conv;
26258 }
26259
26260 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone(int64_t orig) {
26261         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
26262         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26263         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
26264         return tag_ptr(ret_conv, true);
26265 }
26266
26267 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_ok(int64_t o) {
26268         LDKTxAckRbf o_conv;
26269         o_conv.inner = untag_ptr(o);
26270         o_conv.is_owned = ptr_is_owned(o);
26271         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26272         o_conv = TxAckRbf_clone(&o_conv);
26273         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26274         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
26275         return tag_ptr(ret_conv, true);
26276 }
26277
26278 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_err(int64_t e) {
26279         void* e_ptr = untag_ptr(e);
26280         CHECK_ACCESS(e_ptr);
26281         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26282         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26283         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26284         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
26285         return tag_ptr(ret_conv, true);
26286 }
26287
26288 jboolean  CS_LDK_CResult_TxAckRbfDecodeErrorZ_is_ok(int64_t o) {
26289         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
26290         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
26291         return ret_conv;
26292 }
26293
26294 void  CS_LDK_CResult_TxAckRbfDecodeErrorZ_free(int64_t _res) {
26295         if (!ptr_is_owned(_res)) return;
26296         void* _res_ptr = untag_ptr(_res);
26297         CHECK_ACCESS(_res_ptr);
26298         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
26299         FREE(untag_ptr(_res));
26300         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
26301 }
26302
26303 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
26304         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26305         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
26306         return tag_ptr(ret_conv, true);
26307 }
26308 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone_ptr(int64_t arg) {
26309         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
26310         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
26311         return ret_conv;
26312 }
26313
26314 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone(int64_t orig) {
26315         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
26316         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26317         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
26318         return tag_ptr(ret_conv, true);
26319 }
26320
26321 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_ok(int64_t o) {
26322         LDKTxAbort o_conv;
26323         o_conv.inner = untag_ptr(o);
26324         o_conv.is_owned = ptr_is_owned(o);
26325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26326         o_conv = TxAbort_clone(&o_conv);
26327         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26328         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
26329         return tag_ptr(ret_conv, true);
26330 }
26331
26332 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_err(int64_t e) {
26333         void* e_ptr = untag_ptr(e);
26334         CHECK_ACCESS(e_ptr);
26335         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26336         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26337         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26338         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
26339         return tag_ptr(ret_conv, true);
26340 }
26341
26342 jboolean  CS_LDK_CResult_TxAbortDecodeErrorZ_is_ok(int64_t o) {
26343         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
26344         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
26345         return ret_conv;
26346 }
26347
26348 void  CS_LDK_CResult_TxAbortDecodeErrorZ_free(int64_t _res) {
26349         if (!ptr_is_owned(_res)) return;
26350         void* _res_ptr = untag_ptr(_res);
26351         CHECK_ACCESS(_res_ptr);
26352         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
26353         FREE(untag_ptr(_res));
26354         CResult_TxAbortDecodeErrorZ_free(_res_conv);
26355 }
26356
26357 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
26358         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26359         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
26360         return tag_ptr(ret_conv, true);
26361 }
26362 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone_ptr(int64_t arg) {
26363         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
26364         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
26365         return ret_conv;
26366 }
26367
26368 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone(int64_t orig) {
26369         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
26370         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26371         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
26372         return tag_ptr(ret_conv, true);
26373 }
26374
26375 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_ok(int64_t o) {
26376         LDKAnnouncementSignatures o_conv;
26377         o_conv.inner = untag_ptr(o);
26378         o_conv.is_owned = ptr_is_owned(o);
26379         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26380         o_conv = AnnouncementSignatures_clone(&o_conv);
26381         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26382         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
26383         return tag_ptr(ret_conv, true);
26384 }
26385
26386 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_err(int64_t e) {
26387         void* e_ptr = untag_ptr(e);
26388         CHECK_ACCESS(e_ptr);
26389         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26390         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26391         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26392         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
26393         return tag_ptr(ret_conv, true);
26394 }
26395
26396 jboolean  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(int64_t o) {
26397         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
26398         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
26399         return ret_conv;
26400 }
26401
26402 void  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_free(int64_t _res) {
26403         if (!ptr_is_owned(_res)) return;
26404         void* _res_ptr = untag_ptr(_res);
26405         CHECK_ACCESS(_res_ptr);
26406         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
26407         FREE(untag_ptr(_res));
26408         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
26409 }
26410
26411 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
26412         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26413         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
26414         return tag_ptr(ret_conv, true);
26415 }
26416 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
26417         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
26418         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
26419         return ret_conv;
26420 }
26421
26422 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone(int64_t orig) {
26423         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
26424         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26425         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
26426         return tag_ptr(ret_conv, true);
26427 }
26428
26429 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_ok(int64_t o) {
26430         LDKChannelReestablish o_conv;
26431         o_conv.inner = untag_ptr(o);
26432         o_conv.is_owned = ptr_is_owned(o);
26433         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26434         o_conv = ChannelReestablish_clone(&o_conv);
26435         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26436         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
26437         return tag_ptr(ret_conv, true);
26438 }
26439
26440 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_err(int64_t e) {
26441         void* e_ptr = untag_ptr(e);
26442         CHECK_ACCESS(e_ptr);
26443         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26444         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26445         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26446         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
26447         return tag_ptr(ret_conv, true);
26448 }
26449
26450 jboolean  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_is_ok(int64_t o) {
26451         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
26452         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
26453         return ret_conv;
26454 }
26455
26456 void  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_free(int64_t _res) {
26457         if (!ptr_is_owned(_res)) return;
26458         void* _res_ptr = untag_ptr(_res);
26459         CHECK_ACCESS(_res_ptr);
26460         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
26461         FREE(untag_ptr(_res));
26462         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
26463 }
26464
26465 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
26466         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26467         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
26468         return tag_ptr(ret_conv, true);
26469 }
26470 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(int64_t arg) {
26471         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
26472         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
26473         return ret_conv;
26474 }
26475
26476 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone(int64_t orig) {
26477         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
26478         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26479         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
26480         return tag_ptr(ret_conv, true);
26481 }
26482
26483 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_ok(int64_t o) {
26484         LDKClosingSigned o_conv;
26485         o_conv.inner = untag_ptr(o);
26486         o_conv.is_owned = ptr_is_owned(o);
26487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26488         o_conv = ClosingSigned_clone(&o_conv);
26489         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26490         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
26491         return tag_ptr(ret_conv, true);
26492 }
26493
26494 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_err(int64_t e) {
26495         void* e_ptr = untag_ptr(e);
26496         CHECK_ACCESS(e_ptr);
26497         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26498         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26499         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26500         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
26501         return tag_ptr(ret_conv, true);
26502 }
26503
26504 jboolean  CS_LDK_CResult_ClosingSignedDecodeErrorZ_is_ok(int64_t o) {
26505         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
26506         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
26507         return ret_conv;
26508 }
26509
26510 void  CS_LDK_CResult_ClosingSignedDecodeErrorZ_free(int64_t _res) {
26511         if (!ptr_is_owned(_res)) return;
26512         void* _res_ptr = untag_ptr(_res);
26513         CHECK_ACCESS(_res_ptr);
26514         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
26515         FREE(untag_ptr(_res));
26516         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
26517 }
26518
26519 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
26520         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26521         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
26522         return tag_ptr(ret_conv, true);
26523 }
26524 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
26525         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
26526         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
26527         return ret_conv;
26528 }
26529
26530 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone(int64_t orig) {
26531         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
26532         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26533         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
26534         return tag_ptr(ret_conv, true);
26535 }
26536
26537 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(int64_t o) {
26538         LDKClosingSignedFeeRange o_conv;
26539         o_conv.inner = untag_ptr(o);
26540         o_conv.is_owned = ptr_is_owned(o);
26541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26542         o_conv = ClosingSignedFeeRange_clone(&o_conv);
26543         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26544         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
26545         return tag_ptr(ret_conv, true);
26546 }
26547
26548 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(int64_t e) {
26549         void* e_ptr = untag_ptr(e);
26550         CHECK_ACCESS(e_ptr);
26551         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26552         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26553         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26554         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
26555         return tag_ptr(ret_conv, true);
26556 }
26557
26558 jboolean  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(int64_t o) {
26559         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
26560         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
26561         return ret_conv;
26562 }
26563
26564 void  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(int64_t _res) {
26565         if (!ptr_is_owned(_res)) return;
26566         void* _res_ptr = untag_ptr(_res);
26567         CHECK_ACCESS(_res_ptr);
26568         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
26569         FREE(untag_ptr(_res));
26570         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
26571 }
26572
26573 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
26574         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26575         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
26576         return tag_ptr(ret_conv, true);
26577 }
26578 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(int64_t arg) {
26579         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
26580         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
26581         return ret_conv;
26582 }
26583
26584 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(int64_t orig) {
26585         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
26586         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26587         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
26588         return tag_ptr(ret_conv, true);
26589 }
26590
26591 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_ok(int64_t o) {
26592         LDKCommitmentSigned o_conv;
26593         o_conv.inner = untag_ptr(o);
26594         o_conv.is_owned = ptr_is_owned(o);
26595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26596         o_conv = CommitmentSigned_clone(&o_conv);
26597         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26598         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
26599         return tag_ptr(ret_conv, true);
26600 }
26601
26602 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_err(int64_t e) {
26603         void* e_ptr = untag_ptr(e);
26604         CHECK_ACCESS(e_ptr);
26605         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26606         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26607         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26608         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
26609         return tag_ptr(ret_conv, true);
26610 }
26611
26612 jboolean  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_is_ok(int64_t o) {
26613         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
26614         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
26615         return ret_conv;
26616 }
26617
26618 void  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_free(int64_t _res) {
26619         if (!ptr_is_owned(_res)) return;
26620         void* _res_ptr = untag_ptr(_res);
26621         CHECK_ACCESS(_res_ptr);
26622         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
26623         FREE(untag_ptr(_res));
26624         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
26625 }
26626
26627 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
26628         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26629         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
26630         return tag_ptr(ret_conv, true);
26631 }
26632 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(int64_t arg) {
26633         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
26634         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
26635         return ret_conv;
26636 }
26637
26638 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone(int64_t orig) {
26639         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
26640         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26641         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
26642         return tag_ptr(ret_conv, true);
26643 }
26644
26645 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_ok(int64_t o) {
26646         LDKFundingCreated o_conv;
26647         o_conv.inner = untag_ptr(o);
26648         o_conv.is_owned = ptr_is_owned(o);
26649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26650         o_conv = FundingCreated_clone(&o_conv);
26651         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26652         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
26653         return tag_ptr(ret_conv, true);
26654 }
26655
26656 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_err(int64_t e) {
26657         void* e_ptr = untag_ptr(e);
26658         CHECK_ACCESS(e_ptr);
26659         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26660         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26661         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26662         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
26663         return tag_ptr(ret_conv, true);
26664 }
26665
26666 jboolean  CS_LDK_CResult_FundingCreatedDecodeErrorZ_is_ok(int64_t o) {
26667         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
26668         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
26669         return ret_conv;
26670 }
26671
26672 void  CS_LDK_CResult_FundingCreatedDecodeErrorZ_free(int64_t _res) {
26673         if (!ptr_is_owned(_res)) return;
26674         void* _res_ptr = untag_ptr(_res);
26675         CHECK_ACCESS(_res_ptr);
26676         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
26677         FREE(untag_ptr(_res));
26678         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
26679 }
26680
26681 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
26682         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26683         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
26684         return tag_ptr(ret_conv, true);
26685 }
26686 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone_ptr(int64_t arg) {
26687         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
26688         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
26689         return ret_conv;
26690 }
26691
26692 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone(int64_t orig) {
26693         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
26694         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26695         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
26696         return tag_ptr(ret_conv, true);
26697 }
26698
26699 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_ok(int64_t o) {
26700         LDKFundingSigned o_conv;
26701         o_conv.inner = untag_ptr(o);
26702         o_conv.is_owned = ptr_is_owned(o);
26703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26704         o_conv = FundingSigned_clone(&o_conv);
26705         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26706         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
26707         return tag_ptr(ret_conv, true);
26708 }
26709
26710 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_err(int64_t e) {
26711         void* e_ptr = untag_ptr(e);
26712         CHECK_ACCESS(e_ptr);
26713         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26714         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26715         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26716         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
26717         return tag_ptr(ret_conv, true);
26718 }
26719
26720 jboolean  CS_LDK_CResult_FundingSignedDecodeErrorZ_is_ok(int64_t o) {
26721         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
26722         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
26723         return ret_conv;
26724 }
26725
26726 void  CS_LDK_CResult_FundingSignedDecodeErrorZ_free(int64_t _res) {
26727         if (!ptr_is_owned(_res)) return;
26728         void* _res_ptr = untag_ptr(_res);
26729         CHECK_ACCESS(_res_ptr);
26730         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
26731         FREE(untag_ptr(_res));
26732         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
26733 }
26734
26735 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
26736         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26737         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
26738         return tag_ptr(ret_conv, true);
26739 }
26740 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
26741         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
26742         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
26743         return ret_conv;
26744 }
26745
26746 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone(int64_t orig) {
26747         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
26748         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26749         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
26750         return tag_ptr(ret_conv, true);
26751 }
26752
26753 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_ok(int64_t o) {
26754         LDKChannelReady o_conv;
26755         o_conv.inner = untag_ptr(o);
26756         o_conv.is_owned = ptr_is_owned(o);
26757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26758         o_conv = ChannelReady_clone(&o_conv);
26759         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26760         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
26761         return tag_ptr(ret_conv, true);
26762 }
26763
26764 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_err(int64_t e) {
26765         void* e_ptr = untag_ptr(e);
26766         CHECK_ACCESS(e_ptr);
26767         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26768         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26769         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26770         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
26771         return tag_ptr(ret_conv, true);
26772 }
26773
26774 jboolean  CS_LDK_CResult_ChannelReadyDecodeErrorZ_is_ok(int64_t o) {
26775         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
26776         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
26777         return ret_conv;
26778 }
26779
26780 void  CS_LDK_CResult_ChannelReadyDecodeErrorZ_free(int64_t _res) {
26781         if (!ptr_is_owned(_res)) return;
26782         void* _res_ptr = untag_ptr(_res);
26783         CHECK_ACCESS(_res_ptr);
26784         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
26785         FREE(untag_ptr(_res));
26786         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
26787 }
26788
26789 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
26790         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26791         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
26792         return tag_ptr(ret_conv, true);
26793 }
26794 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone_ptr(int64_t arg) {
26795         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
26796         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
26797         return ret_conv;
26798 }
26799
26800 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone(int64_t orig) {
26801         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
26802         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26803         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
26804         return tag_ptr(ret_conv, true);
26805 }
26806
26807 int64_t  CS_LDK_CResult_InitDecodeErrorZ_ok(int64_t o) {
26808         LDKInit o_conv;
26809         o_conv.inner = untag_ptr(o);
26810         o_conv.is_owned = ptr_is_owned(o);
26811         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26812         o_conv = Init_clone(&o_conv);
26813         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26814         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
26815         return tag_ptr(ret_conv, true);
26816 }
26817
26818 int64_t  CS_LDK_CResult_InitDecodeErrorZ_err(int64_t e) {
26819         void* e_ptr = untag_ptr(e);
26820         CHECK_ACCESS(e_ptr);
26821         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26822         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26823         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26824         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
26825         return tag_ptr(ret_conv, true);
26826 }
26827
26828 jboolean  CS_LDK_CResult_InitDecodeErrorZ_is_ok(int64_t o) {
26829         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
26830         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
26831         return ret_conv;
26832 }
26833
26834 void  CS_LDK_CResult_InitDecodeErrorZ_free(int64_t _res) {
26835         if (!ptr_is_owned(_res)) return;
26836         void* _res_ptr = untag_ptr(_res);
26837         CHECK_ACCESS(_res_ptr);
26838         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
26839         FREE(untag_ptr(_res));
26840         CResult_InitDecodeErrorZ_free(_res_conv);
26841 }
26842
26843 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
26844         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26845         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
26846         return tag_ptr(ret_conv, true);
26847 }
26848 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone_ptr(int64_t arg) {
26849         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
26850         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
26851         return ret_conv;
26852 }
26853
26854 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone(int64_t orig) {
26855         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
26856         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26857         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
26858         return tag_ptr(ret_conv, true);
26859 }
26860
26861 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_ok(int64_t o) {
26862         LDKOpenChannel o_conv;
26863         o_conv.inner = untag_ptr(o);
26864         o_conv.is_owned = ptr_is_owned(o);
26865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26866         o_conv = OpenChannel_clone(&o_conv);
26867         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26868         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
26869         return tag_ptr(ret_conv, true);
26870 }
26871
26872 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_err(int64_t e) {
26873         void* e_ptr = untag_ptr(e);
26874         CHECK_ACCESS(e_ptr);
26875         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26876         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26877         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26878         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
26879         return tag_ptr(ret_conv, true);
26880 }
26881
26882 jboolean  CS_LDK_CResult_OpenChannelDecodeErrorZ_is_ok(int64_t o) {
26883         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
26884         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
26885         return ret_conv;
26886 }
26887
26888 void  CS_LDK_CResult_OpenChannelDecodeErrorZ_free(int64_t _res) {
26889         if (!ptr_is_owned(_res)) return;
26890         void* _res_ptr = untag_ptr(_res);
26891         CHECK_ACCESS(_res_ptr);
26892         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
26893         FREE(untag_ptr(_res));
26894         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
26895 }
26896
26897 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
26898         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26899         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
26900         return tag_ptr(ret_conv, true);
26901 }
26902 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone_ptr(int64_t arg) {
26903         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
26904         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
26905         return ret_conv;
26906 }
26907
26908 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone(int64_t orig) {
26909         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
26910         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26911         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
26912         return tag_ptr(ret_conv, true);
26913 }
26914
26915 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_ok(int64_t o) {
26916         LDKOpenChannelV2 o_conv;
26917         o_conv.inner = untag_ptr(o);
26918         o_conv.is_owned = ptr_is_owned(o);
26919         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26920         o_conv = OpenChannelV2_clone(&o_conv);
26921         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26922         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
26923         return tag_ptr(ret_conv, true);
26924 }
26925
26926 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_err(int64_t e) {
26927         void* e_ptr = untag_ptr(e);
26928         CHECK_ACCESS(e_ptr);
26929         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26930         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26931         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26932         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
26933         return tag_ptr(ret_conv, true);
26934 }
26935
26936 jboolean  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_is_ok(int64_t o) {
26937         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
26938         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
26939         return ret_conv;
26940 }
26941
26942 void  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_free(int64_t _res) {
26943         if (!ptr_is_owned(_res)) return;
26944         void* _res_ptr = untag_ptr(_res);
26945         CHECK_ACCESS(_res_ptr);
26946         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
26947         FREE(untag_ptr(_res));
26948         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
26949 }
26950
26951 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
26952         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26953         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
26954         return tag_ptr(ret_conv, true);
26955 }
26956 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
26957         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
26958         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
26959         return ret_conv;
26960 }
26961
26962 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone(int64_t orig) {
26963         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
26964         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26965         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
26966         return tag_ptr(ret_conv, true);
26967 }
26968
26969 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_ok(int64_t o) {
26970         LDKRevokeAndACK o_conv;
26971         o_conv.inner = untag_ptr(o);
26972         o_conv.is_owned = ptr_is_owned(o);
26973         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26974         o_conv = RevokeAndACK_clone(&o_conv);
26975         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26976         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
26977         return tag_ptr(ret_conv, true);
26978 }
26979
26980 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_err(int64_t e) {
26981         void* e_ptr = untag_ptr(e);
26982         CHECK_ACCESS(e_ptr);
26983         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26984         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26985         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26986         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
26987         return tag_ptr(ret_conv, true);
26988 }
26989
26990 jboolean  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_is_ok(int64_t o) {
26991         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
26992         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
26993         return ret_conv;
26994 }
26995
26996 void  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_free(int64_t _res) {
26997         if (!ptr_is_owned(_res)) return;
26998         void* _res_ptr = untag_ptr(_res);
26999         CHECK_ACCESS(_res_ptr);
27000         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
27001         FREE(untag_ptr(_res));
27002         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
27003 }
27004
27005 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
27006         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27007         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
27008         return tag_ptr(ret_conv, true);
27009 }
27010 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(int64_t arg) {
27011         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
27012         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
27013         return ret_conv;
27014 }
27015
27016 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone(int64_t orig) {
27017         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
27018         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27019         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
27020         return tag_ptr(ret_conv, true);
27021 }
27022
27023 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_ok(int64_t o) {
27024         LDKShutdown o_conv;
27025         o_conv.inner = untag_ptr(o);
27026         o_conv.is_owned = ptr_is_owned(o);
27027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27028         o_conv = Shutdown_clone(&o_conv);
27029         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27030         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
27031         return tag_ptr(ret_conv, true);
27032 }
27033
27034 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_err(int64_t e) {
27035         void* e_ptr = untag_ptr(e);
27036         CHECK_ACCESS(e_ptr);
27037         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27038         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27039         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27040         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
27041         return tag_ptr(ret_conv, true);
27042 }
27043
27044 jboolean  CS_LDK_CResult_ShutdownDecodeErrorZ_is_ok(int64_t o) {
27045         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
27046         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
27047         return ret_conv;
27048 }
27049
27050 void  CS_LDK_CResult_ShutdownDecodeErrorZ_free(int64_t _res) {
27051         if (!ptr_is_owned(_res)) return;
27052         void* _res_ptr = untag_ptr(_res);
27053         CHECK_ACCESS(_res_ptr);
27054         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
27055         FREE(untag_ptr(_res));
27056         CResult_ShutdownDecodeErrorZ_free(_res_conv);
27057 }
27058
27059 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
27060         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27061         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
27062         return tag_ptr(ret_conv, true);
27063 }
27064 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone_ptr(int64_t arg) {
27065         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
27066         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
27067         return ret_conv;
27068 }
27069
27070 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone(int64_t orig) {
27071         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
27072         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27073         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
27074         return tag_ptr(ret_conv, true);
27075 }
27076
27077 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_ok(int64_t o) {
27078         LDKUpdateFailHTLC o_conv;
27079         o_conv.inner = untag_ptr(o);
27080         o_conv.is_owned = ptr_is_owned(o);
27081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27082         o_conv = UpdateFailHTLC_clone(&o_conv);
27083         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27084         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
27085         return tag_ptr(ret_conv, true);
27086 }
27087
27088 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_err(int64_t e) {
27089         void* e_ptr = untag_ptr(e);
27090         CHECK_ACCESS(e_ptr);
27091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27093         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27094         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
27095         return tag_ptr(ret_conv, true);
27096 }
27097
27098 jboolean  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(int64_t o) {
27099         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
27100         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
27101         return ret_conv;
27102 }
27103
27104 void  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_free(int64_t _res) {
27105         if (!ptr_is_owned(_res)) return;
27106         void* _res_ptr = untag_ptr(_res);
27107         CHECK_ACCESS(_res_ptr);
27108         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
27109         FREE(untag_ptr(_res));
27110         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
27111 }
27112
27113 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
27114         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27115         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
27116         return tag_ptr(ret_conv, true);
27117 }
27118 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27119         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
27120         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
27121         return ret_conv;
27122 }
27123
27124 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone(int64_t orig) {
27125         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
27126         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27127         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
27128         return tag_ptr(ret_conv, true);
27129 }
27130
27131 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(int64_t o) {
27132         LDKUpdateFailMalformedHTLC o_conv;
27133         o_conv.inner = untag_ptr(o);
27134         o_conv.is_owned = ptr_is_owned(o);
27135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27136         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
27137         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27138         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
27139         return tag_ptr(ret_conv, true);
27140 }
27141
27142 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(int64_t e) {
27143         void* e_ptr = untag_ptr(e);
27144         CHECK_ACCESS(e_ptr);
27145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27147         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27148         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
27149         return tag_ptr(ret_conv, true);
27150 }
27151
27152 jboolean  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(int64_t o) {
27153         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
27154         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
27155         return ret_conv;
27156 }
27157
27158 void  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(int64_t _res) {
27159         if (!ptr_is_owned(_res)) return;
27160         void* _res_ptr = untag_ptr(_res);
27161         CHECK_ACCESS(_res_ptr);
27162         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
27163         FREE(untag_ptr(_res));
27164         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
27165 }
27166
27167 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
27168         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27169         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
27170         return tag_ptr(ret_conv, true);
27171 }
27172 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27173         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
27174         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
27175         return ret_conv;
27176 }
27177
27178 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(int64_t orig) {
27179         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
27180         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27181         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
27182         return tag_ptr(ret_conv, true);
27183 }
27184
27185 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_ok(int64_t o) {
27186         LDKUpdateFee o_conv;
27187         o_conv.inner = untag_ptr(o);
27188         o_conv.is_owned = ptr_is_owned(o);
27189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27190         o_conv = UpdateFee_clone(&o_conv);
27191         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27192         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
27193         return tag_ptr(ret_conv, true);
27194 }
27195
27196 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_err(int64_t e) {
27197         void* e_ptr = untag_ptr(e);
27198         CHECK_ACCESS(e_ptr);
27199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27201         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27202         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
27203         return tag_ptr(ret_conv, true);
27204 }
27205
27206 jboolean  CS_LDK_CResult_UpdateFeeDecodeErrorZ_is_ok(int64_t o) {
27207         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
27208         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
27209         return ret_conv;
27210 }
27211
27212 void  CS_LDK_CResult_UpdateFeeDecodeErrorZ_free(int64_t _res) {
27213         if (!ptr_is_owned(_res)) return;
27214         void* _res_ptr = untag_ptr(_res);
27215         CHECK_ACCESS(_res_ptr);
27216         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
27217         FREE(untag_ptr(_res));
27218         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
27219 }
27220
27221 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
27222         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27223         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
27224         return tag_ptr(ret_conv, true);
27225 }
27226 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone_ptr(int64_t arg) {
27227         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
27228         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
27229         return ret_conv;
27230 }
27231
27232 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone(int64_t orig) {
27233         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
27234         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27235         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
27236         return tag_ptr(ret_conv, true);
27237 }
27238
27239 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(int64_t o) {
27240         LDKUpdateFulfillHTLC o_conv;
27241         o_conv.inner = untag_ptr(o);
27242         o_conv.is_owned = ptr_is_owned(o);
27243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27244         o_conv = UpdateFulfillHTLC_clone(&o_conv);
27245         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27246         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
27247         return tag_ptr(ret_conv, true);
27248 }
27249
27250 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_err(int64_t e) {
27251         void* e_ptr = untag_ptr(e);
27252         CHECK_ACCESS(e_ptr);
27253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27255         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27256         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
27257         return tag_ptr(ret_conv, true);
27258 }
27259
27260 jboolean  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(int64_t o) {
27261         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
27262         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
27263         return ret_conv;
27264 }
27265
27266 void  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_free(int64_t _res) {
27267         if (!ptr_is_owned(_res)) return;
27268         void* _res_ptr = untag_ptr(_res);
27269         CHECK_ACCESS(_res_ptr);
27270         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
27271         FREE(untag_ptr(_res));
27272         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
27273 }
27274
27275 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
27276         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27277         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
27278         return tag_ptr(ret_conv, true);
27279 }
27280 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27281         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
27282         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
27283         return ret_conv;
27284 }
27285
27286 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(int64_t orig) {
27287         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
27288         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27289         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
27290         return tag_ptr(ret_conv, true);
27291 }
27292
27293 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_ok(int64_t o) {
27294         LDKOnionPacket o_conv;
27295         o_conv.inner = untag_ptr(o);
27296         o_conv.is_owned = ptr_is_owned(o);
27297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27298         o_conv = OnionPacket_clone(&o_conv);
27299         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27300         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
27301         return tag_ptr(ret_conv, true);
27302 }
27303
27304 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_err(int64_t e) {
27305         void* e_ptr = untag_ptr(e);
27306         CHECK_ACCESS(e_ptr);
27307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27309         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27310         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
27311         return tag_ptr(ret_conv, true);
27312 }
27313
27314 jboolean  CS_LDK_CResult_OnionPacketDecodeErrorZ_is_ok(int64_t o) {
27315         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
27316         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
27317         return ret_conv;
27318 }
27319
27320 void  CS_LDK_CResult_OnionPacketDecodeErrorZ_free(int64_t _res) {
27321         if (!ptr_is_owned(_res)) return;
27322         void* _res_ptr = untag_ptr(_res);
27323         CHECK_ACCESS(_res_ptr);
27324         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
27325         FREE(untag_ptr(_res));
27326         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
27327 }
27328
27329 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
27330         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27331         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
27332         return tag_ptr(ret_conv, true);
27333 }
27334 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone_ptr(int64_t arg) {
27335         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
27336         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
27337         return ret_conv;
27338 }
27339
27340 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone(int64_t orig) {
27341         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
27342         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27343         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
27344         return tag_ptr(ret_conv, true);
27345 }
27346
27347 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_ok(int64_t o) {
27348         LDKUpdateAddHTLC o_conv;
27349         o_conv.inner = untag_ptr(o);
27350         o_conv.is_owned = ptr_is_owned(o);
27351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27352         o_conv = UpdateAddHTLC_clone(&o_conv);
27353         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27354         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
27355         return tag_ptr(ret_conv, true);
27356 }
27357
27358 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_err(int64_t e) {
27359         void* e_ptr = untag_ptr(e);
27360         CHECK_ACCESS(e_ptr);
27361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27363         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27364         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
27365         return tag_ptr(ret_conv, true);
27366 }
27367
27368 jboolean  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(int64_t o) {
27369         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
27370         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
27371         return ret_conv;
27372 }
27373
27374 void  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_free(int64_t _res) {
27375         if (!ptr_is_owned(_res)) return;
27376         void* _res_ptr = untag_ptr(_res);
27377         CHECK_ACCESS(_res_ptr);
27378         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
27379         FREE(untag_ptr(_res));
27380         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
27381 }
27382
27383 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
27384         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27385         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
27386         return tag_ptr(ret_conv, true);
27387 }
27388 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27389         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
27390         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
27391         return ret_conv;
27392 }
27393
27394 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone(int64_t orig) {
27395         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
27396         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27397         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
27398         return tag_ptr(ret_conv, true);
27399 }
27400
27401 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_ok(int64_t o) {
27402         LDKOnionMessage o_conv;
27403         o_conv.inner = untag_ptr(o);
27404         o_conv.is_owned = ptr_is_owned(o);
27405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27406         o_conv = OnionMessage_clone(&o_conv);
27407         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27408         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
27409         return tag_ptr(ret_conv, true);
27410 }
27411
27412 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_err(int64_t e) {
27413         void* e_ptr = untag_ptr(e);
27414         CHECK_ACCESS(e_ptr);
27415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27417         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27418         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
27419         return tag_ptr(ret_conv, true);
27420 }
27421
27422 jboolean  CS_LDK_CResult_OnionMessageDecodeErrorZ_is_ok(int64_t o) {
27423         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
27424         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
27425         return ret_conv;
27426 }
27427
27428 void  CS_LDK_CResult_OnionMessageDecodeErrorZ_free(int64_t _res) {
27429         if (!ptr_is_owned(_res)) return;
27430         void* _res_ptr = untag_ptr(_res);
27431         CHECK_ACCESS(_res_ptr);
27432         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
27433         FREE(untag_ptr(_res));
27434         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
27435 }
27436
27437 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
27438         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27439         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
27440         return tag_ptr(ret_conv, true);
27441 }
27442 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone_ptr(int64_t arg) {
27443         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
27444         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
27445         return ret_conv;
27446 }
27447
27448 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone(int64_t orig) {
27449         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
27450         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27451         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
27452         return tag_ptr(ret_conv, true);
27453 }
27454
27455 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_ok(int64_t o) {
27456         LDKFinalOnionHopData o_conv;
27457         o_conv.inner = untag_ptr(o);
27458         o_conv.is_owned = ptr_is_owned(o);
27459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27460         o_conv = FinalOnionHopData_clone(&o_conv);
27461         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27462         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
27463         return tag_ptr(ret_conv, true);
27464 }
27465
27466 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_err(int64_t e) {
27467         void* e_ptr = untag_ptr(e);
27468         CHECK_ACCESS(e_ptr);
27469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27471         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27472         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
27473         return tag_ptr(ret_conv, true);
27474 }
27475
27476 jboolean  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(int64_t o) {
27477         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
27478         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
27479         return ret_conv;
27480 }
27481
27482 void  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_free(int64_t _res) {
27483         if (!ptr_is_owned(_res)) return;
27484         void* _res_ptr = untag_ptr(_res);
27485         CHECK_ACCESS(_res_ptr);
27486         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
27487         FREE(untag_ptr(_res));
27488         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
27489 }
27490
27491 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
27492         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27493         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
27494         return tag_ptr(ret_conv, true);
27495 }
27496 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(int64_t arg) {
27497         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
27498         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
27499         return ret_conv;
27500 }
27501
27502 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone(int64_t orig) {
27503         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
27504         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27505         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
27506         return tag_ptr(ret_conv, true);
27507 }
27508
27509 int64_t  CS_LDK_CResult_PingDecodeErrorZ_ok(int64_t o) {
27510         LDKPing o_conv;
27511         o_conv.inner = untag_ptr(o);
27512         o_conv.is_owned = ptr_is_owned(o);
27513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27514         o_conv = Ping_clone(&o_conv);
27515         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27516         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
27517         return tag_ptr(ret_conv, true);
27518 }
27519
27520 int64_t  CS_LDK_CResult_PingDecodeErrorZ_err(int64_t e) {
27521         void* e_ptr = untag_ptr(e);
27522         CHECK_ACCESS(e_ptr);
27523         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27524         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27525         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27526         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
27527         return tag_ptr(ret_conv, true);
27528 }
27529
27530 jboolean  CS_LDK_CResult_PingDecodeErrorZ_is_ok(int64_t o) {
27531         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
27532         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
27533         return ret_conv;
27534 }
27535
27536 void  CS_LDK_CResult_PingDecodeErrorZ_free(int64_t _res) {
27537         if (!ptr_is_owned(_res)) return;
27538         void* _res_ptr = untag_ptr(_res);
27539         CHECK_ACCESS(_res_ptr);
27540         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
27541         FREE(untag_ptr(_res));
27542         CResult_PingDecodeErrorZ_free(_res_conv);
27543 }
27544
27545 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
27546         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27547         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
27548         return tag_ptr(ret_conv, true);
27549 }
27550 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone_ptr(int64_t arg) {
27551         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
27552         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
27553         return ret_conv;
27554 }
27555
27556 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone(int64_t orig) {
27557         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
27558         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27559         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
27560         return tag_ptr(ret_conv, true);
27561 }
27562
27563 int64_t  CS_LDK_CResult_PongDecodeErrorZ_ok(int64_t o) {
27564         LDKPong o_conv;
27565         o_conv.inner = untag_ptr(o);
27566         o_conv.is_owned = ptr_is_owned(o);
27567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27568         o_conv = Pong_clone(&o_conv);
27569         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27570         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
27571         return tag_ptr(ret_conv, true);
27572 }
27573
27574 int64_t  CS_LDK_CResult_PongDecodeErrorZ_err(int64_t e) {
27575         void* e_ptr = untag_ptr(e);
27576         CHECK_ACCESS(e_ptr);
27577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27579         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27580         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
27581         return tag_ptr(ret_conv, true);
27582 }
27583
27584 jboolean  CS_LDK_CResult_PongDecodeErrorZ_is_ok(int64_t o) {
27585         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
27586         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
27587         return ret_conv;
27588 }
27589
27590 void  CS_LDK_CResult_PongDecodeErrorZ_free(int64_t _res) {
27591         if (!ptr_is_owned(_res)) return;
27592         void* _res_ptr = untag_ptr(_res);
27593         CHECK_ACCESS(_res_ptr);
27594         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
27595         FREE(untag_ptr(_res));
27596         CResult_PongDecodeErrorZ_free(_res_conv);
27597 }
27598
27599 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
27600         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27601         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
27602         return tag_ptr(ret_conv, true);
27603 }
27604 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone_ptr(int64_t arg) {
27605         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
27606         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
27607         return ret_conv;
27608 }
27609
27610 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone(int64_t orig) {
27611         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
27612         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27613         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
27614         return tag_ptr(ret_conv, true);
27615 }
27616
27617 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
27618         LDKUnsignedChannelAnnouncement o_conv;
27619         o_conv.inner = untag_ptr(o);
27620         o_conv.is_owned = ptr_is_owned(o);
27621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27622         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
27623         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27624         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
27625         return tag_ptr(ret_conv, true);
27626 }
27627
27628 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(int64_t e) {
27629         void* e_ptr = untag_ptr(e);
27630         CHECK_ACCESS(e_ptr);
27631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27633         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27634         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
27635         return tag_ptr(ret_conv, true);
27636 }
27637
27638 jboolean  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
27639         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27640         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27641         return ret_conv;
27642 }
27643
27644 void  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
27645         if (!ptr_is_owned(_res)) return;
27646         void* _res_ptr = untag_ptr(_res);
27647         CHECK_ACCESS(_res_ptr);
27648         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27649         FREE(untag_ptr(_res));
27650         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
27651 }
27652
27653 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27654         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27655         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
27656         return tag_ptr(ret_conv, true);
27657 }
27658 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
27659         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27660         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27661         return ret_conv;
27662 }
27663
27664 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
27665         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27666         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27667         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27668         return tag_ptr(ret_conv, true);
27669 }
27670
27671 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
27672         LDKChannelAnnouncement o_conv;
27673         o_conv.inner = untag_ptr(o);
27674         o_conv.is_owned = ptr_is_owned(o);
27675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27676         o_conv = ChannelAnnouncement_clone(&o_conv);
27677         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27678         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
27679         return tag_ptr(ret_conv, true);
27680 }
27681
27682 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_err(int64_t e) {
27683         void* e_ptr = untag_ptr(e);
27684         CHECK_ACCESS(e_ptr);
27685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27687         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27688         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
27689         return tag_ptr(ret_conv, true);
27690 }
27691
27692 jboolean  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
27693         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27694         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27695         return ret_conv;
27696 }
27697
27698 void  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
27699         if (!ptr_is_owned(_res)) return;
27700         void* _res_ptr = untag_ptr(_res);
27701         CHECK_ACCESS(_res_ptr);
27702         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27703         FREE(untag_ptr(_res));
27704         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
27705 }
27706
27707 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27708         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27709         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
27710         return tag_ptr(ret_conv, true);
27711 }
27712 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
27713         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27714         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27715         return ret_conv;
27716 }
27717
27718 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
27719         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27720         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27721         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27722         return tag_ptr(ret_conv, true);
27723 }
27724
27725 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(int64_t o) {
27726         LDKUnsignedChannelUpdate o_conv;
27727         o_conv.inner = untag_ptr(o);
27728         o_conv.is_owned = ptr_is_owned(o);
27729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27730         o_conv = UnsignedChannelUpdate_clone(&o_conv);
27731         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27732         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
27733         return tag_ptr(ret_conv, true);
27734 }
27735
27736 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_err(int64_t e) {
27737         void* e_ptr = untag_ptr(e);
27738         CHECK_ACCESS(e_ptr);
27739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27741         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27742         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
27743         return tag_ptr(ret_conv, true);
27744 }
27745
27746 jboolean  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
27747         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
27748         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
27749         return ret_conv;
27750 }
27751
27752 void  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_free(int64_t _res) {
27753         if (!ptr_is_owned(_res)) return;
27754         void* _res_ptr = untag_ptr(_res);
27755         CHECK_ACCESS(_res_ptr);
27756         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
27757         FREE(untag_ptr(_res));
27758         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
27759 }
27760
27761 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27762         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27763         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
27764         return tag_ptr(ret_conv, true);
27765 }
27766 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
27767         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27768         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27769         return ret_conv;
27770 }
27771
27772 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(int64_t orig) {
27773         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27774         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27775         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
27776         return tag_ptr(ret_conv, true);
27777 }
27778
27779 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_ok(int64_t o) {
27780         LDKChannelUpdate o_conv;
27781         o_conv.inner = untag_ptr(o);
27782         o_conv.is_owned = ptr_is_owned(o);
27783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27784         o_conv = ChannelUpdate_clone(&o_conv);
27785         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27786         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
27787         return tag_ptr(ret_conv, true);
27788 }
27789
27790 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_err(int64_t e) {
27791         void* e_ptr = untag_ptr(e);
27792         CHECK_ACCESS(e_ptr);
27793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27795         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27796         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
27797         return tag_ptr(ret_conv, true);
27798 }
27799
27800 jboolean  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
27801         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
27802         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
27803         return ret_conv;
27804 }
27805
27806 void  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_free(int64_t _res) {
27807         if (!ptr_is_owned(_res)) return;
27808         void* _res_ptr = untag_ptr(_res);
27809         CHECK_ACCESS(_res_ptr);
27810         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
27811         FREE(untag_ptr(_res));
27812         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
27813 }
27814
27815 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27816         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27817         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
27818         return tag_ptr(ret_conv, true);
27819 }
27820 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
27821         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27822         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27823         return ret_conv;
27824 }
27825
27826 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone(int64_t orig) {
27827         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27828         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27829         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
27830         return tag_ptr(ret_conv, true);
27831 }
27832
27833 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_ok(int64_t o) {
27834         LDKErrorMessage o_conv;
27835         o_conv.inner = untag_ptr(o);
27836         o_conv.is_owned = ptr_is_owned(o);
27837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27838         o_conv = ErrorMessage_clone(&o_conv);
27839         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27840         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
27841         return tag_ptr(ret_conv, true);
27842 }
27843
27844 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_err(int64_t e) {
27845         void* e_ptr = untag_ptr(e);
27846         CHECK_ACCESS(e_ptr);
27847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27849         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27850         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
27851         return tag_ptr(ret_conv, true);
27852 }
27853
27854 jboolean  CS_LDK_CResult_ErrorMessageDecodeErrorZ_is_ok(int64_t o) {
27855         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
27856         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
27857         return ret_conv;
27858 }
27859
27860 void  CS_LDK_CResult_ErrorMessageDecodeErrorZ_free(int64_t _res) {
27861         if (!ptr_is_owned(_res)) return;
27862         void* _res_ptr = untag_ptr(_res);
27863         CHECK_ACCESS(_res_ptr);
27864         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
27865         FREE(untag_ptr(_res));
27866         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
27867 }
27868
27869 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
27870         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27871         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
27872         return tag_ptr(ret_conv, true);
27873 }
27874 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone_ptr(int64_t arg) {
27875         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
27876         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
27877         return ret_conv;
27878 }
27879
27880 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone(int64_t orig) {
27881         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
27882         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27883         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
27884         return tag_ptr(ret_conv, true);
27885 }
27886
27887 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_ok(int64_t o) {
27888         LDKWarningMessage o_conv;
27889         o_conv.inner = untag_ptr(o);
27890         o_conv.is_owned = ptr_is_owned(o);
27891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27892         o_conv = WarningMessage_clone(&o_conv);
27893         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27894         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
27895         return tag_ptr(ret_conv, true);
27896 }
27897
27898 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_err(int64_t e) {
27899         void* e_ptr = untag_ptr(e);
27900         CHECK_ACCESS(e_ptr);
27901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27903         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27904         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
27905         return tag_ptr(ret_conv, true);
27906 }
27907
27908 jboolean  CS_LDK_CResult_WarningMessageDecodeErrorZ_is_ok(int64_t o) {
27909         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
27910         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
27911         return ret_conv;
27912 }
27913
27914 void  CS_LDK_CResult_WarningMessageDecodeErrorZ_free(int64_t _res) {
27915         if (!ptr_is_owned(_res)) return;
27916         void* _res_ptr = untag_ptr(_res);
27917         CHECK_ACCESS(_res_ptr);
27918         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
27919         FREE(untag_ptr(_res));
27920         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
27921 }
27922
27923 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
27924         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27925         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
27926         return tag_ptr(ret_conv, true);
27927 }
27928 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone_ptr(int64_t arg) {
27929         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
27930         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
27931         return ret_conv;
27932 }
27933
27934 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone(int64_t orig) {
27935         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
27936         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27937         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
27938         return tag_ptr(ret_conv, true);
27939 }
27940
27941 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(int64_t o) {
27942         LDKUnsignedNodeAnnouncement o_conv;
27943         o_conv.inner = untag_ptr(o);
27944         o_conv.is_owned = ptr_is_owned(o);
27945         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27946         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
27947         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27948         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
27949         return tag_ptr(ret_conv, true);
27950 }
27951
27952 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(int64_t e) {
27953         void* e_ptr = untag_ptr(e);
27954         CHECK_ACCESS(e_ptr);
27955         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27956         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27957         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27958         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
27959         return tag_ptr(ret_conv, true);
27960 }
27961
27962 jboolean  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
27963         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
27964         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
27965         return ret_conv;
27966 }
27967
27968 void  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(int64_t _res) {
27969         if (!ptr_is_owned(_res)) return;
27970         void* _res_ptr = untag_ptr(_res);
27971         CHECK_ACCESS(_res_ptr);
27972         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
27973         FREE(untag_ptr(_res));
27974         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
27975 }
27976
27977 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27978         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27979         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
27980         return tag_ptr(ret_conv, true);
27981 }
27982 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
27983         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
27984         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27985         return ret_conv;
27986 }
27987
27988 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
27989         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
27990         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27991         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
27992         return tag_ptr(ret_conv, true);
27993 }
27994
27995 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_ok(int64_t o) {
27996         LDKNodeAnnouncement o_conv;
27997         o_conv.inner = untag_ptr(o);
27998         o_conv.is_owned = ptr_is_owned(o);
27999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28000         o_conv = NodeAnnouncement_clone(&o_conv);
28001         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28002         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
28003         return tag_ptr(ret_conv, true);
28004 }
28005
28006 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_err(int64_t e) {
28007         void* e_ptr = untag_ptr(e);
28008         CHECK_ACCESS(e_ptr);
28009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28011         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28012         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
28013         return tag_ptr(ret_conv, true);
28014 }
28015
28016 jboolean  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
28017         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
28018         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
28019         return ret_conv;
28020 }
28021
28022 void  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_free(int64_t _res) {
28023         if (!ptr_is_owned(_res)) return;
28024         void* _res_ptr = untag_ptr(_res);
28025         CHECK_ACCESS(_res_ptr);
28026         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
28027         FREE(untag_ptr(_res));
28028         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
28029 }
28030
28031 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
28032         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28033         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
28034         return tag_ptr(ret_conv, true);
28035 }
28036 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
28037         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
28038         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
28039         return ret_conv;
28040 }
28041
28042 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
28043         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
28044         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28045         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
28046         return tag_ptr(ret_conv, true);
28047 }
28048
28049 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_ok(int64_t o) {
28050         LDKQueryShortChannelIds o_conv;
28051         o_conv.inner = untag_ptr(o);
28052         o_conv.is_owned = ptr_is_owned(o);
28053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28054         o_conv = QueryShortChannelIds_clone(&o_conv);
28055         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28056         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
28057         return tag_ptr(ret_conv, true);
28058 }
28059
28060 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_err(int64_t e) {
28061         void* e_ptr = untag_ptr(e);
28062         CHECK_ACCESS(e_ptr);
28063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28065         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28066         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
28067         return tag_ptr(ret_conv, true);
28068 }
28069
28070 jboolean  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(int64_t o) {
28071         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
28072         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
28073         return ret_conv;
28074 }
28075
28076 void  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_free(int64_t _res) {
28077         if (!ptr_is_owned(_res)) return;
28078         void* _res_ptr = untag_ptr(_res);
28079         CHECK_ACCESS(_res_ptr);
28080         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
28081         FREE(untag_ptr(_res));
28082         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
28083 }
28084
28085 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
28086         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28087         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
28088         return tag_ptr(ret_conv, true);
28089 }
28090 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(int64_t arg) {
28091         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
28092         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
28093         return ret_conv;
28094 }
28095
28096 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone(int64_t orig) {
28097         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
28098         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28099         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
28100         return tag_ptr(ret_conv, true);
28101 }
28102
28103 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(int64_t o) {
28104         LDKReplyShortChannelIdsEnd o_conv;
28105         o_conv.inner = untag_ptr(o);
28106         o_conv.is_owned = ptr_is_owned(o);
28107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28108         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
28109         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28110         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
28111         return tag_ptr(ret_conv, true);
28112 }
28113
28114 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(int64_t e) {
28115         void* e_ptr = untag_ptr(e);
28116         CHECK_ACCESS(e_ptr);
28117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28119         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28120         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
28121         return tag_ptr(ret_conv, true);
28122 }
28123
28124 jboolean  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(int64_t o) {
28125         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
28126         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
28127         return ret_conv;
28128 }
28129
28130 void  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(int64_t _res) {
28131         if (!ptr_is_owned(_res)) return;
28132         void* _res_ptr = untag_ptr(_res);
28133         CHECK_ACCESS(_res_ptr);
28134         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
28135         FREE(untag_ptr(_res));
28136         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
28137 }
28138
28139 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
28140         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28141         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
28142         return tag_ptr(ret_conv, true);
28143 }
28144 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(int64_t arg) {
28145         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
28146         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
28147         return ret_conv;
28148 }
28149
28150 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(int64_t orig) {
28151         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
28152         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28153         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
28154         return tag_ptr(ret_conv, true);
28155 }
28156
28157 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_ok(int64_t o) {
28158         LDKQueryChannelRange o_conv;
28159         o_conv.inner = untag_ptr(o);
28160         o_conv.is_owned = ptr_is_owned(o);
28161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28162         o_conv = QueryChannelRange_clone(&o_conv);
28163         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28164         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
28165         return tag_ptr(ret_conv, true);
28166 }
28167
28168 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_err(int64_t e) {
28169         void* e_ptr = untag_ptr(e);
28170         CHECK_ACCESS(e_ptr);
28171         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28172         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28173         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28174         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
28175         return tag_ptr(ret_conv, true);
28176 }
28177
28178 jboolean  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_is_ok(int64_t o) {
28179         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
28180         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
28181         return ret_conv;
28182 }
28183
28184 void  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_free(int64_t _res) {
28185         if (!ptr_is_owned(_res)) return;
28186         void* _res_ptr = untag_ptr(_res);
28187         CHECK_ACCESS(_res_ptr);
28188         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
28189         FREE(untag_ptr(_res));
28190         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
28191 }
28192
28193 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
28194         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28195         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
28196         return tag_ptr(ret_conv, true);
28197 }
28198 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
28199         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
28200         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
28201         return ret_conv;
28202 }
28203
28204 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone(int64_t orig) {
28205         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
28206         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28207         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
28208         return tag_ptr(ret_conv, true);
28209 }
28210
28211 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_ok(int64_t o) {
28212         LDKReplyChannelRange o_conv;
28213         o_conv.inner = untag_ptr(o);
28214         o_conv.is_owned = ptr_is_owned(o);
28215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28216         o_conv = ReplyChannelRange_clone(&o_conv);
28217         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28218         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
28219         return tag_ptr(ret_conv, true);
28220 }
28221
28222 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_err(int64_t e) {
28223         void* e_ptr = untag_ptr(e);
28224         CHECK_ACCESS(e_ptr);
28225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28227         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28228         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
28229         return tag_ptr(ret_conv, true);
28230 }
28231
28232 jboolean  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(int64_t o) {
28233         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
28234         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
28235         return ret_conv;
28236 }
28237
28238 void  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_free(int64_t _res) {
28239         if (!ptr_is_owned(_res)) return;
28240         void* _res_ptr = untag_ptr(_res);
28241         CHECK_ACCESS(_res_ptr);
28242         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
28243         FREE(untag_ptr(_res));
28244         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
28245 }
28246
28247 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
28248         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28249         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
28250         return tag_ptr(ret_conv, true);
28251 }
28252 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
28253         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
28254         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
28255         return ret_conv;
28256 }
28257
28258 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone(int64_t orig) {
28259         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
28260         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28261         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
28262         return tag_ptr(ret_conv, true);
28263 }
28264
28265 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_ok(int64_t o) {
28266         LDKGossipTimestampFilter o_conv;
28267         o_conv.inner = untag_ptr(o);
28268         o_conv.is_owned = ptr_is_owned(o);
28269         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28270         o_conv = GossipTimestampFilter_clone(&o_conv);
28271         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28272         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
28273         return tag_ptr(ret_conv, true);
28274 }
28275
28276 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_err(int64_t e) {
28277         void* e_ptr = untag_ptr(e);
28278         CHECK_ACCESS(e_ptr);
28279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28281         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28282         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
28283         return tag_ptr(ret_conv, true);
28284 }
28285
28286 jboolean  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(int64_t o) {
28287         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
28288         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
28289         return ret_conv;
28290 }
28291
28292 void  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_free(int64_t _res) {
28293         if (!ptr_is_owned(_res)) return;
28294         void* _res_ptr = untag_ptr(_res);
28295         CHECK_ACCESS(_res_ptr);
28296         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
28297         FREE(untag_ptr(_res));
28298         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
28299 }
28300
28301 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
28302         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28303         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
28304         return tag_ptr(ret_conv, true);
28305 }
28306 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(int64_t arg) {
28307         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
28308         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
28309         return ret_conv;
28310 }
28311
28312 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone(int64_t orig) {
28313         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
28314         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28315         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
28316         return tag_ptr(ret_conv, true);
28317 }
28318
28319 void  CS_LDK_CVec_PhantomRouteHintsZ_free(int64_tArray _res) {
28320         LDKCVec_PhantomRouteHintsZ _res_constr;
28321         _res_constr.datalen = _res->arr_len;
28322         if (_res_constr.datalen > 0)
28323                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
28324         else
28325                 _res_constr.data = NULL;
28326         int64_t* _res_vals = _res->elems;
28327         for (size_t t = 0; t < _res_constr.datalen; t++) {
28328                 int64_t _res_conv_19 = _res_vals[t];
28329                 LDKPhantomRouteHints _res_conv_19_conv;
28330                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28331                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28332                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28333                 _res_constr.data[t] = _res_conv_19_conv;
28334         }
28335         FREE(_res);
28336         CVec_PhantomRouteHintsZ_free(_res_constr);
28337 }
28338
28339 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(int64_t o) {
28340         LDKBolt11Invoice o_conv;
28341         o_conv.inner = untag_ptr(o);
28342         o_conv.is_owned = ptr_is_owned(o);
28343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28344         o_conv = Bolt11Invoice_clone(&o_conv);
28345         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28346         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
28347         return tag_ptr(ret_conv, true);
28348 }
28349
28350 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(int64_t e) {
28351         void* e_ptr = untag_ptr(e);
28352         CHECK_ACCESS(e_ptr);
28353         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
28354         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
28355         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28356         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
28357         return tag_ptr(ret_conv, true);
28358 }
28359
28360 jboolean  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(int64_t o) {
28361         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
28362         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
28363         return ret_conv;
28364 }
28365
28366 void  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(int64_t _res) {
28367         if (!ptr_is_owned(_res)) return;
28368         void* _res_ptr = untag_ptr(_res);
28369         CHECK_ACCESS(_res_ptr);
28370         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
28371         FREE(untag_ptr(_res));
28372         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
28373 }
28374
28375 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
28376         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28377         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
28378         return tag_ptr(ret_conv, true);
28379 }
28380 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(int64_t arg) {
28381         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
28382         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
28383         return ret_conv;
28384 }
28385
28386 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(int64_t orig) {
28387         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
28388         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28389         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
28390         return tag_ptr(ret_conv, true);
28391 }
28392
28393 void  CS_LDK_CVec_FutureZ_free(int64_tArray _res) {
28394         LDKCVec_FutureZ _res_constr;
28395         _res_constr.datalen = _res->arr_len;
28396         if (_res_constr.datalen > 0)
28397                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
28398         else
28399                 _res_constr.data = NULL;
28400         int64_t* _res_vals = _res->elems;
28401         for (size_t i = 0; i < _res_constr.datalen; i++) {
28402                 int64_t _res_conv_8 = _res_vals[i];
28403                 LDKFuture _res_conv_8_conv;
28404                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
28405                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
28406                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
28407                 _res_constr.data[i] = _res_conv_8_conv;
28408         }
28409         FREE(_res);
28410         CVec_FutureZ_free(_res_constr);
28411 }
28412
28413 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_ok(int64_t o) {
28414         void* o_ptr = untag_ptr(o);
28415         CHECK_ACCESS(o_ptr);
28416         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
28417         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
28418         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28419         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
28420         return tag_ptr(ret_conv, true);
28421 }
28422
28423 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_err(int64_t e) {
28424         void* e_ptr = untag_ptr(e);
28425         CHECK_ACCESS(e_ptr);
28426         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28427         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28428         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28429         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
28430         return tag_ptr(ret_conv, true);
28431 }
28432
28433 jboolean  CS_LDK_CResult_OffersMessageDecodeErrorZ_is_ok(int64_t o) {
28434         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
28435         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
28436         return ret_conv;
28437 }
28438
28439 void  CS_LDK_CResult_OffersMessageDecodeErrorZ_free(int64_t _res) {
28440         if (!ptr_is_owned(_res)) return;
28441         void* _res_ptr = untag_ptr(_res);
28442         CHECK_ACCESS(_res_ptr);
28443         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
28444         FREE(untag_ptr(_res));
28445         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
28446 }
28447
28448 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
28449         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28450         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
28451         return tag_ptr(ret_conv, true);
28452 }
28453 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone_ptr(int64_t arg) {
28454         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
28455         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
28456         return ret_conv;
28457 }
28458
28459 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone(int64_t orig) {
28460         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
28461         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28462         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
28463         return tag_ptr(ret_conv, true);
28464 }
28465
28466 int64_t  CS_LDK_COption_HTLCClaimZ_some(int32_t o) {
28467         LDKHTLCClaim o_conv = LDKHTLCClaim_from_cs(o);
28468         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28469         *ret_copy = COption_HTLCClaimZ_some(o_conv);
28470         int64_t ret_ref = tag_ptr(ret_copy, true);
28471         return ret_ref;
28472 }
28473
28474 int64_t  CS_LDK_COption_HTLCClaimZ_none() {
28475         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28476         *ret_copy = COption_HTLCClaimZ_none();
28477         int64_t ret_ref = tag_ptr(ret_copy, true);
28478         return ret_ref;
28479 }
28480
28481 void  CS_LDK_COption_HTLCClaimZ_free(int64_t _res) {
28482         if (!ptr_is_owned(_res)) return;
28483         void* _res_ptr = untag_ptr(_res);
28484         CHECK_ACCESS(_res_ptr);
28485         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
28486         FREE(untag_ptr(_res));
28487         COption_HTLCClaimZ_free(_res_conv);
28488 }
28489
28490 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(int64_t o) {
28491         LDKCounterpartyCommitmentSecrets o_conv;
28492         o_conv.inner = untag_ptr(o);
28493         o_conv.is_owned = ptr_is_owned(o);
28494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28495         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
28496         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28497         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
28498         return tag_ptr(ret_conv, true);
28499 }
28500
28501 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(int64_t e) {
28502         void* e_ptr = untag_ptr(e);
28503         CHECK_ACCESS(e_ptr);
28504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28506         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28507         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
28508         return tag_ptr(ret_conv, true);
28509 }
28510
28511 jboolean  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(int64_t o) {
28512         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
28513         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
28514         return ret_conv;
28515 }
28516
28517 void  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(int64_t _res) {
28518         if (!ptr_is_owned(_res)) return;
28519         void* _res_ptr = untag_ptr(_res);
28520         CHECK_ACCESS(_res_ptr);
28521         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
28522         FREE(untag_ptr(_res));
28523         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
28524 }
28525
28526 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
28527         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28528         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
28529         return tag_ptr(ret_conv, true);
28530 }
28531 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(int64_t arg) {
28532         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
28533         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
28534         return ret_conv;
28535 }
28536
28537 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(int64_t orig) {
28538         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
28539         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28540         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
28541         return tag_ptr(ret_conv, true);
28542 }
28543
28544 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_ok(int64_t o) {
28545         LDKTxCreationKeys o_conv;
28546         o_conv.inner = untag_ptr(o);
28547         o_conv.is_owned = ptr_is_owned(o);
28548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28549         o_conv = TxCreationKeys_clone(&o_conv);
28550         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28551         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
28552         return tag_ptr(ret_conv, true);
28553 }
28554
28555 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_err(int64_t e) {
28556         void* e_ptr = untag_ptr(e);
28557         CHECK_ACCESS(e_ptr);
28558         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28559         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28560         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28561         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
28562         return tag_ptr(ret_conv, true);
28563 }
28564
28565 jboolean  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_is_ok(int64_t o) {
28566         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
28567         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
28568         return ret_conv;
28569 }
28570
28571 void  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_free(int64_t _res) {
28572         if (!ptr_is_owned(_res)) return;
28573         void* _res_ptr = untag_ptr(_res);
28574         CHECK_ACCESS(_res_ptr);
28575         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
28576         FREE(untag_ptr(_res));
28577         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
28578 }
28579
28580 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
28581         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28582         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
28583         return tag_ptr(ret_conv, true);
28584 }
28585 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(int64_t arg) {
28586         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
28587         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
28588         return ret_conv;
28589 }
28590
28591 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone(int64_t orig) {
28592         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
28593         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28594         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
28595         return tag_ptr(ret_conv, true);
28596 }
28597
28598 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_ok(int64_t o) {
28599         LDKChannelPublicKeys o_conv;
28600         o_conv.inner = untag_ptr(o);
28601         o_conv.is_owned = ptr_is_owned(o);
28602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28603         o_conv = ChannelPublicKeys_clone(&o_conv);
28604         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28605         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
28606         return tag_ptr(ret_conv, true);
28607 }
28608
28609 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_err(int64_t e) {
28610         void* e_ptr = untag_ptr(e);
28611         CHECK_ACCESS(e_ptr);
28612         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28613         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28614         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28615         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
28616         return tag_ptr(ret_conv, true);
28617 }
28618
28619 jboolean  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(int64_t o) {
28620         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
28621         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
28622         return ret_conv;
28623 }
28624
28625 void  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_free(int64_t _res) {
28626         if (!ptr_is_owned(_res)) return;
28627         void* _res_ptr = untag_ptr(_res);
28628         CHECK_ACCESS(_res_ptr);
28629         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
28630         FREE(untag_ptr(_res));
28631         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
28632 }
28633
28634 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
28635         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28636         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
28637         return tag_ptr(ret_conv, true);
28638 }
28639 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(int64_t arg) {
28640         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
28641         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
28642         return ret_conv;
28643 }
28644
28645 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone(int64_t orig) {
28646         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
28647         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28648         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
28649         return tag_ptr(ret_conv, true);
28650 }
28651
28652 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(int64_t o) {
28653         LDKHTLCOutputInCommitment o_conv;
28654         o_conv.inner = untag_ptr(o);
28655         o_conv.is_owned = ptr_is_owned(o);
28656         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28657         o_conv = HTLCOutputInCommitment_clone(&o_conv);
28658         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28659         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
28660         return tag_ptr(ret_conv, true);
28661 }
28662
28663 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(int64_t e) {
28664         void* e_ptr = untag_ptr(e);
28665         CHECK_ACCESS(e_ptr);
28666         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28667         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28668         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28669         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
28670         return tag_ptr(ret_conv, true);
28671 }
28672
28673 jboolean  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(int64_t o) {
28674         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
28675         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
28676         return ret_conv;
28677 }
28678
28679 void  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(int64_t _res) {
28680         if (!ptr_is_owned(_res)) return;
28681         void* _res_ptr = untag_ptr(_res);
28682         CHECK_ACCESS(_res_ptr);
28683         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
28684         FREE(untag_ptr(_res));
28685         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
28686 }
28687
28688 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
28689         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28690         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
28691         return tag_ptr(ret_conv, true);
28692 }
28693 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(int64_t arg) {
28694         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
28695         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
28696         return ret_conv;
28697 }
28698
28699 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(int64_t orig) {
28700         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
28701         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28702         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
28703         return tag_ptr(ret_conv, true);
28704 }
28705
28706 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
28707         LDKCounterpartyChannelTransactionParameters o_conv;
28708         o_conv.inner = untag_ptr(o);
28709         o_conv.is_owned = ptr_is_owned(o);
28710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28711         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
28712         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28713         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28714         return tag_ptr(ret_conv, true);
28715 }
28716
28717 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
28718         void* e_ptr = untag_ptr(e);
28719         CHECK_ACCESS(e_ptr);
28720         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28721         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28722         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28723         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
28724         return tag_ptr(ret_conv, true);
28725 }
28726
28727 jboolean  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
28728         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28729         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28730         return ret_conv;
28731 }
28732
28733 void  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
28734         if (!ptr_is_owned(_res)) return;
28735         void* _res_ptr = untag_ptr(_res);
28736         CHECK_ACCESS(_res_ptr);
28737         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28738         FREE(untag_ptr(_res));
28739         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28740 }
28741
28742 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28743         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28744         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
28745         return tag_ptr(ret_conv, true);
28746 }
28747 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
28748         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28749         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28750         return ret_conv;
28751 }
28752
28753 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
28754         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28755         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28756         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28757         return tag_ptr(ret_conv, true);
28758 }
28759
28760 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
28761         LDKChannelTransactionParameters o_conv;
28762         o_conv.inner = untag_ptr(o);
28763         o_conv.is_owned = ptr_is_owned(o);
28764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28765         o_conv = ChannelTransactionParameters_clone(&o_conv);
28766         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28767         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28768         return tag_ptr(ret_conv, true);
28769 }
28770
28771 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
28772         void* e_ptr = untag_ptr(e);
28773         CHECK_ACCESS(e_ptr);
28774         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28775         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28776         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28777         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
28778         return tag_ptr(ret_conv, true);
28779 }
28780
28781 jboolean  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
28782         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28783         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28784         return ret_conv;
28785 }
28786
28787 void  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
28788         if (!ptr_is_owned(_res)) return;
28789         void* _res_ptr = untag_ptr(_res);
28790         CHECK_ACCESS(_res_ptr);
28791         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28792         FREE(untag_ptr(_res));
28793         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28794 }
28795
28796 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28797         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28798         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
28799         return tag_ptr(ret_conv, true);
28800 }
28801 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
28802         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28803         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28804         return ret_conv;
28805 }
28806
28807 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
28808         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28809         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28810         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28811         return tag_ptr(ret_conv, true);
28812 }
28813
28814 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
28815         LDKHolderCommitmentTransaction o_conv;
28816         o_conv.inner = untag_ptr(o);
28817         o_conv.is_owned = ptr_is_owned(o);
28818         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28819         o_conv = HolderCommitmentTransaction_clone(&o_conv);
28820         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28821         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
28822         return tag_ptr(ret_conv, true);
28823 }
28824
28825 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_err(int64_t e) {
28826         void* e_ptr = untag_ptr(e);
28827         CHECK_ACCESS(e_ptr);
28828         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28829         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28830         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28831         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
28832         return tag_ptr(ret_conv, true);
28833 }
28834
28835 jboolean  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
28836         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28837         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28838         return ret_conv;
28839 }
28840
28841 void  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
28842         if (!ptr_is_owned(_res)) return;
28843         void* _res_ptr = untag_ptr(_res);
28844         CHECK_ACCESS(_res_ptr);
28845         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28846         FREE(untag_ptr(_res));
28847         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
28848 }
28849
28850 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28851         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28852         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
28853         return tag_ptr(ret_conv, true);
28854 }
28855 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
28856         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28857         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28858         return ret_conv;
28859 }
28860
28861 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
28862         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28863         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28864         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28865         return tag_ptr(ret_conv, true);
28866 }
28867
28868 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
28869         LDKBuiltCommitmentTransaction o_conv;
28870         o_conv.inner = untag_ptr(o);
28871         o_conv.is_owned = ptr_is_owned(o);
28872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28873         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
28874         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28875         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
28876         return tag_ptr(ret_conv, true);
28877 }
28878
28879 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(int64_t e) {
28880         void* e_ptr = untag_ptr(e);
28881         CHECK_ACCESS(e_ptr);
28882         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28883         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28884         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28885         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
28886         return tag_ptr(ret_conv, true);
28887 }
28888
28889 jboolean  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
28890         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28891         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28892         return ret_conv;
28893 }
28894
28895 void  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
28896         if (!ptr_is_owned(_res)) return;
28897         void* _res_ptr = untag_ptr(_res);
28898         CHECK_ACCESS(_res_ptr);
28899         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28900         FREE(untag_ptr(_res));
28901         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
28902 }
28903
28904 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28905         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28906         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
28907         return tag_ptr(ret_conv, true);
28908 }
28909 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
28910         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28911         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28912         return ret_conv;
28913 }
28914
28915 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
28916         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28917         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28918         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28919         return tag_ptr(ret_conv, true);
28920 }
28921
28922 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_ok(int64_t o) {
28923         LDKTrustedClosingTransaction o_conv;
28924         o_conv.inner = untag_ptr(o);
28925         o_conv.is_owned = ptr_is_owned(o);
28926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28927         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
28928         
28929         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28930         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
28931         return tag_ptr(ret_conv, true);
28932 }
28933
28934 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_err() {
28935         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28936         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
28937         return tag_ptr(ret_conv, true);
28938 }
28939
28940 jboolean  CS_LDK_CResult_TrustedClosingTransactionNoneZ_is_ok(int64_t o) {
28941         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
28942         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
28943         return ret_conv;
28944 }
28945
28946 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_free(int64_t _res) {
28947         if (!ptr_is_owned(_res)) return;
28948         void* _res_ptr = untag_ptr(_res);
28949         CHECK_ACCESS(_res_ptr);
28950         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
28951         FREE(untag_ptr(_res));
28952         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
28953 }
28954
28955 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_ok(int64_t o) {
28956         LDKCommitmentTransaction o_conv;
28957         o_conv.inner = untag_ptr(o);
28958         o_conv.is_owned = ptr_is_owned(o);
28959         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28960         o_conv = CommitmentTransaction_clone(&o_conv);
28961         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28962         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
28963         return tag_ptr(ret_conv, true);
28964 }
28965
28966 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_err(int64_t e) {
28967         void* e_ptr = untag_ptr(e);
28968         CHECK_ACCESS(e_ptr);
28969         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28970         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28971         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28972         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
28973         return tag_ptr(ret_conv, true);
28974 }
28975
28976 jboolean  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
28977         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28978         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28979         return ret_conv;
28980 }
28981
28982 void  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_free(int64_t _res) {
28983         if (!ptr_is_owned(_res)) return;
28984         void* _res_ptr = untag_ptr(_res);
28985         CHECK_ACCESS(_res_ptr);
28986         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
28987         FREE(untag_ptr(_res));
28988         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
28989 }
28990
28991 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28992         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28993         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
28994         return tag_ptr(ret_conv, true);
28995 }
28996 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
28997         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28998         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28999         return ret_conv;
29000 }
29001
29002 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
29003         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
29004         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
29005         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
29006         return tag_ptr(ret_conv, true);
29007 }
29008
29009 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_ok(int64_t o) {
29010         LDKTrustedCommitmentTransaction o_conv;
29011         o_conv.inner = untag_ptr(o);
29012         o_conv.is_owned = ptr_is_owned(o);
29013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29014         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
29015         
29016         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
29017         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
29018         return tag_ptr(ret_conv, true);
29019 }
29020
29021 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_err() {
29022         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
29023         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
29024         return tag_ptr(ret_conv, true);
29025 }
29026
29027 jboolean  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_is_ok(int64_t o) {
29028         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
29029         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
29030         return ret_conv;
29031 }
29032
29033 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_free(int64_t _res) {
29034         if (!ptr_is_owned(_res)) return;
29035         void* _res_ptr = untag_ptr(_res);
29036         CHECK_ACCESS(_res_ptr);
29037         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
29038         FREE(untag_ptr(_res));
29039         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
29040 }
29041
29042 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
29043         LDKCVec_ECDSASignatureZ o_constr;
29044         o_constr.datalen = o->arr_len;
29045         if (o_constr.datalen > 0)
29046                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
29047         else
29048                 o_constr.data = NULL;
29049         int8_tArray* o_vals = (void*) o->elems;
29050         for (size_t i = 0; i < o_constr.datalen; i++) {
29051                 int8_tArray o_conv_8 = o_vals[i];
29052                 LDKECDSASignature o_conv_8_ref;
29053                 CHECK(o_conv_8->arr_len == 64);
29054                 memcpy(o_conv_8_ref.compact_form, o_conv_8->elems, 64); FREE(o_conv_8);
29055                 o_constr.data[i] = o_conv_8_ref;
29056         }
29057         FREE(o);
29058         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29059         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
29060         return tag_ptr(ret_conv, true);
29061 }
29062
29063 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_err() {
29064         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29065         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
29066         return tag_ptr(ret_conv, true);
29067 }
29068
29069 jboolean  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_is_ok(int64_t o) {
29070         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
29071         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
29072         return ret_conv;
29073 }
29074
29075 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_free(int64_t _res) {
29076         if (!ptr_is_owned(_res)) return;
29077         void* _res_ptr = untag_ptr(_res);
29078         CHECK_ACCESS(_res_ptr);
29079         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
29080         FREE(untag_ptr(_res));
29081         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
29082 }
29083
29084 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
29085         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29086         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
29087         return tag_ptr(ret_conv, true);
29088 }
29089 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(int64_t arg) {
29090         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
29091         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
29092         return ret_conv;
29093 }
29094
29095 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone(int64_t orig) {
29096         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
29097         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29098         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
29099         return tag_ptr(ret_conv, true);
29100 }
29101
29102 int64_t  CS_LDK_COption_usizeZ_some(int64_t o) {
29103         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29104         *ret_copy = COption_usizeZ_some(o);
29105         int64_t ret_ref = tag_ptr(ret_copy, true);
29106         return ret_ref;
29107 }
29108
29109 int64_t  CS_LDK_COption_usizeZ_none() {
29110         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29111         *ret_copy = COption_usizeZ_none();
29112         int64_t ret_ref = tag_ptr(ret_copy, true);
29113         return ret_ref;
29114 }
29115
29116 void  CS_LDK_COption_usizeZ_free(int64_t _res) {
29117         if (!ptr_is_owned(_res)) return;
29118         void* _res_ptr = untag_ptr(_res);
29119         CHECK_ACCESS(_res_ptr);
29120         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
29121         FREE(untag_ptr(_res));
29122         COption_usizeZ_free(_res_conv);
29123 }
29124
29125 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
29126         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29127         *ret_copy = COption_usizeZ_clone(arg);
29128         int64_t ret_ref = tag_ptr(ret_copy, true);
29129         return ret_ref;
29130 }
29131 int64_t  CS_LDK_COption_usizeZ_clone_ptr(int64_t arg) {
29132         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
29133         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
29134         return ret_conv;
29135 }
29136
29137 int64_t  CS_LDK_COption_usizeZ_clone(int64_t orig) {
29138         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
29139         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29140         *ret_copy = COption_usizeZ_clone(orig_conv);
29141         int64_t ret_ref = tag_ptr(ret_copy, true);
29142         return ret_ref;
29143 }
29144
29145 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_ok(int64_t o) {
29146         LDKShutdownScript o_conv;
29147         o_conv.inner = untag_ptr(o);
29148         o_conv.is_owned = ptr_is_owned(o);
29149         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29150         o_conv = ShutdownScript_clone(&o_conv);
29151         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29152         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
29153         return tag_ptr(ret_conv, true);
29154 }
29155
29156 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_err(int64_t e) {
29157         void* e_ptr = untag_ptr(e);
29158         CHECK_ACCESS(e_ptr);
29159         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29160         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29161         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29162         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
29163         return tag_ptr(ret_conv, true);
29164 }
29165
29166 jboolean  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_is_ok(int64_t o) {
29167         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
29168         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
29169         return ret_conv;
29170 }
29171
29172 void  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_free(int64_t _res) {
29173         if (!ptr_is_owned(_res)) return;
29174         void* _res_ptr = untag_ptr(_res);
29175         CHECK_ACCESS(_res_ptr);
29176         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
29177         FREE(untag_ptr(_res));
29178         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
29179 }
29180
29181 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
29182         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29183         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
29184         return tag_ptr(ret_conv, true);
29185 }
29186 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(int64_t arg) {
29187         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
29188         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
29189         return ret_conv;
29190 }
29191
29192 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone(int64_t orig) {
29193         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
29194         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29195         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
29196         return tag_ptr(ret_conv, true);
29197 }
29198
29199 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(int64_t o) {
29200         LDKShutdownScript o_conv;
29201         o_conv.inner = untag_ptr(o);
29202         o_conv.is_owned = ptr_is_owned(o);
29203         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29204         o_conv = ShutdownScript_clone(&o_conv);
29205         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29206         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
29207         return tag_ptr(ret_conv, true);
29208 }
29209
29210 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_err(int64_t e) {
29211         LDKInvalidShutdownScript e_conv;
29212         e_conv.inner = untag_ptr(e);
29213         e_conv.is_owned = ptr_is_owned(e);
29214         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
29215         e_conv = InvalidShutdownScript_clone(&e_conv);
29216         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29217         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
29218         return tag_ptr(ret_conv, true);
29219 }
29220
29221 jboolean  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(int64_t o) {
29222         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
29223         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
29224         return ret_conv;
29225 }
29226
29227 void  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_free(int64_t _res) {
29228         if (!ptr_is_owned(_res)) return;
29229         void* _res_ptr = untag_ptr(_res);
29230         CHECK_ACCESS(_res_ptr);
29231         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
29232         FREE(untag_ptr(_res));
29233         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
29234 }
29235
29236 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
29237         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29238         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
29239         return tag_ptr(ret_conv, true);
29240 }
29241 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(int64_t arg) {
29242         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
29243         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
29244         return ret_conv;
29245 }
29246
29247 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(int64_t orig) {
29248         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
29249         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29250         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
29251         return tag_ptr(ret_conv, true);
29252 }
29253
29254 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_ok(int64_t o) {
29255         void* o_ptr = untag_ptr(o);
29256         CHECK_ACCESS(o_ptr);
29257         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
29258         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
29259         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29260         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
29261         return tag_ptr(ret_conv, true);
29262 }
29263
29264 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_err(int64_t e) {
29265         void* e_ptr = untag_ptr(e);
29266         CHECK_ACCESS(e_ptr);
29267         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29268         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29269         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29270         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
29271         return tag_ptr(ret_conv, true);
29272 }
29273
29274 jboolean  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_is_ok(int64_t o) {
29275         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
29276         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
29277         return ret_conv;
29278 }
29279
29280 void  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_free(int64_t _res) {
29281         if (!ptr_is_owned(_res)) return;
29282         void* _res_ptr = untag_ptr(_res);
29283         CHECK_ACCESS(_res_ptr);
29284         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
29285         FREE(untag_ptr(_res));
29286         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
29287 }
29288
29289 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
29290         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29291         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
29292         return tag_ptr(ret_conv, true);
29293 }
29294 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(int64_t arg) {
29295         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
29296         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
29297         return ret_conv;
29298 }
29299
29300 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone(int64_t orig) {
29301         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
29302         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29303         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
29304         return tag_ptr(ret_conv, true);
29305 }
29306
29307 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_ok(int64_t o) {
29308         LDKClaimedHTLC o_conv;
29309         o_conv.inner = untag_ptr(o);
29310         o_conv.is_owned = ptr_is_owned(o);
29311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29312         o_conv = ClaimedHTLC_clone(&o_conv);
29313         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29314         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
29315         return tag_ptr(ret_conv, true);
29316 }
29317
29318 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_err(int64_t e) {
29319         void* e_ptr = untag_ptr(e);
29320         CHECK_ACCESS(e_ptr);
29321         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29322         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29323         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29324         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
29325         return tag_ptr(ret_conv, true);
29326 }
29327
29328 jboolean  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_is_ok(int64_t o) {
29329         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
29330         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
29331         return ret_conv;
29332 }
29333
29334 void  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_free(int64_t _res) {
29335         if (!ptr_is_owned(_res)) return;
29336         void* _res_ptr = untag_ptr(_res);
29337         CHECK_ACCESS(_res_ptr);
29338         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
29339         FREE(untag_ptr(_res));
29340         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
29341 }
29342
29343 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29344         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29345         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
29346         return tag_ptr(ret_conv, true);
29347 }
29348 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29349         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
29350         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29351         return ret_conv;
29352 }
29353
29354 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone(int64_t orig) {
29355         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
29356         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29357         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
29358         return tag_ptr(ret_conv, true);
29359 }
29360
29361 int64_t  CS_LDK_COption_PathFailureZ_some(int64_t o) {
29362         void* o_ptr = untag_ptr(o);
29363         CHECK_ACCESS(o_ptr);
29364         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
29365         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
29366         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29367         *ret_copy = COption_PathFailureZ_some(o_conv);
29368         int64_t ret_ref = tag_ptr(ret_copy, true);
29369         return ret_ref;
29370 }
29371
29372 int64_t  CS_LDK_COption_PathFailureZ_none() {
29373         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29374         *ret_copy = COption_PathFailureZ_none();
29375         int64_t ret_ref = tag_ptr(ret_copy, true);
29376         return ret_ref;
29377 }
29378
29379 void  CS_LDK_COption_PathFailureZ_free(int64_t _res) {
29380         if (!ptr_is_owned(_res)) return;
29381         void* _res_ptr = untag_ptr(_res);
29382         CHECK_ACCESS(_res_ptr);
29383         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
29384         FREE(untag_ptr(_res));
29385         COption_PathFailureZ_free(_res_conv);
29386 }
29387
29388 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
29389         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29390         *ret_copy = COption_PathFailureZ_clone(arg);
29391         int64_t ret_ref = tag_ptr(ret_copy, true);
29392         return ret_ref;
29393 }
29394 int64_t  CS_LDK_COption_PathFailureZ_clone_ptr(int64_t arg) {
29395         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
29396         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
29397         return ret_conv;
29398 }
29399
29400 int64_t  CS_LDK_COption_PathFailureZ_clone(int64_t orig) {
29401         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
29402         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29403         *ret_copy = COption_PathFailureZ_clone(orig_conv);
29404         int64_t ret_ref = tag_ptr(ret_copy, true);
29405         return ret_ref;
29406 }
29407
29408 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_ok(int64_t o) {
29409         void* o_ptr = untag_ptr(o);
29410         CHECK_ACCESS(o_ptr);
29411         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
29412         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
29413         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29414         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
29415         return tag_ptr(ret_conv, true);
29416 }
29417
29418 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_err(int64_t e) {
29419         void* e_ptr = untag_ptr(e);
29420         CHECK_ACCESS(e_ptr);
29421         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29422         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29423         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29424         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
29425         return tag_ptr(ret_conv, true);
29426 }
29427
29428 jboolean  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_is_ok(int64_t o) {
29429         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
29430         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
29431         return ret_conv;
29432 }
29433
29434 void  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_free(int64_t _res) {
29435         if (!ptr_is_owned(_res)) return;
29436         void* _res_ptr = untag_ptr(_res);
29437         CHECK_ACCESS(_res_ptr);
29438         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
29439         FREE(untag_ptr(_res));
29440         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
29441 }
29442
29443 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
29444         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29445         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
29446         return tag_ptr(ret_conv, true);
29447 }
29448 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(int64_t arg) {
29449         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
29450         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
29451         return ret_conv;
29452 }
29453
29454 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone(int64_t orig) {
29455         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
29456         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29457         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
29458         return tag_ptr(ret_conv, true);
29459 }
29460
29461 int64_t  CS_LDK_COption_ClosureReasonZ_some(int64_t o) {
29462         void* o_ptr = untag_ptr(o);
29463         CHECK_ACCESS(o_ptr);
29464         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
29465         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
29466         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29467         *ret_copy = COption_ClosureReasonZ_some(o_conv);
29468         int64_t ret_ref = tag_ptr(ret_copy, true);
29469         return ret_ref;
29470 }
29471
29472 int64_t  CS_LDK_COption_ClosureReasonZ_none() {
29473         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29474         *ret_copy = COption_ClosureReasonZ_none();
29475         int64_t ret_ref = tag_ptr(ret_copy, true);
29476         return ret_ref;
29477 }
29478
29479 void  CS_LDK_COption_ClosureReasonZ_free(int64_t _res) {
29480         if (!ptr_is_owned(_res)) return;
29481         void* _res_ptr = untag_ptr(_res);
29482         CHECK_ACCESS(_res_ptr);
29483         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
29484         FREE(untag_ptr(_res));
29485         COption_ClosureReasonZ_free(_res_conv);
29486 }
29487
29488 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
29489         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29490         *ret_copy = COption_ClosureReasonZ_clone(arg);
29491         int64_t ret_ref = tag_ptr(ret_copy, true);
29492         return ret_ref;
29493 }
29494 int64_t  CS_LDK_COption_ClosureReasonZ_clone_ptr(int64_t arg) {
29495         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
29496         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
29497         return ret_conv;
29498 }
29499
29500 int64_t  CS_LDK_COption_ClosureReasonZ_clone(int64_t orig) {
29501         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
29502         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29503         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
29504         int64_t ret_ref = tag_ptr(ret_copy, true);
29505         return ret_ref;
29506 }
29507
29508 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_ok(int64_t o) {
29509         void* o_ptr = untag_ptr(o);
29510         CHECK_ACCESS(o_ptr);
29511         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
29512         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
29513         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29514         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
29515         return tag_ptr(ret_conv, true);
29516 }
29517
29518 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_err(int64_t e) {
29519         void* e_ptr = untag_ptr(e);
29520         CHECK_ACCESS(e_ptr);
29521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29523         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29524         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
29525         return tag_ptr(ret_conv, true);
29526 }
29527
29528 jboolean  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(int64_t o) {
29529         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
29530         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
29531         return ret_conv;
29532 }
29533
29534 void  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_free(int64_t _res) {
29535         if (!ptr_is_owned(_res)) return;
29536         void* _res_ptr = untag_ptr(_res);
29537         CHECK_ACCESS(_res_ptr);
29538         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
29539         FREE(untag_ptr(_res));
29540         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
29541 }
29542
29543 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
29544         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29545         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
29546         return tag_ptr(ret_conv, true);
29547 }
29548 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(int64_t arg) {
29549         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
29550         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
29551         return ret_conv;
29552 }
29553
29554 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone(int64_t orig) {
29555         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
29556         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29557         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
29558         return tag_ptr(ret_conv, true);
29559 }
29560
29561 int64_t  CS_LDK_COption_HTLCDestinationZ_some(int64_t o) {
29562         void* o_ptr = untag_ptr(o);
29563         CHECK_ACCESS(o_ptr);
29564         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
29565         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
29566         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29567         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
29568         int64_t ret_ref = tag_ptr(ret_copy, true);
29569         return ret_ref;
29570 }
29571
29572 int64_t  CS_LDK_COption_HTLCDestinationZ_none() {
29573         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29574         *ret_copy = COption_HTLCDestinationZ_none();
29575         int64_t ret_ref = tag_ptr(ret_copy, true);
29576         return ret_ref;
29577 }
29578
29579 void  CS_LDK_COption_HTLCDestinationZ_free(int64_t _res) {
29580         if (!ptr_is_owned(_res)) return;
29581         void* _res_ptr = untag_ptr(_res);
29582         CHECK_ACCESS(_res_ptr);
29583         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
29584         FREE(untag_ptr(_res));
29585         COption_HTLCDestinationZ_free(_res_conv);
29586 }
29587
29588 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
29589         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29590         *ret_copy = COption_HTLCDestinationZ_clone(arg);
29591         int64_t ret_ref = tag_ptr(ret_copy, true);
29592         return ret_ref;
29593 }
29594 int64_t  CS_LDK_COption_HTLCDestinationZ_clone_ptr(int64_t arg) {
29595         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
29596         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
29597         return ret_conv;
29598 }
29599
29600 int64_t  CS_LDK_COption_HTLCDestinationZ_clone(int64_t orig) {
29601         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
29602         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29603         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
29604         int64_t ret_ref = tag_ptr(ret_copy, true);
29605         return ret_ref;
29606 }
29607
29608 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(int64_t o) {
29609         void* o_ptr = untag_ptr(o);
29610         CHECK_ACCESS(o_ptr);
29611         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
29612         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
29613         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29614         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
29615         return tag_ptr(ret_conv, true);
29616 }
29617
29618 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_err(int64_t e) {
29619         void* e_ptr = untag_ptr(e);
29620         CHECK_ACCESS(e_ptr);
29621         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29622         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29623         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29624         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
29625         return tag_ptr(ret_conv, true);
29626 }
29627
29628 jboolean  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(int64_t o) {
29629         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
29630         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
29631         return ret_conv;
29632 }
29633
29634 void  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_free(int64_t _res) {
29635         if (!ptr_is_owned(_res)) return;
29636         void* _res_ptr = untag_ptr(_res);
29637         CHECK_ACCESS(_res_ptr);
29638         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
29639         FREE(untag_ptr(_res));
29640         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
29641 }
29642
29643 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
29644         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29645         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
29646         return tag_ptr(ret_conv, true);
29647 }
29648 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(int64_t arg) {
29649         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
29650         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
29651         return ret_conv;
29652 }
29653
29654 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(int64_t orig) {
29655         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
29656         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29657         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
29658         return tag_ptr(ret_conv, true);
29659 }
29660
29661 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_ok(int32_t o) {
29662         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
29663         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29664         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
29665         return tag_ptr(ret_conv, true);
29666 }
29667
29668 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_err(int64_t e) {
29669         void* e_ptr = untag_ptr(e);
29670         CHECK_ACCESS(e_ptr);
29671         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29672         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29673         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29674         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
29675         return tag_ptr(ret_conv, true);
29676 }
29677
29678 jboolean  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(int64_t o) {
29679         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
29680         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
29681         return ret_conv;
29682 }
29683
29684 void  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_free(int64_t _res) {
29685         if (!ptr_is_owned(_res)) return;
29686         void* _res_ptr = untag_ptr(_res);
29687         CHECK_ACCESS(_res_ptr);
29688         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
29689         FREE(untag_ptr(_res));
29690         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
29691 }
29692
29693 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
29694         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29695         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
29696         return tag_ptr(ret_conv, true);
29697 }
29698 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(int64_t arg) {
29699         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
29700         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
29701         return ret_conv;
29702 }
29703
29704 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone(int64_t orig) {
29705         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
29706         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29707         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
29708         return tag_ptr(ret_conv, true);
29709 }
29710
29711 int64_t  CS_LDK_COption_U128Z_some(int8_tArray o) {
29712         LDKU128 o_ref;
29713         CHECK(o->arr_len == 16);
29714         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
29715         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29716         *ret_copy = COption_U128Z_some(o_ref);
29717         int64_t ret_ref = tag_ptr(ret_copy, true);
29718         return ret_ref;
29719 }
29720
29721 int64_t  CS_LDK_COption_U128Z_none() {
29722         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29723         *ret_copy = COption_U128Z_none();
29724         int64_t ret_ref = tag_ptr(ret_copy, true);
29725         return ret_ref;
29726 }
29727
29728 void  CS_LDK_COption_U128Z_free(int64_t _res) {
29729         if (!ptr_is_owned(_res)) return;
29730         void* _res_ptr = untag_ptr(_res);
29731         CHECK_ACCESS(_res_ptr);
29732         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
29733         FREE(untag_ptr(_res));
29734         COption_U128Z_free(_res_conv);
29735 }
29736
29737 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
29738         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29739         *ret_copy = COption_U128Z_clone(arg);
29740         int64_t ret_ref = tag_ptr(ret_copy, true);
29741         return ret_ref;
29742 }
29743 int64_t  CS_LDK_COption_U128Z_clone_ptr(int64_t arg) {
29744         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
29745         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
29746         return ret_conv;
29747 }
29748
29749 int64_t  CS_LDK_COption_U128Z_clone(int64_t orig) {
29750         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
29751         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29752         *ret_copy = COption_U128Z_clone(orig_conv);
29753         int64_t ret_ref = tag_ptr(ret_copy, true);
29754         return ret_ref;
29755 }
29756
29757 void  CS_LDK_CVec_ClaimedHTLCZ_free(int64_tArray _res) {
29758         LDKCVec_ClaimedHTLCZ _res_constr;
29759         _res_constr.datalen = _res->arr_len;
29760         if (_res_constr.datalen > 0)
29761                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
29762         else
29763                 _res_constr.data = NULL;
29764         int64_t* _res_vals = _res->elems;
29765         for (size_t n = 0; n < _res_constr.datalen; n++) {
29766                 int64_t _res_conv_13 = _res_vals[n];
29767                 LDKClaimedHTLC _res_conv_13_conv;
29768                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
29769                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
29770                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
29771                 _res_constr.data[n] = _res_conv_13_conv;
29772         }
29773         FREE(_res);
29774         CVec_ClaimedHTLCZ_free(_res_constr);
29775 }
29776
29777 int64_t  CS_LDK_COption_PaymentFailureReasonZ_some(int32_t o) {
29778         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
29779         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29780         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
29781         int64_t ret_ref = tag_ptr(ret_copy, true);
29782         return ret_ref;
29783 }
29784
29785 int64_t  CS_LDK_COption_PaymentFailureReasonZ_none() {
29786         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29787         *ret_copy = COption_PaymentFailureReasonZ_none();
29788         int64_t ret_ref = tag_ptr(ret_copy, true);
29789         return ret_ref;
29790 }
29791
29792 void  CS_LDK_COption_PaymentFailureReasonZ_free(int64_t _res) {
29793         if (!ptr_is_owned(_res)) return;
29794         void* _res_ptr = untag_ptr(_res);
29795         CHECK_ACCESS(_res_ptr);
29796         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
29797         FREE(untag_ptr(_res));
29798         COption_PaymentFailureReasonZ_free(_res_conv);
29799 }
29800
29801 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
29802         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29803         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
29804         int64_t ret_ref = tag_ptr(ret_copy, true);
29805         return ret_ref;
29806 }
29807 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone_ptr(int64_t arg) {
29808         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
29809         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
29810         return ret_conv;
29811 }
29812
29813 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone(int64_t orig) {
29814         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
29815         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29816         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
29817         int64_t ret_ref = tag_ptr(ret_copy, true);
29818         return ret_ref;
29819 }
29820
29821 int64_t  CS_LDK_COption_EventZ_some(int64_t o) {
29822         void* o_ptr = untag_ptr(o);
29823         CHECK_ACCESS(o_ptr);
29824         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
29825         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
29826         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29827         *ret_copy = COption_EventZ_some(o_conv);
29828         int64_t ret_ref = tag_ptr(ret_copy, true);
29829         return ret_ref;
29830 }
29831
29832 int64_t  CS_LDK_COption_EventZ_none() {
29833         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29834         *ret_copy = COption_EventZ_none();
29835         int64_t ret_ref = tag_ptr(ret_copy, true);
29836         return ret_ref;
29837 }
29838
29839 void  CS_LDK_COption_EventZ_free(int64_t _res) {
29840         if (!ptr_is_owned(_res)) return;
29841         void* _res_ptr = untag_ptr(_res);
29842         CHECK_ACCESS(_res_ptr);
29843         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
29844         FREE(untag_ptr(_res));
29845         COption_EventZ_free(_res_conv);
29846 }
29847
29848 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
29849         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29850         *ret_copy = COption_EventZ_clone(arg);
29851         int64_t ret_ref = tag_ptr(ret_copy, true);
29852         return ret_ref;
29853 }
29854 int64_t  CS_LDK_COption_EventZ_clone_ptr(int64_t arg) {
29855         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
29856         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
29857         return ret_conv;
29858 }
29859
29860 int64_t  CS_LDK_COption_EventZ_clone(int64_t orig) {
29861         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
29862         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29863         *ret_copy = COption_EventZ_clone(orig_conv);
29864         int64_t ret_ref = tag_ptr(ret_copy, true);
29865         return ret_ref;
29866 }
29867
29868 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_ok(int64_t o) {
29869         void* o_ptr = untag_ptr(o);
29870         CHECK_ACCESS(o_ptr);
29871         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
29872         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
29873         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29874         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
29875         return tag_ptr(ret_conv, true);
29876 }
29877
29878 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_err(int64_t e) {
29879         void* e_ptr = untag_ptr(e);
29880         CHECK_ACCESS(e_ptr);
29881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29883         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29884         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
29885         return tag_ptr(ret_conv, true);
29886 }
29887
29888 jboolean  CS_LDK_CResult_COption_EventZDecodeErrorZ_is_ok(int64_t o) {
29889         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
29890         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
29891         return ret_conv;
29892 }
29893
29894 void  CS_LDK_CResult_COption_EventZDecodeErrorZ_free(int64_t _res) {
29895         if (!ptr_is_owned(_res)) return;
29896         void* _res_ptr = untag_ptr(_res);
29897         CHECK_ACCESS(_res_ptr);
29898         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
29899         FREE(untag_ptr(_res));
29900         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
29901 }
29902
29903 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
29904         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29905         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
29906         return tag_ptr(ret_conv, true);
29907 }
29908 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone_ptr(int64_t arg) {
29909         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
29910         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
29911         return ret_conv;
29912 }
29913
29914 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone(int64_t orig) {
29915         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
29916         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29917         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
29918         return tag_ptr(ret_conv, true);
29919 }
29920
29921 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_ok(int32_t o) {
29922         LDKSiPrefix o_conv = LDKSiPrefix_from_cs(o);
29923         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29924         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
29925         return tag_ptr(ret_conv, true);
29926 }
29927
29928 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_err(int64_t e) {
29929         void* e_ptr = untag_ptr(e);
29930         CHECK_ACCESS(e_ptr);
29931         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
29932         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
29933         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29934         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
29935         return tag_ptr(ret_conv, true);
29936 }
29937
29938 jboolean  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_is_ok(int64_t o) {
29939         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
29940         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
29941         return ret_conv;
29942 }
29943
29944 void  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_free(int64_t _res) {
29945         if (!ptr_is_owned(_res)) return;
29946         void* _res_ptr = untag_ptr(_res);
29947         CHECK_ACCESS(_res_ptr);
29948         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
29949         FREE(untag_ptr(_res));
29950         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
29951 }
29952
29953 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
29954         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29955         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
29956         return tag_ptr(ret_conv, true);
29957 }
29958 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(int64_t arg) {
29959         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
29960         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
29961         return ret_conv;
29962 }
29963
29964 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone(int64_t orig) {
29965         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
29966         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29967         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
29968         return tag_ptr(ret_conv, true);
29969 }
29970
29971 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(int64_t o) {
29972         LDKBolt11Invoice o_conv;
29973         o_conv.inner = untag_ptr(o);
29974         o_conv.is_owned = ptr_is_owned(o);
29975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29976         o_conv = Bolt11Invoice_clone(&o_conv);
29977         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29978         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
29979         return tag_ptr(ret_conv, true);
29980 }
29981
29982 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(int64_t e) {
29983         void* e_ptr = untag_ptr(e);
29984         CHECK_ACCESS(e_ptr);
29985         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
29986         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
29987         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29988         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
29989         return tag_ptr(ret_conv, true);
29990 }
29991
29992 jboolean  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(int64_t o) {
29993         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
29994         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
29995         return ret_conv;
29996 }
29997
29998 void  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(int64_t _res) {
29999         if (!ptr_is_owned(_res)) return;
30000         void* _res_ptr = untag_ptr(_res);
30001         CHECK_ACCESS(_res_ptr);
30002         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
30003         FREE(untag_ptr(_res));
30004         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
30005 }
30006
30007 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
30008         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
30009         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
30010         return tag_ptr(ret_conv, true);
30011 }
30012 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(int64_t arg) {
30013         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
30014         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
30015         return ret_conv;
30016 }
30017
30018 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(int64_t orig) {
30019         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
30020         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
30021         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
30022         return tag_ptr(ret_conv, true);
30023 }
30024
30025 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(int64_t o) {
30026         LDKSignedRawBolt11Invoice o_conv;
30027         o_conv.inner = untag_ptr(o);
30028         o_conv.is_owned = ptr_is_owned(o);
30029         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30030         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
30031         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30032         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
30033         return tag_ptr(ret_conv, true);
30034 }
30035
30036 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(int64_t e) {
30037         void* e_ptr = untag_ptr(e);
30038         CHECK_ACCESS(e_ptr);
30039         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
30040         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
30041         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30042         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
30043         return tag_ptr(ret_conv, true);
30044 }
30045
30046 jboolean  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(int64_t o) {
30047         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
30048         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
30049         return ret_conv;
30050 }
30051
30052 void  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(int64_t _res) {
30053         if (!ptr_is_owned(_res)) return;
30054         void* _res_ptr = untag_ptr(_res);
30055         CHECK_ACCESS(_res_ptr);
30056         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
30057         FREE(untag_ptr(_res));
30058         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
30059 }
30060
30061 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
30062         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30063         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
30064         return tag_ptr(ret_conv, true);
30065 }
30066 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(int64_t arg) {
30067         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
30068         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
30069         return ret_conv;
30070 }
30071
30072 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(int64_t orig) {
30073         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
30074         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30075         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
30076         return tag_ptr(ret_conv, true);
30077 }
30078
30079 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
30080         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
30081         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
30082         return tag_ptr(ret_conv, true);
30083 }
30084 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(int64_t arg) {
30085         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
30086         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
30087         return ret_conv;
30088 }
30089
30090 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(int64_t orig) {
30091         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
30092         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
30093         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
30094         return tag_ptr(ret_conv, true);
30095 }
30096
30097 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(int64_t a, int8_tArray b, int64_t c) {
30098         LDKRawBolt11Invoice a_conv;
30099         a_conv.inner = untag_ptr(a);
30100         a_conv.is_owned = ptr_is_owned(a);
30101         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30102         a_conv = RawBolt11Invoice_clone(&a_conv);
30103         LDKThirtyTwoBytes b_ref;
30104         CHECK(b->arr_len == 32);
30105         memcpy(b_ref.data, b->elems, 32); FREE(b);
30106         LDKBolt11InvoiceSignature c_conv;
30107         c_conv.inner = untag_ptr(c);
30108         c_conv.is_owned = ptr_is_owned(c);
30109         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30110         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
30111         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
30112         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
30113         return tag_ptr(ret_conv, true);
30114 }
30115
30116 void  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(int64_t _res) {
30117         if (!ptr_is_owned(_res)) return;
30118         void* _res_ptr = untag_ptr(_res);
30119         CHECK_ACCESS(_res_ptr);
30120         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
30121         FREE(untag_ptr(_res));
30122         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
30123 }
30124
30125 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_ok(int64_t o) {
30126         LDKPayeePubKey o_conv;
30127         o_conv.inner = untag_ptr(o);
30128         o_conv.is_owned = ptr_is_owned(o);
30129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30130         o_conv = PayeePubKey_clone(&o_conv);
30131         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30132         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
30133         return tag_ptr(ret_conv, true);
30134 }
30135
30136 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_err(int32_t e) {
30137         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
30138         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30139         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
30140         return tag_ptr(ret_conv, true);
30141 }
30142
30143 jboolean  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(int64_t o) {
30144         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
30145         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
30146         return ret_conv;
30147 }
30148
30149 void  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_free(int64_t _res) {
30150         if (!ptr_is_owned(_res)) return;
30151         void* _res_ptr = untag_ptr(_res);
30152         CHECK_ACCESS(_res_ptr);
30153         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
30154         FREE(untag_ptr(_res));
30155         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
30156 }
30157
30158 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
30159         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30160         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
30161         return tag_ptr(ret_conv, true);
30162 }
30163 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
30164         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
30165         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
30166         return ret_conv;
30167 }
30168
30169 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone(int64_t orig) {
30170         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
30171         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30172         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
30173         return tag_ptr(ret_conv, true);
30174 }
30175
30176 void  CS_LDK_CVec_PrivateRouteZ_free(int64_tArray _res) {
30177         LDKCVec_PrivateRouteZ _res_constr;
30178         _res_constr.datalen = _res->arr_len;
30179         if (_res_constr.datalen > 0)
30180                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
30181         else
30182                 _res_constr.data = NULL;
30183         int64_t* _res_vals = _res->elems;
30184         for (size_t o = 0; o < _res_constr.datalen; o++) {
30185                 int64_t _res_conv_14 = _res_vals[o];
30186                 LDKPrivateRoute _res_conv_14_conv;
30187                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
30188                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
30189                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
30190                 _res_constr.data[o] = _res_conv_14_conv;
30191         }
30192         FREE(_res);
30193         CVec_PrivateRouteZ_free(_res_constr);
30194 }
30195
30196 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_ok(int64_t o) {
30197         LDKPositiveTimestamp o_conv;
30198         o_conv.inner = untag_ptr(o);
30199         o_conv.is_owned = ptr_is_owned(o);
30200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30201         o_conv = PositiveTimestamp_clone(&o_conv);
30202         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30203         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
30204         return tag_ptr(ret_conv, true);
30205 }
30206
30207 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_err(int32_t e) {
30208         LDKCreationError e_conv = LDKCreationError_from_cs(e);
30209         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30210         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
30211         return tag_ptr(ret_conv, true);
30212 }
30213
30214 jboolean  CS_LDK_CResult_PositiveTimestampCreationErrorZ_is_ok(int64_t o) {
30215         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
30216         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
30217         return ret_conv;
30218 }
30219
30220 void  CS_LDK_CResult_PositiveTimestampCreationErrorZ_free(int64_t _res) {
30221         if (!ptr_is_owned(_res)) return;
30222         void* _res_ptr = untag_ptr(_res);
30223         CHECK_ACCESS(_res_ptr);
30224         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
30225         FREE(untag_ptr(_res));
30226         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
30227 }
30228
30229 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
30230         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30231         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
30232         return tag_ptr(ret_conv, true);
30233 }
30234 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone_ptr(int64_t arg) {
30235         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
30236         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
30237         return ret_conv;
30238 }
30239
30240 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone(int64_t orig) {
30241         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
30242         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30243         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
30244         return tag_ptr(ret_conv, true);
30245 }
30246
30247 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_ok() {
30248         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30249         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
30250         return tag_ptr(ret_conv, true);
30251 }
30252
30253 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_err(int32_t e) {
30254         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
30255         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30256         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
30257         return tag_ptr(ret_conv, true);
30258 }
30259
30260 jboolean  CS_LDK_CResult_NoneBolt11SemanticErrorZ_is_ok(int64_t o) {
30261         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
30262         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
30263         return ret_conv;
30264 }
30265
30266 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_free(int64_t _res) {
30267         if (!ptr_is_owned(_res)) return;
30268         void* _res_ptr = untag_ptr(_res);
30269         CHECK_ACCESS(_res_ptr);
30270         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
30271         FREE(untag_ptr(_res));
30272         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
30273 }
30274
30275 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
30276         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30277         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
30278         return tag_ptr(ret_conv, true);
30279 }
30280 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
30281         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
30282         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
30283         return ret_conv;
30284 }
30285
30286 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone(int64_t orig) {
30287         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
30288         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30289         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
30290         return tag_ptr(ret_conv, true);
30291 }
30292
30293 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(int64_t o) {
30294         LDKBolt11Invoice o_conv;
30295         o_conv.inner = untag_ptr(o);
30296         o_conv.is_owned = ptr_is_owned(o);
30297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30298         o_conv = Bolt11Invoice_clone(&o_conv);
30299         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30300         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
30301         return tag_ptr(ret_conv, true);
30302 }
30303
30304 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(int32_t e) {
30305         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
30306         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30307         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
30308         return tag_ptr(ret_conv, true);
30309 }
30310
30311 jboolean  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(int64_t o) {
30312         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
30313         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
30314         return ret_conv;
30315 }
30316
30317 void  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(int64_t _res) {
30318         if (!ptr_is_owned(_res)) return;
30319         void* _res_ptr = untag_ptr(_res);
30320         CHECK_ACCESS(_res_ptr);
30321         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
30322         FREE(untag_ptr(_res));
30323         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
30324 }
30325
30326 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
30327         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30328         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
30329         return tag_ptr(ret_conv, true);
30330 }
30331 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
30332         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
30333         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
30334         return ret_conv;
30335 }
30336
30337 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(int64_t orig) {
30338         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
30339         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30340         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
30341         return tag_ptr(ret_conv, true);
30342 }
30343
30344 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_ok(int64_t o) {
30345         LDKDescription o_conv;
30346         o_conv.inner = untag_ptr(o);
30347         o_conv.is_owned = ptr_is_owned(o);
30348         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30349         o_conv = Description_clone(&o_conv);
30350         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30351         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
30352         return tag_ptr(ret_conv, true);
30353 }
30354
30355 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_err(int32_t e) {
30356         LDKCreationError e_conv = LDKCreationError_from_cs(e);
30357         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30358         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
30359         return tag_ptr(ret_conv, true);
30360 }
30361
30362 jboolean  CS_LDK_CResult_DescriptionCreationErrorZ_is_ok(int64_t o) {
30363         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
30364         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
30365         return ret_conv;
30366 }
30367
30368 void  CS_LDK_CResult_DescriptionCreationErrorZ_free(int64_t _res) {
30369         if (!ptr_is_owned(_res)) return;
30370         void* _res_ptr = untag_ptr(_res);
30371         CHECK_ACCESS(_res_ptr);
30372         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
30373         FREE(untag_ptr(_res));
30374         CResult_DescriptionCreationErrorZ_free(_res_conv);
30375 }
30376
30377 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
30378         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30379         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
30380         return tag_ptr(ret_conv, true);
30381 }
30382 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone_ptr(int64_t arg) {
30383         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
30384         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
30385         return ret_conv;
30386 }
30387
30388 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone(int64_t orig) {
30389         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
30390         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30391         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
30392         return tag_ptr(ret_conv, true);
30393 }
30394
30395 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_ok(int64_t o) {
30396         LDKPrivateRoute o_conv;
30397         o_conv.inner = untag_ptr(o);
30398         o_conv.is_owned = ptr_is_owned(o);
30399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30400         o_conv = PrivateRoute_clone(&o_conv);
30401         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30402         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
30403         return tag_ptr(ret_conv, true);
30404 }
30405
30406 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_err(int32_t e) {
30407         LDKCreationError e_conv = LDKCreationError_from_cs(e);
30408         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30409         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
30410         return tag_ptr(ret_conv, true);
30411 }
30412
30413 jboolean  CS_LDK_CResult_PrivateRouteCreationErrorZ_is_ok(int64_t o) {
30414         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
30415         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
30416         return ret_conv;
30417 }
30418
30419 void  CS_LDK_CResult_PrivateRouteCreationErrorZ_free(int64_t _res) {
30420         if (!ptr_is_owned(_res)) return;
30421         void* _res_ptr = untag_ptr(_res);
30422         CHECK_ACCESS(_res_ptr);
30423         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
30424         FREE(untag_ptr(_res));
30425         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
30426 }
30427
30428 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
30429         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30430         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
30431         return tag_ptr(ret_conv, true);
30432 }
30433 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone_ptr(int64_t arg) {
30434         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
30435         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
30436         return ret_conv;
30437 }
30438
30439 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone(int64_t orig) {
30440         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
30441         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30442         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
30443         return tag_ptr(ret_conv, true);
30444 }
30445
30446 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_ok(int64_t o) {
30447         LDKOutPoint o_conv;
30448         o_conv.inner = untag_ptr(o);
30449         o_conv.is_owned = ptr_is_owned(o);
30450         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30451         o_conv = OutPoint_clone(&o_conv);
30452         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30453         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
30454         return tag_ptr(ret_conv, true);
30455 }
30456
30457 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_err(int64_t e) {
30458         void* e_ptr = untag_ptr(e);
30459         CHECK_ACCESS(e_ptr);
30460         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30461         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30462         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30463         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
30464         return tag_ptr(ret_conv, true);
30465 }
30466
30467 jboolean  CS_LDK_CResult_OutPointDecodeErrorZ_is_ok(int64_t o) {
30468         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
30469         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
30470         return ret_conv;
30471 }
30472
30473 void  CS_LDK_CResult_OutPointDecodeErrorZ_free(int64_t _res) {
30474         if (!ptr_is_owned(_res)) return;
30475         void* _res_ptr = untag_ptr(_res);
30476         CHECK_ACCESS(_res_ptr);
30477         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
30478         FREE(untag_ptr(_res));
30479         CResult_OutPointDecodeErrorZ_free(_res_conv);
30480 }
30481
30482 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
30483         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30484         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
30485         return tag_ptr(ret_conv, true);
30486 }
30487 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone_ptr(int64_t arg) {
30488         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
30489         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
30490         return ret_conv;
30491 }
30492
30493 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone(int64_t orig) {
30494         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
30495         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30496         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
30497         return tag_ptr(ret_conv, true);
30498 }
30499
30500 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_ok(int64_t o) {
30501         LDKBigSize o_conv;
30502         o_conv.inner = untag_ptr(o);
30503         o_conv.is_owned = ptr_is_owned(o);
30504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30505         o_conv = BigSize_clone(&o_conv);
30506         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30507         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
30508         return tag_ptr(ret_conv, true);
30509 }
30510
30511 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_err(int64_t e) {
30512         void* e_ptr = untag_ptr(e);
30513         CHECK_ACCESS(e_ptr);
30514         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30515         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30516         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30517         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
30518         return tag_ptr(ret_conv, true);
30519 }
30520
30521 jboolean  CS_LDK_CResult_BigSizeDecodeErrorZ_is_ok(int64_t o) {
30522         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
30523         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
30524         return ret_conv;
30525 }
30526
30527 void  CS_LDK_CResult_BigSizeDecodeErrorZ_free(int64_t _res) {
30528         if (!ptr_is_owned(_res)) return;
30529         void* _res_ptr = untag_ptr(_res);
30530         CHECK_ACCESS(_res_ptr);
30531         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
30532         FREE(untag_ptr(_res));
30533         CResult_BigSizeDecodeErrorZ_free(_res_conv);
30534 }
30535
30536 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
30537         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30538         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
30539         return tag_ptr(ret_conv, true);
30540 }
30541 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone_ptr(int64_t arg) {
30542         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
30543         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
30544         return ret_conv;
30545 }
30546
30547 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone(int64_t orig) {
30548         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
30549         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30550         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
30551         return tag_ptr(ret_conv, true);
30552 }
30553
30554 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_ok(int64_t o) {
30555         LDKHostname o_conv;
30556         o_conv.inner = untag_ptr(o);
30557         o_conv.is_owned = ptr_is_owned(o);
30558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30559         o_conv = Hostname_clone(&o_conv);
30560         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30561         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
30562         return tag_ptr(ret_conv, true);
30563 }
30564
30565 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_err(int64_t e) {
30566         void* e_ptr = untag_ptr(e);
30567         CHECK_ACCESS(e_ptr);
30568         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30569         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30570         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30571         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
30572         return tag_ptr(ret_conv, true);
30573 }
30574
30575 jboolean  CS_LDK_CResult_HostnameDecodeErrorZ_is_ok(int64_t o) {
30576         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
30577         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
30578         return ret_conv;
30579 }
30580
30581 void  CS_LDK_CResult_HostnameDecodeErrorZ_free(int64_t _res) {
30582         if (!ptr_is_owned(_res)) return;
30583         void* _res_ptr = untag_ptr(_res);
30584         CHECK_ACCESS(_res_ptr);
30585         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
30586         FREE(untag_ptr(_res));
30587         CResult_HostnameDecodeErrorZ_free(_res_conv);
30588 }
30589
30590 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
30591         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30592         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
30593         return tag_ptr(ret_conv, true);
30594 }
30595 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone_ptr(int64_t arg) {
30596         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
30597         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
30598         return ret_conv;
30599 }
30600
30601 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone(int64_t orig) {
30602         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
30603         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30604         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
30605         return tag_ptr(ret_conv, true);
30606 }
30607
30608 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_ok(int64_t o) {
30609         LDKTransactionU16LenLimited o_conv;
30610         o_conv.inner = untag_ptr(o);
30611         o_conv.is_owned = ptr_is_owned(o);
30612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30613         o_conv = TransactionU16LenLimited_clone(&o_conv);
30614         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30615         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
30616         return tag_ptr(ret_conv, true);
30617 }
30618
30619 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_err() {
30620         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30621         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
30622         return tag_ptr(ret_conv, true);
30623 }
30624
30625 jboolean  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_is_ok(int64_t o) {
30626         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
30627         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
30628         return ret_conv;
30629 }
30630
30631 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_free(int64_t _res) {
30632         if (!ptr_is_owned(_res)) return;
30633         void* _res_ptr = untag_ptr(_res);
30634         CHECK_ACCESS(_res_ptr);
30635         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
30636         FREE(untag_ptr(_res));
30637         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
30638 }
30639
30640 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
30641         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30642         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
30643         return tag_ptr(ret_conv, true);
30644 }
30645 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(int64_t arg) {
30646         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
30647         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
30648         return ret_conv;
30649 }
30650
30651 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone(int64_t orig) {
30652         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
30653         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30654         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
30655         return tag_ptr(ret_conv, true);
30656 }
30657
30658 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(int64_t o) {
30659         LDKTransactionU16LenLimited o_conv;
30660         o_conv.inner = untag_ptr(o);
30661         o_conv.is_owned = ptr_is_owned(o);
30662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30663         o_conv = TransactionU16LenLimited_clone(&o_conv);
30664         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30665         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
30666         return tag_ptr(ret_conv, true);
30667 }
30668
30669 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_err(int64_t e) {
30670         void* e_ptr = untag_ptr(e);
30671         CHECK_ACCESS(e_ptr);
30672         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30673         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30674         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30675         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
30676         return tag_ptr(ret_conv, true);
30677 }
30678
30679 jboolean  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(int64_t o) {
30680         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
30681         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
30682         return ret_conv;
30683 }
30684
30685 void  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_free(int64_t _res) {
30686         if (!ptr_is_owned(_res)) return;
30687         void* _res_ptr = untag_ptr(_res);
30688         CHECK_ACCESS(_res_ptr);
30689         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
30690         FREE(untag_ptr(_res));
30691         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
30692 }
30693
30694 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
30695         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30696         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
30697         return tag_ptr(ret_conv, true);
30698 }
30699 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(int64_t arg) {
30700         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
30701         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
30702         return ret_conv;
30703 }
30704
30705 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(int64_t orig) {
30706         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
30707         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30708         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
30709         return tag_ptr(ret_conv, true);
30710 }
30711
30712 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_ok(int64_t o) {
30713         LDKUntrustedString o_conv;
30714         o_conv.inner = untag_ptr(o);
30715         o_conv.is_owned = ptr_is_owned(o);
30716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30717         o_conv = UntrustedString_clone(&o_conv);
30718         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30719         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
30720         return tag_ptr(ret_conv, true);
30721 }
30722
30723 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_err(int64_t e) {
30724         void* e_ptr = untag_ptr(e);
30725         CHECK_ACCESS(e_ptr);
30726         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30727         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30728         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30729         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
30730         return tag_ptr(ret_conv, true);
30731 }
30732
30733 jboolean  CS_LDK_CResult_UntrustedStringDecodeErrorZ_is_ok(int64_t o) {
30734         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
30735         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
30736         return ret_conv;
30737 }
30738
30739 void  CS_LDK_CResult_UntrustedStringDecodeErrorZ_free(int64_t _res) {
30740         if (!ptr_is_owned(_res)) return;
30741         void* _res_ptr = untag_ptr(_res);
30742         CHECK_ACCESS(_res_ptr);
30743         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
30744         FREE(untag_ptr(_res));
30745         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
30746 }
30747
30748 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
30749         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30750         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
30751         return tag_ptr(ret_conv, true);
30752 }
30753 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone_ptr(int64_t arg) {
30754         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
30755         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
30756         return ret_conv;
30757 }
30758
30759 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone(int64_t orig) {
30760         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
30761         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30762         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
30763         return tag_ptr(ret_conv, true);
30764 }
30765
30766 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
30767         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30768         *ret_conv = C2Tuple__u832u16Z_clone(arg);
30769         return tag_ptr(ret_conv, true);
30770 }
30771 int64_t  CS_LDK_C2Tuple__u832u16Z_clone_ptr(int64_t arg) {
30772         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
30773         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
30774         return ret_conv;
30775 }
30776
30777 int64_t  CS_LDK_C2Tuple__u832u16Z_clone(int64_t orig) {
30778         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
30779         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30780         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
30781         return tag_ptr(ret_conv, true);
30782 }
30783
30784 int64_t  CS_LDK_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
30785         LDKThirtyTwoBytes a_ref;
30786         CHECK(a->arr_len == 32);
30787         memcpy(a_ref.data, a->elems, 32); FREE(a);
30788         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30789         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
30790         return tag_ptr(ret_conv, true);
30791 }
30792
30793 void  CS_LDK_C2Tuple__u832u16Z_free(int64_t _res) {
30794         if (!ptr_is_owned(_res)) return;
30795         void* _res_ptr = untag_ptr(_res);
30796         CHECK_ACCESS(_res_ptr);
30797         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
30798         FREE(untag_ptr(_res));
30799         C2Tuple__u832u16Z_free(_res_conv);
30800 }
30801
30802 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_ok(int64_t o) {
30803         LDKPaymentRelay o_conv;
30804         o_conv.inner = untag_ptr(o);
30805         o_conv.is_owned = ptr_is_owned(o);
30806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30807         o_conv = PaymentRelay_clone(&o_conv);
30808         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30809         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
30810         return tag_ptr(ret_conv, true);
30811 }
30812
30813 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_err(int64_t e) {
30814         void* e_ptr = untag_ptr(e);
30815         CHECK_ACCESS(e_ptr);
30816         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30817         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30818         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30819         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
30820         return tag_ptr(ret_conv, true);
30821 }
30822
30823 jboolean  CS_LDK_CResult_PaymentRelayDecodeErrorZ_is_ok(int64_t o) {
30824         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
30825         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
30826         return ret_conv;
30827 }
30828
30829 void  CS_LDK_CResult_PaymentRelayDecodeErrorZ_free(int64_t _res) {
30830         if (!ptr_is_owned(_res)) return;
30831         void* _res_ptr = untag_ptr(_res);
30832         CHECK_ACCESS(_res_ptr);
30833         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
30834         FREE(untag_ptr(_res));
30835         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
30836 }
30837
30838 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
30839         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30840         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
30841         return tag_ptr(ret_conv, true);
30842 }
30843 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone_ptr(int64_t arg) {
30844         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
30845         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
30846         return ret_conv;
30847 }
30848
30849 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone(int64_t orig) {
30850         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
30851         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30852         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
30853         return tag_ptr(ret_conv, true);
30854 }
30855
30856 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_ok(int64_t o) {
30857         LDKPaymentConstraints o_conv;
30858         o_conv.inner = untag_ptr(o);
30859         o_conv.is_owned = ptr_is_owned(o);
30860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30861         o_conv = PaymentConstraints_clone(&o_conv);
30862         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30863         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
30864         return tag_ptr(ret_conv, true);
30865 }
30866
30867 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_err(int64_t e) {
30868         void* e_ptr = untag_ptr(e);
30869         CHECK_ACCESS(e_ptr);
30870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30872         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30873         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
30874         return tag_ptr(ret_conv, true);
30875 }
30876
30877 jboolean  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_is_ok(int64_t o) {
30878         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
30879         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
30880         return ret_conv;
30881 }
30882
30883 void  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_free(int64_t _res) {
30884         if (!ptr_is_owned(_res)) return;
30885         void* _res_ptr = untag_ptr(_res);
30886         CHECK_ACCESS(_res_ptr);
30887         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
30888         FREE(untag_ptr(_res));
30889         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
30890 }
30891
30892 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
30893         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30894         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
30895         return tag_ptr(ret_conv, true);
30896 }
30897 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(int64_t arg) {
30898         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
30899         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
30900         return ret_conv;
30901 }
30902
30903 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone(int64_t orig) {
30904         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
30905         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30906         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
30907         return tag_ptr(ret_conv, true);
30908 }
30909
30910 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
30911         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30912         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
30913         return tag_ptr(ret_conv, true);
30914 }
30915 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(int64_t arg) {
30916         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
30917         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
30918         return ret_conv;
30919 }
30920
30921 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(int64_t orig) {
30922         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
30923         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30924         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
30925         return tag_ptr(ret_conv, true);
30926 }
30927
30928 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, int64_t b, int64_t c) {
30929         LDKThirtyTwoBytes a_ref;
30930         CHECK(a->arr_len == 32);
30931         memcpy(a_ref.data, a->elems, 32); FREE(a);
30932         LDKRecipientOnionFields b_conv;
30933         b_conv.inner = untag_ptr(b);
30934         b_conv.is_owned = ptr_is_owned(b);
30935         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30936         b_conv = RecipientOnionFields_clone(&b_conv);
30937         LDKRouteParameters c_conv;
30938         c_conv.inner = untag_ptr(c);
30939         c_conv.is_owned = ptr_is_owned(c);
30940         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30941         c_conv = RouteParameters_clone(&c_conv);
30942         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30943         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
30944         return tag_ptr(ret_conv, true);
30945 }
30946
30947 void  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(int64_t _res) {
30948         if (!ptr_is_owned(_res)) return;
30949         void* _res_ptr = untag_ptr(_res);
30950         CHECK_ACCESS(_res_ptr);
30951         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
30952         FREE(untag_ptr(_res));
30953         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
30954 }
30955
30956 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(int64_t o) {
30957         void* o_ptr = untag_ptr(o);
30958         CHECK_ACCESS(o_ptr);
30959         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
30960         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
30961         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30962         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
30963         return tag_ptr(ret_conv, true);
30964 }
30965
30966 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
30967         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30968         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
30969         return tag_ptr(ret_conv, true);
30970 }
30971
30972 jboolean  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(int64_t o) {
30973         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
30974         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
30975         return ret_conv;
30976 }
30977
30978 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(int64_t _res) {
30979         if (!ptr_is_owned(_res)) return;
30980         void* _res_ptr = untag_ptr(_res);
30981         CHECK_ACCESS(_res_ptr);
30982         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
30983         FREE(untag_ptr(_res));
30984         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
30985 }
30986
30987 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
30988         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30989         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
30990         return tag_ptr(ret_conv, true);
30991 }
30992 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(int64_t arg) {
30993         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
30994         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
30995         return ret_conv;
30996 }
30997
30998 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(int64_t orig) {
30999         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
31000         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
31001         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
31002         return tag_ptr(ret_conv, true);
31003 }
31004
31005 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
31006         LDKStr o_conv = str_ref_to_owned_c(o);
31007         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31008         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
31009         return tag_ptr(ret_conv, true);
31010 }
31011
31012 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_err(int32_t e) {
31013         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
31014         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31015         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
31016         return tag_ptr(ret_conv, true);
31017 }
31018
31019 jboolean  CS_LDK_CResult_StrSecp256k1ErrorZ_is_ok(int64_t o) {
31020         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
31021         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
31022         return ret_conv;
31023 }
31024
31025 void  CS_LDK_CResult_StrSecp256k1ErrorZ_free(int64_t _res) {
31026         if (!ptr_is_owned(_res)) return;
31027         void* _res_ptr = untag_ptr(_res);
31028         CHECK_ACCESS(_res_ptr);
31029         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
31030         FREE(untag_ptr(_res));
31031         CResult_StrSecp256k1ErrorZ_free(_res_conv);
31032 }
31033
31034 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
31035         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31036         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
31037         return tag_ptr(ret_conv, true);
31038 }
31039 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone_ptr(int64_t arg) {
31040         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
31041         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
31042         return ret_conv;
31043 }
31044
31045 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone(int64_t orig) {
31046         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
31047         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31048         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
31049         return tag_ptr(ret_conv, true);
31050 }
31051
31052 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_ok(int64_t o) {
31053         void* o_ptr = untag_ptr(o);
31054         CHECK_ACCESS(o_ptr);
31055         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
31056         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
31057         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31058         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
31059         return tag_ptr(ret_conv, true);
31060 }
31061
31062 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_err(int32_t e) {
31063         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_cs(e);
31064         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31065         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
31066         return tag_ptr(ret_conv, true);
31067 }
31068
31069 jboolean  CS_LDK_CResult_TxOutUtxoLookupErrorZ_is_ok(int64_t o) {
31070         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
31071         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
31072         return ret_conv;
31073 }
31074
31075 void  CS_LDK_CResult_TxOutUtxoLookupErrorZ_free(int64_t _res) {
31076         if (!ptr_is_owned(_res)) return;
31077         void* _res_ptr = untag_ptr(_res);
31078         CHECK_ACCESS(_res_ptr);
31079         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
31080         FREE(untag_ptr(_res));
31081         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
31082 }
31083
31084 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
31085         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31086         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
31087         return tag_ptr(ret_conv, true);
31088 }
31089 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone_ptr(int64_t arg) {
31090         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
31091         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
31092         return ret_conv;
31093 }
31094
31095 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone(int64_t orig) {
31096         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
31097         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31098         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
31099         return tag_ptr(ret_conv, true);
31100 }
31101
31102 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
31103         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
31104         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
31105         return tag_ptr(ret_conv, true);
31106 }
31107 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(int64_t arg) {
31108         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
31109         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
31110         return ret_conv;
31111 }
31112
31113 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(int64_t orig) {
31114         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
31115         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
31116         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
31117         return tag_ptr(ret_conv, true);
31118 }
31119
31120 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(int8_tArray a, int64_t b, int64_t c) {
31121         LDKPublicKey a_ref;
31122         CHECK(a->arr_len == 33);
31123         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
31124         LDKOnionMessage b_conv;
31125         b_conv.inner = untag_ptr(b);
31126         b_conv.is_owned = ptr_is_owned(b);
31127         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31128         b_conv = OnionMessage_clone(&b_conv);
31129         void* c_ptr = untag_ptr(c);
31130         CHECK_ACCESS(c_ptr);
31131         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
31132         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
31133         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
31134         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
31135         return tag_ptr(ret_conv, true);
31136 }
31137
31138 void  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(int64_t _res) {
31139         if (!ptr_is_owned(_res)) return;
31140         void* _res_ptr = untag_ptr(_res);
31141         CHECK_ACCESS(_res_ptr);
31142         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
31143         FREE(untag_ptr(_res));
31144         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
31145 }
31146
31147 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(int64_t o) {
31148         void* o_ptr = untag_ptr(o);
31149         CHECK_ACCESS(o_ptr);
31150         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
31151         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
31152         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
31153         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
31154         return tag_ptr(ret_conv, true);
31155 }
31156
31157 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(int64_t e) {
31158         void* e_ptr = untag_ptr(e);
31159         CHECK_ACCESS(e_ptr);
31160         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
31161         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
31162         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
31163         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
31164         return tag_ptr(ret_conv, true);
31165 }
31166
31167 jboolean  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(int64_t o) {
31168         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
31169         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
31170         return ret_conv;
31171 }
31172
31173 void  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(int64_t _res) {
31174         if (!ptr_is_owned(_res)) return;
31175         void* _res_ptr = untag_ptr(_res);
31176         CHECK_ACCESS(_res_ptr);
31177         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
31178         FREE(untag_ptr(_res));
31179         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
31180 }
31181
31182 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_ok(int64_t o) {
31183         void* o_ptr = untag_ptr(o);
31184         CHECK_ACCESS(o_ptr);
31185         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
31186         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
31187         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
31188         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
31189         return tag_ptr(ret_conv, true);
31190 }
31191
31192 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_err() {
31193         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
31194         *ret_conv = CResult_PeeledOnionNoneZ_err();
31195         return tag_ptr(ret_conv, true);
31196 }
31197
31198 jboolean  CS_LDK_CResult_PeeledOnionNoneZ_is_ok(int64_t o) {
31199         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
31200         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
31201         return ret_conv;
31202 }
31203
31204 void  CS_LDK_CResult_PeeledOnionNoneZ_free(int64_t _res) {
31205         if (!ptr_is_owned(_res)) return;
31206         void* _res_ptr = untag_ptr(_res);
31207         CHECK_ACCESS(_res_ptr);
31208         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
31209         FREE(untag_ptr(_res));
31210         CResult_PeeledOnionNoneZ_free(_res_conv);
31211 }
31212
31213 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_ok(int64_t o) {
31214         void* o_ptr = untag_ptr(o);
31215         CHECK_ACCESS(o_ptr);
31216         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
31217         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
31218         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
31219         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
31220         return tag_ptr(ret_conv, true);
31221 }
31222
31223 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_err(int64_t e) {
31224         void* e_ptr = untag_ptr(e);
31225         CHECK_ACCESS(e_ptr);
31226         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
31227         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
31228         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
31229         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
31230         return tag_ptr(ret_conv, true);
31231 }
31232
31233 jboolean  CS_LDK_CResult_SendSuccessSendErrorZ_is_ok(int64_t o) {
31234         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
31235         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
31236         return ret_conv;
31237 }
31238
31239 void  CS_LDK_CResult_SendSuccessSendErrorZ_free(int64_t _res) {
31240         if (!ptr_is_owned(_res)) return;
31241         void* _res_ptr = untag_ptr(_res);
31242         CHECK_ACCESS(_res_ptr);
31243         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
31244         FREE(untag_ptr(_res));
31245         CResult_SendSuccessSendErrorZ_free(_res_conv);
31246 }
31247
31248 int64_t  CS_LDK_CResult_BlindedPathNoneZ_ok(int64_t o) {
31249         LDKBlindedPath o_conv;
31250         o_conv.inner = untag_ptr(o);
31251         o_conv.is_owned = ptr_is_owned(o);
31252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31253         o_conv = BlindedPath_clone(&o_conv);
31254         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31255         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
31256         return tag_ptr(ret_conv, true);
31257 }
31258
31259 int64_t  CS_LDK_CResult_BlindedPathNoneZ_err() {
31260         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31261         *ret_conv = CResult_BlindedPathNoneZ_err();
31262         return tag_ptr(ret_conv, true);
31263 }
31264
31265 jboolean  CS_LDK_CResult_BlindedPathNoneZ_is_ok(int64_t o) {
31266         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
31267         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
31268         return ret_conv;
31269 }
31270
31271 void  CS_LDK_CResult_BlindedPathNoneZ_free(int64_t _res) {
31272         if (!ptr_is_owned(_res)) return;
31273         void* _res_ptr = untag_ptr(_res);
31274         CHECK_ACCESS(_res_ptr);
31275         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
31276         FREE(untag_ptr(_res));
31277         CResult_BlindedPathNoneZ_free(_res_conv);
31278 }
31279
31280 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
31281         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31282         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
31283         return tag_ptr(ret_conv, true);
31284 }
31285 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone_ptr(int64_t arg) {
31286         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
31287         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
31288         return ret_conv;
31289 }
31290
31291 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone(int64_t orig) {
31292         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
31293         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31294         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
31295         return tag_ptr(ret_conv, true);
31296 }
31297
31298 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(int64_t o) {
31299         void* o_ptr = untag_ptr(o);
31300         CHECK_ACCESS(o_ptr);
31301         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
31302         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
31303         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31304         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
31305         return tag_ptr(ret_conv, true);
31306 }
31307
31308 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
31309         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31310         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
31311         return tag_ptr(ret_conv, true);
31312 }
31313
31314 jboolean  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(int64_t o) {
31315         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
31316         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
31317         return ret_conv;
31318 }
31319
31320 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(int64_t _res) {
31321         if (!ptr_is_owned(_res)) return;
31322         void* _res_ptr = untag_ptr(_res);
31323         CHECK_ACCESS(_res_ptr);
31324         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
31325         FREE(untag_ptr(_res));
31326         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
31327 }
31328
31329 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
31330         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31331         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
31332         return tag_ptr(ret_conv, true);
31333 }
31334 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(int64_t arg) {
31335         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
31336         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
31337         return ret_conv;
31338 }
31339
31340 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(int64_t orig) {
31341         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
31342         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31343         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
31344         return tag_ptr(ret_conv, true);
31345 }
31346
31347 void  CS_LDK_CVec_ForwardNodeZ_free(int64_tArray _res) {
31348         LDKCVec_ForwardNodeZ _res_constr;
31349         _res_constr.datalen = _res->arr_len;
31350         if (_res_constr.datalen > 0)
31351                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
31352         else
31353                 _res_constr.data = NULL;
31354         int64_t* _res_vals = _res->elems;
31355         for (size_t n = 0; n < _res_constr.datalen; n++) {
31356                 int64_t _res_conv_13 = _res_vals[n];
31357                 LDKForwardNode _res_conv_13_conv;
31358                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
31359                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
31360                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
31361                 _res_constr.data[n] = _res_conv_13_conv;
31362         }
31363         FREE(_res);
31364         CVec_ForwardNodeZ_free(_res_constr);
31365 }
31366
31367 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_ok(int64_t o) {
31368         LDKBlindedPath o_conv;
31369         o_conv.inner = untag_ptr(o);
31370         o_conv.is_owned = ptr_is_owned(o);
31371         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31372         o_conv = BlindedPath_clone(&o_conv);
31373         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31374         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
31375         return tag_ptr(ret_conv, true);
31376 }
31377
31378 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_err(int64_t e) {
31379         void* e_ptr = untag_ptr(e);
31380         CHECK_ACCESS(e_ptr);
31381         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31382         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31383         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31384         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
31385         return tag_ptr(ret_conv, true);
31386 }
31387
31388 jboolean  CS_LDK_CResult_BlindedPathDecodeErrorZ_is_ok(int64_t o) {
31389         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
31390         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
31391         return ret_conv;
31392 }
31393
31394 void  CS_LDK_CResult_BlindedPathDecodeErrorZ_free(int64_t _res) {
31395         if (!ptr_is_owned(_res)) return;
31396         void* _res_ptr = untag_ptr(_res);
31397         CHECK_ACCESS(_res_ptr);
31398         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
31399         FREE(untag_ptr(_res));
31400         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
31401 }
31402
31403 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
31404         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31405         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
31406         return tag_ptr(ret_conv, true);
31407 }
31408 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone_ptr(int64_t arg) {
31409         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
31410         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
31411         return ret_conv;
31412 }
31413
31414 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone(int64_t orig) {
31415         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
31416         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31417         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
31418         return tag_ptr(ret_conv, true);
31419 }
31420
31421 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_ok(int64_t o) {
31422         LDKBlindedHop o_conv;
31423         o_conv.inner = untag_ptr(o);
31424         o_conv.is_owned = ptr_is_owned(o);
31425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31426         o_conv = BlindedHop_clone(&o_conv);
31427         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31428         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
31429         return tag_ptr(ret_conv, true);
31430 }
31431
31432 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_err(int64_t e) {
31433         void* e_ptr = untag_ptr(e);
31434         CHECK_ACCESS(e_ptr);
31435         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31436         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31437         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31438         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
31439         return tag_ptr(ret_conv, true);
31440 }
31441
31442 jboolean  CS_LDK_CResult_BlindedHopDecodeErrorZ_is_ok(int64_t o) {
31443         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
31444         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
31445         return ret_conv;
31446 }
31447
31448 void  CS_LDK_CResult_BlindedHopDecodeErrorZ_free(int64_t _res) {
31449         if (!ptr_is_owned(_res)) return;
31450         void* _res_ptr = untag_ptr(_res);
31451         CHECK_ACCESS(_res_ptr);
31452         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
31453         FREE(untag_ptr(_res));
31454         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
31455 }
31456
31457 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
31458         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31459         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
31460         return tag_ptr(ret_conv, true);
31461 }
31462 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone_ptr(int64_t arg) {
31463         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
31464         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
31465         return ret_conv;
31466 }
31467
31468 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone(int64_t orig) {
31469         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
31470         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31471         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
31472         return tag_ptr(ret_conv, true);
31473 }
31474
31475 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_ok(int64_t o) {
31476         LDKInvoiceError o_conv;
31477         o_conv.inner = untag_ptr(o);
31478         o_conv.is_owned = ptr_is_owned(o);
31479         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31480         o_conv = InvoiceError_clone(&o_conv);
31481         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31482         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
31483         return tag_ptr(ret_conv, true);
31484 }
31485
31486 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_err(int64_t e) {
31487         void* e_ptr = untag_ptr(e);
31488         CHECK_ACCESS(e_ptr);
31489         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31490         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31491         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31492         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
31493         return tag_ptr(ret_conv, true);
31494 }
31495
31496 jboolean  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_is_ok(int64_t o) {
31497         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
31498         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
31499         return ret_conv;
31500 }
31501
31502 void  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_free(int64_t _res) {
31503         if (!ptr_is_owned(_res)) return;
31504         void* _res_ptr = untag_ptr(_res);
31505         CHECK_ACCESS(_res_ptr);
31506         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
31507         FREE(untag_ptr(_res));
31508         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
31509 }
31510
31511 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
31512         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31513         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
31514         return tag_ptr(ret_conv, true);
31515 }
31516 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(int64_t arg) {
31517         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
31518         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
31519         return ret_conv;
31520 }
31521
31522 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone(int64_t orig) {
31523         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
31524         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31525         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
31526         return tag_ptr(ret_conv, true);
31527 }
31528
31529 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(int64_t o) {
31530         LDKDelayedPaymentBasepoint o_conv;
31531         o_conv.inner = untag_ptr(o);
31532         o_conv.is_owned = ptr_is_owned(o);
31533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31534         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
31535         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31536         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
31537         return tag_ptr(ret_conv, true);
31538 }
31539
31540 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_err(int64_t e) {
31541         void* e_ptr = untag_ptr(e);
31542         CHECK_ACCESS(e_ptr);
31543         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31544         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31545         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31546         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
31547         return tag_ptr(ret_conv, true);
31548 }
31549
31550 jboolean  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(int64_t o) {
31551         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
31552         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
31553         return ret_conv;
31554 }
31555
31556 void  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_free(int64_t _res) {
31557         if (!ptr_is_owned(_res)) return;
31558         void* _res_ptr = untag_ptr(_res);
31559         CHECK_ACCESS(_res_ptr);
31560         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
31561         FREE(untag_ptr(_res));
31562         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
31563 }
31564
31565 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
31566         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31567         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
31568         return tag_ptr(ret_conv, true);
31569 }
31570 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
31571         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
31572         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
31573         return ret_conv;
31574 }
31575
31576 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(int64_t orig) {
31577         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
31578         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31579         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
31580         return tag_ptr(ret_conv, true);
31581 }
31582
31583 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_ok(int64_t o) {
31584         LDKDelayedPaymentKey o_conv;
31585         o_conv.inner = untag_ptr(o);
31586         o_conv.is_owned = ptr_is_owned(o);
31587         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31588         o_conv = DelayedPaymentKey_clone(&o_conv);
31589         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31590         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
31591         return tag_ptr(ret_conv, true);
31592 }
31593
31594 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_err(int64_t e) {
31595         void* e_ptr = untag_ptr(e);
31596         CHECK_ACCESS(e_ptr);
31597         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31598         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31599         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31600         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
31601         return tag_ptr(ret_conv, true);
31602 }
31603
31604 jboolean  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(int64_t o) {
31605         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
31606         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
31607         return ret_conv;
31608 }
31609
31610 void  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_free(int64_t _res) {
31611         if (!ptr_is_owned(_res)) return;
31612         void* _res_ptr = untag_ptr(_res);
31613         CHECK_ACCESS(_res_ptr);
31614         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
31615         FREE(untag_ptr(_res));
31616         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
31617 }
31618
31619 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
31620         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31621         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
31622         return tag_ptr(ret_conv, true);
31623 }
31624 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(int64_t arg) {
31625         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
31626         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
31627         return ret_conv;
31628 }
31629
31630 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone(int64_t orig) {
31631         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
31632         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31633         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
31634         return tag_ptr(ret_conv, true);
31635 }
31636
31637 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_ok(int64_t o) {
31638         LDKHtlcBasepoint o_conv;
31639         o_conv.inner = untag_ptr(o);
31640         o_conv.is_owned = ptr_is_owned(o);
31641         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31642         o_conv = HtlcBasepoint_clone(&o_conv);
31643         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31644         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
31645         return tag_ptr(ret_conv, true);
31646 }
31647
31648 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_err(int64_t e) {
31649         void* e_ptr = untag_ptr(e);
31650         CHECK_ACCESS(e_ptr);
31651         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31652         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31653         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31654         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
31655         return tag_ptr(ret_conv, true);
31656 }
31657
31658 jboolean  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_is_ok(int64_t o) {
31659         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
31660         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
31661         return ret_conv;
31662 }
31663
31664 void  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_free(int64_t _res) {
31665         if (!ptr_is_owned(_res)) return;
31666         void* _res_ptr = untag_ptr(_res);
31667         CHECK_ACCESS(_res_ptr);
31668         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
31669         FREE(untag_ptr(_res));
31670         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
31671 }
31672
31673 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
31674         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31675         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
31676         return tag_ptr(ret_conv, true);
31677 }
31678 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
31679         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
31680         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
31681         return ret_conv;
31682 }
31683
31684 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone(int64_t orig) {
31685         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
31686         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31687         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
31688         return tag_ptr(ret_conv, true);
31689 }
31690
31691 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_ok(int64_t o) {
31692         LDKHtlcKey o_conv;
31693         o_conv.inner = untag_ptr(o);
31694         o_conv.is_owned = ptr_is_owned(o);
31695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31696         o_conv = HtlcKey_clone(&o_conv);
31697         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31698         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
31699         return tag_ptr(ret_conv, true);
31700 }
31701
31702 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_err(int64_t e) {
31703         void* e_ptr = untag_ptr(e);
31704         CHECK_ACCESS(e_ptr);
31705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31707         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31708         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
31709         return tag_ptr(ret_conv, true);
31710 }
31711
31712 jboolean  CS_LDK_CResult_HtlcKeyDecodeErrorZ_is_ok(int64_t o) {
31713         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
31714         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
31715         return ret_conv;
31716 }
31717
31718 void  CS_LDK_CResult_HtlcKeyDecodeErrorZ_free(int64_t _res) {
31719         if (!ptr_is_owned(_res)) return;
31720         void* _res_ptr = untag_ptr(_res);
31721         CHECK_ACCESS(_res_ptr);
31722         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
31723         FREE(untag_ptr(_res));
31724         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
31725 }
31726
31727 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
31728         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31729         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
31730         return tag_ptr(ret_conv, true);
31731 }
31732 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone_ptr(int64_t arg) {
31733         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
31734         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
31735         return ret_conv;
31736 }
31737
31738 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone(int64_t orig) {
31739         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
31740         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31741         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
31742         return tag_ptr(ret_conv, true);
31743 }
31744
31745 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_ok(int64_t o) {
31746         LDKRevocationBasepoint o_conv;
31747         o_conv.inner = untag_ptr(o);
31748         o_conv.is_owned = ptr_is_owned(o);
31749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31750         o_conv = RevocationBasepoint_clone(&o_conv);
31751         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31752         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
31753         return tag_ptr(ret_conv, true);
31754 }
31755
31756 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_err(int64_t e) {
31757         void* e_ptr = untag_ptr(e);
31758         CHECK_ACCESS(e_ptr);
31759         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31760         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31761         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31762         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
31763         return tag_ptr(ret_conv, true);
31764 }
31765
31766 jboolean  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_is_ok(int64_t o) {
31767         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
31768         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
31769         return ret_conv;
31770 }
31771
31772 void  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_free(int64_t _res) {
31773         if (!ptr_is_owned(_res)) return;
31774         void* _res_ptr = untag_ptr(_res);
31775         CHECK_ACCESS(_res_ptr);
31776         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
31777         FREE(untag_ptr(_res));
31778         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
31779 }
31780
31781 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
31782         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31783         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
31784         return tag_ptr(ret_conv, true);
31785 }
31786 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
31787         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
31788         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
31789         return ret_conv;
31790 }
31791
31792 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone(int64_t orig) {
31793         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
31794         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31795         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
31796         return tag_ptr(ret_conv, true);
31797 }
31798
31799 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_ok(int64_t o) {
31800         LDKRevocationKey o_conv;
31801         o_conv.inner = untag_ptr(o);
31802         o_conv.is_owned = ptr_is_owned(o);
31803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31804         o_conv = RevocationKey_clone(&o_conv);
31805         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31806         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
31807         return tag_ptr(ret_conv, true);
31808 }
31809
31810 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_err(int64_t e) {
31811         void* e_ptr = untag_ptr(e);
31812         CHECK_ACCESS(e_ptr);
31813         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31814         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31815         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31816         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
31817         return tag_ptr(ret_conv, true);
31818 }
31819
31820 jboolean  CS_LDK_CResult_RevocationKeyDecodeErrorZ_is_ok(int64_t o) {
31821         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
31822         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
31823         return ret_conv;
31824 }
31825
31826 void  CS_LDK_CResult_RevocationKeyDecodeErrorZ_free(int64_t _res) {
31827         if (!ptr_is_owned(_res)) return;
31828         void* _res_ptr = untag_ptr(_res);
31829         CHECK_ACCESS(_res_ptr);
31830         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
31831         FREE(untag_ptr(_res));
31832         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
31833 }
31834
31835 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
31836         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31837         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
31838         return tag_ptr(ret_conv, true);
31839 }
31840 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone_ptr(int64_t arg) {
31841         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
31842         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
31843         return ret_conv;
31844 }
31845
31846 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone(int64_t orig) {
31847         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
31848         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31849         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
31850         return tag_ptr(ret_conv, true);
31851 }
31852
31853 int64_t  CS_LDK_COption_FilterZ_some(int64_t o) {
31854         void* o_ptr = untag_ptr(o);
31855         CHECK_ACCESS(o_ptr);
31856         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
31857         if (o_conv.free == LDKFilter_JCalls_free) {
31858                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31859                 LDKFilter_JCalls_cloned(&o_conv);
31860         }
31861         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31862         *ret_copy = COption_FilterZ_some(o_conv);
31863         int64_t ret_ref = tag_ptr(ret_copy, true);
31864         return ret_ref;
31865 }
31866
31867 int64_t  CS_LDK_COption_FilterZ_none() {
31868         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31869         *ret_copy = COption_FilterZ_none();
31870         int64_t ret_ref = tag_ptr(ret_copy, true);
31871         return ret_ref;
31872 }
31873
31874 void  CS_LDK_COption_FilterZ_free(int64_t _res) {
31875         if (!ptr_is_owned(_res)) return;
31876         void* _res_ptr = untag_ptr(_res);
31877         CHECK_ACCESS(_res_ptr);
31878         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
31879         FREE(untag_ptr(_res));
31880         COption_FilterZ_free(_res_conv);
31881 }
31882
31883 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_ok(int64_t o) {
31884         LDKLockedChannelMonitor o_conv;
31885         o_conv.inner = untag_ptr(o);
31886         o_conv.is_owned = ptr_is_owned(o);
31887         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31888         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
31889         
31890         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31891         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
31892         return tag_ptr(ret_conv, true);
31893 }
31894
31895 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_err() {
31896         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31897         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
31898         return tag_ptr(ret_conv, true);
31899 }
31900
31901 jboolean  CS_LDK_CResult_LockedChannelMonitorNoneZ_is_ok(int64_t o) {
31902         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
31903         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
31904         return ret_conv;
31905 }
31906
31907 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_free(int64_t _res) {
31908         if (!ptr_is_owned(_res)) return;
31909         void* _res_ptr = untag_ptr(_res);
31910         CHECK_ACCESS(_res_ptr);
31911         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
31912         FREE(untag_ptr(_res));
31913         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
31914 }
31915
31916 void  CS_LDK_CVec_OutPointZ_free(int64_tArray _res) {
31917         LDKCVec_OutPointZ _res_constr;
31918         _res_constr.datalen = _res->arr_len;
31919         if (_res_constr.datalen > 0)
31920                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
31921         else
31922                 _res_constr.data = NULL;
31923         int64_t* _res_vals = _res->elems;
31924         for (size_t k = 0; k < _res_constr.datalen; k++) {
31925                 int64_t _res_conv_10 = _res_vals[k];
31926                 LDKOutPoint _res_conv_10_conv;
31927                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
31928                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
31929                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
31930                 _res_constr.data[k] = _res_conv_10_conv;
31931         }
31932         FREE(_res);
31933         CVec_OutPointZ_free(_res_constr);
31934 }
31935
31936 void  CS_LDK_CVec_MonitorUpdateIdZ_free(int64_tArray _res) {
31937         LDKCVec_MonitorUpdateIdZ _res_constr;
31938         _res_constr.datalen = _res->arr_len;
31939         if (_res_constr.datalen > 0)
31940                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31941         else
31942                 _res_constr.data = NULL;
31943         int64_t* _res_vals = _res->elems;
31944         for (size_t r = 0; r < _res_constr.datalen; r++) {
31945                 int64_t _res_conv_17 = _res_vals[r];
31946                 LDKMonitorUpdateId _res_conv_17_conv;
31947                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
31948                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
31949                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
31950                 _res_constr.data[r] = _res_conv_17_conv;
31951         }
31952         FREE(_res);
31953         CVec_MonitorUpdateIdZ_free(_res_constr);
31954 }
31955
31956 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
31957         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31958         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
31959         return tag_ptr(ret_conv, true);
31960 }
31961 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(int64_t arg) {
31962         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
31963         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
31964         return ret_conv;
31965 }
31966
31967 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(int64_t orig) {
31968         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
31969         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31970         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
31971         return tag_ptr(ret_conv, true);
31972 }
31973
31974 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(int64_t a, int64_tArray b) {
31975         LDKOutPoint a_conv;
31976         a_conv.inner = untag_ptr(a);
31977         a_conv.is_owned = ptr_is_owned(a);
31978         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31979         a_conv = OutPoint_clone(&a_conv);
31980         LDKCVec_MonitorUpdateIdZ b_constr;
31981         b_constr.datalen = b->arr_len;
31982         if (b_constr.datalen > 0)
31983                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31984         else
31985                 b_constr.data = NULL;
31986         int64_t* b_vals = b->elems;
31987         for (size_t r = 0; r < b_constr.datalen; r++) {
31988                 int64_t b_conv_17 = b_vals[r];
31989                 LDKMonitorUpdateId b_conv_17_conv;
31990                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
31991                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
31992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
31993                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
31994                 b_constr.data[r] = b_conv_17_conv;
31995         }
31996         FREE(b);
31997         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31998         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
31999         return tag_ptr(ret_conv, true);
32000 }
32001
32002 void  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(int64_t _res) {
32003         if (!ptr_is_owned(_res)) return;
32004         void* _res_ptr = untag_ptr(_res);
32005         CHECK_ACCESS(_res_ptr);
32006         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
32007         FREE(untag_ptr(_res));
32008         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
32009 }
32010
32011 void  CS_LDK_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(int64_tArray _res) {
32012         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
32013         _res_constr.datalen = _res->arr_len;
32014         if (_res_constr.datalen > 0)
32015                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
32016         else
32017                 _res_constr.data = NULL;
32018         int64_t* _res_vals = _res->elems;
32019         for (size_t p = 0; p < _res_constr.datalen; p++) {
32020                 int64_t _res_conv_41 = _res_vals[p];
32021                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
32022                 CHECK_ACCESS(_res_conv_41_ptr);
32023                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
32024                 FREE(untag_ptr(_res_conv_41));
32025                 _res_constr.data[p] = _res_conv_41_conv;
32026         }
32027         FREE(_res);
32028         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
32029 }
32030
32031 void  CS_LDK_APIError_free(int64_t this_ptr) {
32032         if (!ptr_is_owned(this_ptr)) return;
32033         void* this_ptr_ptr = untag_ptr(this_ptr);
32034         CHECK_ACCESS(this_ptr_ptr);
32035         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
32036         FREE(untag_ptr(this_ptr));
32037         APIError_free(this_ptr_conv);
32038 }
32039
32040 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
32041         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32042         *ret_copy = APIError_clone(arg);
32043         int64_t ret_ref = tag_ptr(ret_copy, true);
32044         return ret_ref;
32045 }
32046 int64_t  CS_LDK_APIError_clone_ptr(int64_t arg) {
32047         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
32048         int64_t ret_conv = APIError_clone_ptr(arg_conv);
32049         return ret_conv;
32050 }
32051
32052 int64_t  CS_LDK_APIError_clone(int64_t orig) {
32053         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
32054         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32055         *ret_copy = APIError_clone(orig_conv);
32056         int64_t ret_ref = tag_ptr(ret_copy, true);
32057         return ret_ref;
32058 }
32059
32060 int64_t  CS_LDK_APIError_apimisuse_error(jstring err) {
32061         LDKStr err_conv = str_ref_to_owned_c(err);
32062         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32063         *ret_copy = APIError_apimisuse_error(err_conv);
32064         int64_t ret_ref = tag_ptr(ret_copy, true);
32065         return ret_ref;
32066 }
32067
32068 int64_t  CS_LDK_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
32069         LDKStr err_conv = str_ref_to_owned_c(err);
32070         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32071         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
32072         int64_t ret_ref = tag_ptr(ret_copy, true);
32073         return ret_ref;
32074 }
32075
32076 int64_t  CS_LDK_APIError_invalid_route(jstring err) {
32077         LDKStr err_conv = str_ref_to_owned_c(err);
32078         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32079         *ret_copy = APIError_invalid_route(err_conv);
32080         int64_t ret_ref = tag_ptr(ret_copy, true);
32081         return ret_ref;
32082 }
32083
32084 int64_t  CS_LDK_APIError_channel_unavailable(jstring err) {
32085         LDKStr err_conv = str_ref_to_owned_c(err);
32086         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32087         *ret_copy = APIError_channel_unavailable(err_conv);
32088         int64_t ret_ref = tag_ptr(ret_copy, true);
32089         return ret_ref;
32090 }
32091
32092 int64_t  CS_LDK_APIError_monitor_update_in_progress() {
32093         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32094         *ret_copy = APIError_monitor_update_in_progress();
32095         int64_t ret_ref = tag_ptr(ret_copy, true);
32096         return ret_ref;
32097 }
32098
32099 int64_t  CS_LDK_APIError_incompatible_shutdown_script(int64_t script) {
32100         LDKShutdownScript script_conv;
32101         script_conv.inner = untag_ptr(script);
32102         script_conv.is_owned = ptr_is_owned(script);
32103         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
32104         script_conv = ShutdownScript_clone(&script_conv);
32105         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32106         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
32107         int64_t ret_ref = tag_ptr(ret_copy, true);
32108         return ret_ref;
32109 }
32110
32111 jboolean  CS_LDK_APIError_eq(int64_t a, int64_t b) {
32112         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
32113         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
32114         jboolean ret_conv = APIError_eq(a_conv, b_conv);
32115         return ret_conv;
32116 }
32117
32118 int8_tArray  CS_LDK_APIError_write(int64_t obj) {
32119         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
32120         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
32121         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32122         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32123         CVec_u8Z_free(ret_var);
32124         return ret_arr;
32125 }
32126
32127 int64_t  CS_LDK_APIError_read(int8_tArray ser) {
32128         LDKu8slice ser_ref;
32129         ser_ref.datalen = ser->arr_len;
32130         ser_ref.data = ser->elems;
32131         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
32132         *ret_conv = APIError_read(ser_ref);
32133         FREE(ser);
32134         return tag_ptr(ret_conv, true);
32135 }
32136
32137 void  CS_LDK_BigSize_free(int64_t this_obj) {
32138         LDKBigSize this_obj_conv;
32139         this_obj_conv.inner = untag_ptr(this_obj);
32140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32142         BigSize_free(this_obj_conv);
32143 }
32144
32145 int64_t  CS_LDK_BigSize_get_a(int64_t this_ptr) {
32146         LDKBigSize this_ptr_conv;
32147         this_ptr_conv.inner = untag_ptr(this_ptr);
32148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32150         this_ptr_conv.is_owned = false;
32151         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
32152         return ret_conv;
32153 }
32154
32155 void  CS_LDK_BigSize_set_a(int64_t this_ptr, int64_t val) {
32156         LDKBigSize this_ptr_conv;
32157         this_ptr_conv.inner = untag_ptr(this_ptr);
32158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32160         this_ptr_conv.is_owned = false;
32161         BigSize_set_a(&this_ptr_conv, val);
32162 }
32163
32164 int64_t  CS_LDK_BigSize_new(int64_t a_arg) {
32165         LDKBigSize ret_var = BigSize_new(a_arg);
32166         int64_t ret_ref = 0;
32167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32169         return ret_ref;
32170 }
32171
32172 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
32173         LDKBigSize ret_var = BigSize_clone(arg);
32174         int64_t ret_ref = 0;
32175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32177         return ret_ref;
32178 }
32179 int64_t  CS_LDK_BigSize_clone_ptr(int64_t arg) {
32180         LDKBigSize arg_conv;
32181         arg_conv.inner = untag_ptr(arg);
32182         arg_conv.is_owned = ptr_is_owned(arg);
32183         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32184         arg_conv.is_owned = false;
32185         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
32186         return ret_conv;
32187 }
32188
32189 int64_t  CS_LDK_BigSize_clone(int64_t orig) {
32190         LDKBigSize orig_conv;
32191         orig_conv.inner = untag_ptr(orig);
32192         orig_conv.is_owned = ptr_is_owned(orig);
32193         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32194         orig_conv.is_owned = false;
32195         LDKBigSize ret_var = BigSize_clone(&orig_conv);
32196         int64_t ret_ref = 0;
32197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32199         return ret_ref;
32200 }
32201
32202 int64_t  CS_LDK_BigSize_hash(int64_t o) {
32203         LDKBigSize o_conv;
32204         o_conv.inner = untag_ptr(o);
32205         o_conv.is_owned = ptr_is_owned(o);
32206         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32207         o_conv.is_owned = false;
32208         int64_t ret_conv = BigSize_hash(&o_conv);
32209         return ret_conv;
32210 }
32211
32212 jboolean  CS_LDK_BigSize_eq(int64_t a, int64_t b) {
32213         LDKBigSize a_conv;
32214         a_conv.inner = untag_ptr(a);
32215         a_conv.is_owned = ptr_is_owned(a);
32216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32217         a_conv.is_owned = false;
32218         LDKBigSize b_conv;
32219         b_conv.inner = untag_ptr(b);
32220         b_conv.is_owned = ptr_is_owned(b);
32221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32222         b_conv.is_owned = false;
32223         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
32224         return ret_conv;
32225 }
32226
32227 int8_tArray  CS_LDK_BigSize_write(int64_t obj) {
32228         LDKBigSize obj_conv;
32229         obj_conv.inner = untag_ptr(obj);
32230         obj_conv.is_owned = ptr_is_owned(obj);
32231         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32232         obj_conv.is_owned = false;
32233         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
32234         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32235         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32236         CVec_u8Z_free(ret_var);
32237         return ret_arr;
32238 }
32239
32240 int64_t  CS_LDK_BigSize_read(int8_tArray ser) {
32241         LDKu8slice ser_ref;
32242         ser_ref.datalen = ser->arr_len;
32243         ser_ref.data = ser->elems;
32244         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32245         *ret_conv = BigSize_read(ser_ref);
32246         FREE(ser);
32247         return tag_ptr(ret_conv, true);
32248 }
32249
32250 void  CS_LDK_Hostname_free(int64_t this_obj) {
32251         LDKHostname this_obj_conv;
32252         this_obj_conv.inner = untag_ptr(this_obj);
32253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32255         Hostname_free(this_obj_conv);
32256 }
32257
32258 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
32259         LDKHostname ret_var = Hostname_clone(arg);
32260         int64_t ret_ref = 0;
32261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32263         return ret_ref;
32264 }
32265 int64_t  CS_LDK_Hostname_clone_ptr(int64_t arg) {
32266         LDKHostname arg_conv;
32267         arg_conv.inner = untag_ptr(arg);
32268         arg_conv.is_owned = ptr_is_owned(arg);
32269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32270         arg_conv.is_owned = false;
32271         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
32272         return ret_conv;
32273 }
32274
32275 int64_t  CS_LDK_Hostname_clone(int64_t orig) {
32276         LDKHostname orig_conv;
32277         orig_conv.inner = untag_ptr(orig);
32278         orig_conv.is_owned = ptr_is_owned(orig);
32279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32280         orig_conv.is_owned = false;
32281         LDKHostname ret_var = Hostname_clone(&orig_conv);
32282         int64_t ret_ref = 0;
32283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32285         return ret_ref;
32286 }
32287
32288 int64_t  CS_LDK_Hostname_hash(int64_t o) {
32289         LDKHostname o_conv;
32290         o_conv.inner = untag_ptr(o);
32291         o_conv.is_owned = ptr_is_owned(o);
32292         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32293         o_conv.is_owned = false;
32294         int64_t ret_conv = Hostname_hash(&o_conv);
32295         return ret_conv;
32296 }
32297
32298 jboolean  CS_LDK_Hostname_eq(int64_t a, int64_t b) {
32299         LDKHostname a_conv;
32300         a_conv.inner = untag_ptr(a);
32301         a_conv.is_owned = ptr_is_owned(a);
32302         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32303         a_conv.is_owned = false;
32304         LDKHostname b_conv;
32305         b_conv.inner = untag_ptr(b);
32306         b_conv.is_owned = ptr_is_owned(b);
32307         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32308         b_conv.is_owned = false;
32309         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
32310         return ret_conv;
32311 }
32312
32313 int8_t  CS_LDK_Hostname_len(int64_t this_arg) {
32314         LDKHostname this_arg_conv;
32315         this_arg_conv.inner = untag_ptr(this_arg);
32316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32318         this_arg_conv.is_owned = false;
32319         int8_t ret_conv = Hostname_len(&this_arg_conv);
32320         return ret_conv;
32321 }
32322
32323 int8_tArray  CS_LDK_Hostname_write(int64_t obj) {
32324         LDKHostname obj_conv;
32325         obj_conv.inner = untag_ptr(obj);
32326         obj_conv.is_owned = ptr_is_owned(obj);
32327         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32328         obj_conv.is_owned = false;
32329         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
32330         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32331         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32332         CVec_u8Z_free(ret_var);
32333         return ret_arr;
32334 }
32335
32336 int64_t  CS_LDK_Hostname_read(int8_tArray ser) {
32337         LDKu8slice ser_ref;
32338         ser_ref.datalen = ser->arr_len;
32339         ser_ref.data = ser->elems;
32340         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32341         *ret_conv = Hostname_read(ser_ref);
32342         FREE(ser);
32343         return tag_ptr(ret_conv, true);
32344 }
32345
32346 void  CS_LDK_TransactionU16LenLimited_free(int64_t this_obj) {
32347         LDKTransactionU16LenLimited this_obj_conv;
32348         this_obj_conv.inner = untag_ptr(this_obj);
32349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32351         TransactionU16LenLimited_free(this_obj_conv);
32352 }
32353
32354 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
32355         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
32356         int64_t ret_ref = 0;
32357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32359         return ret_ref;
32360 }
32361 int64_t  CS_LDK_TransactionU16LenLimited_clone_ptr(int64_t arg) {
32362         LDKTransactionU16LenLimited arg_conv;
32363         arg_conv.inner = untag_ptr(arg);
32364         arg_conv.is_owned = ptr_is_owned(arg);
32365         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32366         arg_conv.is_owned = false;
32367         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
32368         return ret_conv;
32369 }
32370
32371 int64_t  CS_LDK_TransactionU16LenLimited_clone(int64_t orig) {
32372         LDKTransactionU16LenLimited orig_conv;
32373         orig_conv.inner = untag_ptr(orig);
32374         orig_conv.is_owned = ptr_is_owned(orig);
32375         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32376         orig_conv.is_owned = false;
32377         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
32378         int64_t ret_ref = 0;
32379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32381         return ret_ref;
32382 }
32383
32384 int64_t  CS_LDK_TransactionU16LenLimited_hash(int64_t o) {
32385         LDKTransactionU16LenLimited o_conv;
32386         o_conv.inner = untag_ptr(o);
32387         o_conv.is_owned = ptr_is_owned(o);
32388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32389         o_conv.is_owned = false;
32390         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
32391         return ret_conv;
32392 }
32393
32394 jboolean  CS_LDK_TransactionU16LenLimited_eq(int64_t a, int64_t b) {
32395         LDKTransactionU16LenLimited a_conv;
32396         a_conv.inner = untag_ptr(a);
32397         a_conv.is_owned = ptr_is_owned(a);
32398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32399         a_conv.is_owned = false;
32400         LDKTransactionU16LenLimited b_conv;
32401         b_conv.inner = untag_ptr(b);
32402         b_conv.is_owned = ptr_is_owned(b);
32403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32404         b_conv.is_owned = false;
32405         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
32406         return ret_conv;
32407 }
32408
32409 int64_t  CS_LDK_TransactionU16LenLimited_new(int8_tArray transaction) {
32410         LDKTransaction transaction_ref;
32411         transaction_ref.datalen = transaction->arr_len;
32412         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
32413         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
32414         transaction_ref.data_is_owned = true;
32415         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32416         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
32417         return tag_ptr(ret_conv, true);
32418 }
32419
32420 int8_tArray  CS_LDK_TransactionU16LenLimited_into_transaction(int64_t this_arg) {
32421         LDKTransactionU16LenLimited this_arg_conv;
32422         this_arg_conv.inner = untag_ptr(this_arg);
32423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32425         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
32426         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
32427         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32428         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32429         Transaction_free(ret_var);
32430         return ret_arr;
32431 }
32432
32433 int8_tArray  CS_LDK_TransactionU16LenLimited_write(int64_t obj) {
32434         LDKTransactionU16LenLimited obj_conv;
32435         obj_conv.inner = untag_ptr(obj);
32436         obj_conv.is_owned = ptr_is_owned(obj);
32437         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32438         obj_conv.is_owned = false;
32439         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
32440         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32441         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32442         CVec_u8Z_free(ret_var);
32443         return ret_arr;
32444 }
32445
32446 int64_t  CS_LDK_TransactionU16LenLimited_read(int8_tArray ser) {
32447         LDKu8slice ser_ref;
32448         ser_ref.datalen = ser->arr_len;
32449         ser_ref.data = ser->elems;
32450         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32451         *ret_conv = TransactionU16LenLimited_read(ser_ref);
32452         FREE(ser);
32453         return tag_ptr(ret_conv, true);
32454 }
32455
32456 int64_t  CS_LDK_sign(int8_tArray msg, int8_tArray sk) {
32457         LDKu8slice msg_ref;
32458         msg_ref.datalen = msg->arr_len;
32459         msg_ref.data = msg->elems;
32460         uint8_t sk_arr[32];
32461         CHECK(sk->arr_len == 32);
32462         memcpy(sk_arr, sk->elems, 32); FREE(sk);
32463         uint8_t (*sk_ref)[32] = &sk_arr;
32464         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
32465         *ret_conv = sign(msg_ref, sk_ref);
32466         FREE(msg);
32467         return tag_ptr(ret_conv, true);
32468 }
32469
32470 int64_t  CS_LDK_recover_pk(int8_tArray msg, jstring sig) {
32471         LDKu8slice msg_ref;
32472         msg_ref.datalen = msg->arr_len;
32473         msg_ref.data = msg->elems;
32474         LDKStr sig_conv = str_ref_to_owned_c(sig);
32475         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
32476         *ret_conv = recover_pk(msg_ref, sig_conv);
32477         FREE(msg);
32478         return tag_ptr(ret_conv, true);
32479 }
32480
32481 jboolean  CS_LDK_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
32482         LDKu8slice msg_ref;
32483         msg_ref.datalen = msg->arr_len;
32484         msg_ref.data = msg->elems;
32485         LDKStr sig_conv = str_ref_to_owned_c(sig);
32486         LDKPublicKey pk_ref;
32487         CHECK(pk->arr_len == 33);
32488         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
32489         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
32490         FREE(msg);
32491         return ret_conv;
32492 }
32493
32494 int8_tArray  CS_LDK_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
32495         LDKu8slice hrp_bytes_ref;
32496         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
32497         hrp_bytes_ref.data = hrp_bytes->elems;
32498         LDKCVec_U5Z data_without_signature_constr;
32499         data_without_signature_constr.datalen = data_without_signature->arr_len;
32500         if (data_without_signature_constr.datalen > 0)
32501                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
32502         else
32503                 data_without_signature_constr.data = NULL;
32504         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
32505         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
32506                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
32507                 
32508                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
32509         }
32510         FREE(data_without_signature);
32511         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
32512         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32513         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32514         CVec_u8Z_free(ret_var);
32515         FREE(hrp_bytes);
32516         return ret_arr;
32517 }
32518
32519 void  CS_LDK_KVStore_free(int64_t this_ptr) {
32520         if (!ptr_is_owned(this_ptr)) return;
32521         void* this_ptr_ptr = untag_ptr(this_ptr);
32522         CHECK_ACCESS(this_ptr_ptr);
32523         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
32524         FREE(untag_ptr(this_ptr));
32525         KVStore_free(this_ptr_conv);
32526 }
32527
32528 void  CS_LDK_Persister_free(int64_t this_ptr) {
32529         if (!ptr_is_owned(this_ptr)) return;
32530         void* this_ptr_ptr = untag_ptr(this_ptr);
32531         CHECK_ACCESS(this_ptr_ptr);
32532         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
32533         FREE(untag_ptr(this_ptr));
32534         Persister_free(this_ptr_conv);
32535 }
32536
32537 int64_t  CS_LDK_read_channel_monitors(int64_t kv_store, int64_t entropy_source, int64_t signer_provider) {
32538         void* kv_store_ptr = untag_ptr(kv_store);
32539         CHECK_ACCESS(kv_store_ptr);
32540         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32541         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32542                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32543                 LDKKVStore_JCalls_cloned(&kv_store_conv);
32544         }
32545         void* entropy_source_ptr = untag_ptr(entropy_source);
32546         CHECK_ACCESS(entropy_source_ptr);
32547         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32548         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32549                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32550                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32551         }
32552         void* signer_provider_ptr = untag_ptr(signer_provider);
32553         CHECK_ACCESS(signer_provider_ptr);
32554         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32555         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32556                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32557                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32558         }
32559         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32560         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
32561         return tag_ptr(ret_conv, true);
32562 }
32563
32564 void  CS_LDK_MonitorUpdatingPersister_free(int64_t this_obj) {
32565         LDKMonitorUpdatingPersister this_obj_conv;
32566         this_obj_conv.inner = untag_ptr(this_obj);
32567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32569         MonitorUpdatingPersister_free(this_obj_conv);
32570 }
32571
32572 int64_t  CS_LDK_MonitorUpdatingPersister_new(int64_t kv_store, int64_t logger, int64_t maximum_pending_updates, int64_t entropy_source, int64_t signer_provider) {
32573         void* kv_store_ptr = untag_ptr(kv_store);
32574         CHECK_ACCESS(kv_store_ptr);
32575         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32576         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32577                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32578                 LDKKVStore_JCalls_cloned(&kv_store_conv);
32579         }
32580         void* logger_ptr = untag_ptr(logger);
32581         CHECK_ACCESS(logger_ptr);
32582         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32583         if (logger_conv.free == LDKLogger_JCalls_free) {
32584                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32585                 LDKLogger_JCalls_cloned(&logger_conv);
32586         }
32587         void* entropy_source_ptr = untag_ptr(entropy_source);
32588         CHECK_ACCESS(entropy_source_ptr);
32589         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32590         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32591                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32592                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32593         }
32594         void* signer_provider_ptr = untag_ptr(signer_provider);
32595         CHECK_ACCESS(signer_provider_ptr);
32596         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32597         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32598                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32599                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32600         }
32601         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
32602         int64_t ret_ref = 0;
32603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32605         return ret_ref;
32606 }
32607
32608 int64_t  CS_LDK_MonitorUpdatingPersister_read_all_channel_monitors_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator) {
32609         LDKMonitorUpdatingPersister this_arg_conv;
32610         this_arg_conv.inner = untag_ptr(this_arg);
32611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32613         this_arg_conv.is_owned = false;
32614         void* broadcaster_ptr = untag_ptr(broadcaster);
32615         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32616         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32617         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32618         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32619         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32620         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32621         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
32622         return tag_ptr(ret_conv, true);
32623 }
32624
32625 int64_t  CS_LDK_MonitorUpdatingPersister_read_channel_monitor_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, jstring monitor_key) {
32626         LDKMonitorUpdatingPersister this_arg_conv;
32627         this_arg_conv.inner = untag_ptr(this_arg);
32628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32630         this_arg_conv.is_owned = false;
32631         void* broadcaster_ptr = untag_ptr(broadcaster);
32632         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32633         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32634         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32635         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32636         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32637         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
32638         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32639         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
32640         return tag_ptr(ret_conv, true);
32641 }
32642
32643 int64_t  CS_LDK_MonitorUpdatingPersister_cleanup_stale_updates(int64_t this_arg, jboolean lazy) {
32644         LDKMonitorUpdatingPersister this_arg_conv;
32645         this_arg_conv.inner = untag_ptr(this_arg);
32646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32648         this_arg_conv.is_owned = false;
32649         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
32650         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
32651         return tag_ptr(ret_conv, true);
32652 }
32653
32654 int64_t  CS_LDK_MonitorUpdatingPersister_as_Persist(int64_t this_arg) {
32655         LDKMonitorUpdatingPersister this_arg_conv;
32656         this_arg_conv.inner = untag_ptr(this_arg);
32657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32659         this_arg_conv.is_owned = false;
32660         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
32661         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
32662         return tag_ptr(ret_ret, true);
32663 }
32664
32665 void  CS_LDK_UntrustedString_free(int64_t this_obj) {
32666         LDKUntrustedString this_obj_conv;
32667         this_obj_conv.inner = untag_ptr(this_obj);
32668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32670         UntrustedString_free(this_obj_conv);
32671 }
32672
32673 jstring  CS_LDK_UntrustedString_get_a(int64_t this_ptr) {
32674         LDKUntrustedString this_ptr_conv;
32675         this_ptr_conv.inner = untag_ptr(this_ptr);
32676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32678         this_ptr_conv.is_owned = false;
32679         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
32680         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
32681         Str_free(ret_str);
32682         return ret_conv;
32683 }
32684
32685 void  CS_LDK_UntrustedString_set_a(int64_t this_ptr, jstring val) {
32686         LDKUntrustedString this_ptr_conv;
32687         this_ptr_conv.inner = untag_ptr(this_ptr);
32688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32690         this_ptr_conv.is_owned = false;
32691         LDKStr val_conv = str_ref_to_owned_c(val);
32692         UntrustedString_set_a(&this_ptr_conv, val_conv);
32693 }
32694
32695 int64_t  CS_LDK_UntrustedString_new(jstring a_arg) {
32696         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32697         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
32698         int64_t ret_ref = 0;
32699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32701         return ret_ref;
32702 }
32703
32704 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
32705         LDKUntrustedString ret_var = UntrustedString_clone(arg);
32706         int64_t ret_ref = 0;
32707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32709         return ret_ref;
32710 }
32711 int64_t  CS_LDK_UntrustedString_clone_ptr(int64_t arg) {
32712         LDKUntrustedString arg_conv;
32713         arg_conv.inner = untag_ptr(arg);
32714         arg_conv.is_owned = ptr_is_owned(arg);
32715         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32716         arg_conv.is_owned = false;
32717         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
32718         return ret_conv;
32719 }
32720
32721 int64_t  CS_LDK_UntrustedString_clone(int64_t orig) {
32722         LDKUntrustedString orig_conv;
32723         orig_conv.inner = untag_ptr(orig);
32724         orig_conv.is_owned = ptr_is_owned(orig);
32725         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32726         orig_conv.is_owned = false;
32727         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
32728         int64_t ret_ref = 0;
32729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32731         return ret_ref;
32732 }
32733
32734 jboolean  CS_LDK_UntrustedString_eq(int64_t a, int64_t b) {
32735         LDKUntrustedString a_conv;
32736         a_conv.inner = untag_ptr(a);
32737         a_conv.is_owned = ptr_is_owned(a);
32738         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32739         a_conv.is_owned = false;
32740         LDKUntrustedString b_conv;
32741         b_conv.inner = untag_ptr(b);
32742         b_conv.is_owned = ptr_is_owned(b);
32743         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32744         b_conv.is_owned = false;
32745         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
32746         return ret_conv;
32747 }
32748
32749 int64_t  CS_LDK_UntrustedString_hash(int64_t o) {
32750         LDKUntrustedString o_conv;
32751         o_conv.inner = untag_ptr(o);
32752         o_conv.is_owned = ptr_is_owned(o);
32753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32754         o_conv.is_owned = false;
32755         int64_t ret_conv = UntrustedString_hash(&o_conv);
32756         return ret_conv;
32757 }
32758
32759 int8_tArray  CS_LDK_UntrustedString_write(int64_t obj) {
32760         LDKUntrustedString obj_conv;
32761         obj_conv.inner = untag_ptr(obj);
32762         obj_conv.is_owned = ptr_is_owned(obj);
32763         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32764         obj_conv.is_owned = false;
32765         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
32766         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32767         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32768         CVec_u8Z_free(ret_var);
32769         return ret_arr;
32770 }
32771
32772 int64_t  CS_LDK_UntrustedString_read(int8_tArray ser) {
32773         LDKu8slice ser_ref;
32774         ser_ref.datalen = ser->arr_len;
32775         ser_ref.data = ser->elems;
32776         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32777         *ret_conv = UntrustedString_read(ser_ref);
32778         FREE(ser);
32779         return tag_ptr(ret_conv, true);
32780 }
32781
32782 void  CS_LDK_PrintableString_free(int64_t this_obj) {
32783         LDKPrintableString this_obj_conv;
32784         this_obj_conv.inner = untag_ptr(this_obj);
32785         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32787         PrintableString_free(this_obj_conv);
32788 }
32789
32790 jstring  CS_LDK_PrintableString_get_a(int64_t this_ptr) {
32791         LDKPrintableString this_ptr_conv;
32792         this_ptr_conv.inner = untag_ptr(this_ptr);
32793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32795         this_ptr_conv.is_owned = false;
32796         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
32797         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
32798         Str_free(ret_str);
32799         return ret_conv;
32800 }
32801
32802 void  CS_LDK_PrintableString_set_a(int64_t this_ptr, jstring val) {
32803         LDKPrintableString this_ptr_conv;
32804         this_ptr_conv.inner = untag_ptr(this_ptr);
32805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32807         this_ptr_conv.is_owned = false;
32808         LDKStr val_conv = str_ref_to_owned_c(val);
32809         PrintableString_set_a(&this_ptr_conv, val_conv);
32810 }
32811
32812 int64_t  CS_LDK_PrintableString_new(jstring a_arg) {
32813         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32814         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
32815         int64_t ret_ref = 0;
32816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32818         return ret_ref;
32819 }
32820
32821 void  CS_LDK_FutureCallback_free(int64_t this_ptr) {
32822         if (!ptr_is_owned(this_ptr)) return;
32823         void* this_ptr_ptr = untag_ptr(this_ptr);
32824         CHECK_ACCESS(this_ptr_ptr);
32825         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
32826         FREE(untag_ptr(this_ptr));
32827         FutureCallback_free(this_ptr_conv);
32828 }
32829
32830 void  CS_LDK_Future_free(int64_t this_obj) {
32831         LDKFuture this_obj_conv;
32832         this_obj_conv.inner = untag_ptr(this_obj);
32833         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32835         Future_free(this_obj_conv);
32836 }
32837
32838 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
32839         LDKFuture ret_var = Future_clone(arg);
32840         int64_t ret_ref = 0;
32841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32843         return ret_ref;
32844 }
32845 int64_t  CS_LDK_Future_clone_ptr(int64_t arg) {
32846         LDKFuture arg_conv;
32847         arg_conv.inner = untag_ptr(arg);
32848         arg_conv.is_owned = ptr_is_owned(arg);
32849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32850         arg_conv.is_owned = false;
32851         int64_t ret_conv = Future_clone_ptr(&arg_conv);
32852         return ret_conv;
32853 }
32854
32855 int64_t  CS_LDK_Future_clone(int64_t orig) {
32856         LDKFuture orig_conv;
32857         orig_conv.inner = untag_ptr(orig);
32858         orig_conv.is_owned = ptr_is_owned(orig);
32859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32860         orig_conv.is_owned = false;
32861         LDKFuture ret_var = Future_clone(&orig_conv);
32862         int64_t ret_ref = 0;
32863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32865         return ret_ref;
32866 }
32867
32868 void  CS_LDK_Future_register_callback_fn(int64_t this_arg, int64_t callback) {
32869         LDKFuture this_arg_conv;
32870         this_arg_conv.inner = untag_ptr(this_arg);
32871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32873         this_arg_conv.is_owned = false;
32874         void* callback_ptr = untag_ptr(callback);
32875         CHECK_ACCESS(callback_ptr);
32876         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
32877         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
32878                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32879                 LDKFutureCallback_JCalls_cloned(&callback_conv);
32880         }
32881         Future_register_callback_fn(&this_arg_conv, callback_conv);
32882 }
32883
32884 void  CS_LDK_Future_wait(int64_t this_arg) {
32885         LDKFuture this_arg_conv;
32886         this_arg_conv.inner = untag_ptr(this_arg);
32887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32889         this_arg_conv = Future_clone(&this_arg_conv);
32890         Future_wait(this_arg_conv);
32891 }
32892
32893 jboolean  CS_LDK_Future_wait_timeout(int64_t this_arg, int64_t max_wait) {
32894         LDKFuture this_arg_conv;
32895         this_arg_conv.inner = untag_ptr(this_arg);
32896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32898         this_arg_conv = Future_clone(&this_arg_conv);
32899         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
32900         return ret_conv;
32901 }
32902
32903 void  CS_LDK_Sleeper_free(int64_t this_obj) {
32904         LDKSleeper this_obj_conv;
32905         this_obj_conv.inner = untag_ptr(this_obj);
32906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32908         Sleeper_free(this_obj_conv);
32909 }
32910
32911 int64_t  CS_LDK_Sleeper_from_single_future(int64_t future) {
32912         LDKFuture future_conv;
32913         future_conv.inner = untag_ptr(future);
32914         future_conv.is_owned = ptr_is_owned(future);
32915         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
32916         future_conv = Future_clone(&future_conv);
32917         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
32918         int64_t ret_ref = 0;
32919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32921         return ret_ref;
32922 }
32923
32924 int64_t  CS_LDK_Sleeper_from_two_futures(int64_t fut_a, int64_t fut_b) {
32925         LDKFuture fut_a_conv;
32926         fut_a_conv.inner = untag_ptr(fut_a);
32927         fut_a_conv.is_owned = ptr_is_owned(fut_a);
32928         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
32929         fut_a_conv = Future_clone(&fut_a_conv);
32930         LDKFuture fut_b_conv;
32931         fut_b_conv.inner = untag_ptr(fut_b);
32932         fut_b_conv.is_owned = ptr_is_owned(fut_b);
32933         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
32934         fut_b_conv = Future_clone(&fut_b_conv);
32935         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
32936         int64_t ret_ref = 0;
32937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32939         return ret_ref;
32940 }
32941
32942 int64_t  CS_LDK_Sleeper_new(int64_tArray futures) {
32943         LDKCVec_FutureZ futures_constr;
32944         futures_constr.datalen = futures->arr_len;
32945         if (futures_constr.datalen > 0)
32946                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
32947         else
32948                 futures_constr.data = NULL;
32949         int64_t* futures_vals = futures->elems;
32950         for (size_t i = 0; i < futures_constr.datalen; i++) {
32951                 int64_t futures_conv_8 = futures_vals[i];
32952                 LDKFuture futures_conv_8_conv;
32953                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
32954                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
32955                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
32956                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
32957                 futures_constr.data[i] = futures_conv_8_conv;
32958         }
32959         FREE(futures);
32960         LDKSleeper ret_var = Sleeper_new(futures_constr);
32961         int64_t ret_ref = 0;
32962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32964         return ret_ref;
32965 }
32966
32967 void  CS_LDK_Sleeper_wait(int64_t this_arg) {
32968         LDKSleeper this_arg_conv;
32969         this_arg_conv.inner = untag_ptr(this_arg);
32970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32972         this_arg_conv.is_owned = false;
32973         Sleeper_wait(&this_arg_conv);
32974 }
32975
32976 jboolean  CS_LDK_Sleeper_wait_timeout(int64_t this_arg, int64_t max_wait) {
32977         LDKSleeper this_arg_conv;
32978         this_arg_conv.inner = untag_ptr(this_arg);
32979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32981         this_arg_conv.is_owned = false;
32982         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
32983         return ret_conv;
32984 }
32985
32986 int32_t  CS_LDK_Level_clone(int64_t orig) {
32987         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
32988         int32_t ret_conv = LDKLevel_to_cs(Level_clone(orig_conv));
32989         return ret_conv;
32990 }
32991
32992 int32_t  CS_LDK_Level_gossip() {
32993         int32_t ret_conv = LDKLevel_to_cs(Level_gossip());
32994         return ret_conv;
32995 }
32996
32997 int32_t  CS_LDK_Level_trace() {
32998         int32_t ret_conv = LDKLevel_to_cs(Level_trace());
32999         return ret_conv;
33000 }
33001
33002 int32_t  CS_LDK_Level_debug() {
33003         int32_t ret_conv = LDKLevel_to_cs(Level_debug());
33004         return ret_conv;
33005 }
33006
33007 int32_t  CS_LDK_Level_info() {
33008         int32_t ret_conv = LDKLevel_to_cs(Level_info());
33009         return ret_conv;
33010 }
33011
33012 int32_t  CS_LDK_Level_warn() {
33013         int32_t ret_conv = LDKLevel_to_cs(Level_warn());
33014         return ret_conv;
33015 }
33016
33017 int32_t  CS_LDK_Level_error() {
33018         int32_t ret_conv = LDKLevel_to_cs(Level_error());
33019         return ret_conv;
33020 }
33021
33022 jboolean  CS_LDK_Level_eq(int64_t a, int64_t b) {
33023         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
33024         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
33025         jboolean ret_conv = Level_eq(a_conv, b_conv);
33026         return ret_conv;
33027 }
33028
33029 int64_t  CS_LDK_Level_hash(int64_t o) {
33030         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
33031         int64_t ret_conv = Level_hash(o_conv);
33032         return ret_conv;
33033 }
33034
33035 int32_t  CS_LDK_Level_max() {
33036         int32_t ret_conv = LDKLevel_to_cs(Level_max());
33037         return ret_conv;
33038 }
33039
33040 void  CS_LDK_Record_free(int64_t this_obj) {
33041         LDKRecord this_obj_conv;
33042         this_obj_conv.inner = untag_ptr(this_obj);
33043         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33045         Record_free(this_obj_conv);
33046 }
33047
33048 int32_t  CS_LDK_Record_get_level(int64_t this_ptr) {
33049         LDKRecord this_ptr_conv;
33050         this_ptr_conv.inner = untag_ptr(this_ptr);
33051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33053         this_ptr_conv.is_owned = false;
33054         int32_t ret_conv = LDKLevel_to_cs(Record_get_level(&this_ptr_conv));
33055         return ret_conv;
33056 }
33057
33058 void  CS_LDK_Record_set_level(int64_t this_ptr, int32_t val) {
33059         LDKRecord this_ptr_conv;
33060         this_ptr_conv.inner = untag_ptr(this_ptr);
33061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33063         this_ptr_conv.is_owned = false;
33064         LDKLevel val_conv = LDKLevel_from_cs(val);
33065         Record_set_level(&this_ptr_conv, val_conv);
33066 }
33067
33068 int8_tArray  CS_LDK_Record_get_peer_id(int64_t this_ptr) {
33069         LDKRecord this_ptr_conv;
33070         this_ptr_conv.inner = untag_ptr(this_ptr);
33071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33073         this_ptr_conv.is_owned = false;
33074         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33075         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
33076         return ret_arr;
33077 }
33078
33079 void  CS_LDK_Record_set_peer_id(int64_t this_ptr, int8_tArray val) {
33080         LDKRecord this_ptr_conv;
33081         this_ptr_conv.inner = untag_ptr(this_ptr);
33082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33084         this_ptr_conv.is_owned = false;
33085         LDKPublicKey val_ref;
33086         CHECK(val->arr_len == 33);
33087         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33088         Record_set_peer_id(&this_ptr_conv, val_ref);
33089 }
33090
33091 int64_t  CS_LDK_Record_get_channel_id(int64_t this_ptr) {
33092         LDKRecord this_ptr_conv;
33093         this_ptr_conv.inner = untag_ptr(this_ptr);
33094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33096         this_ptr_conv.is_owned = false;
33097         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
33098         *ret_copy = Record_get_channel_id(&this_ptr_conv);
33099         int64_t ret_ref = tag_ptr(ret_copy, true);
33100         return ret_ref;
33101 }
33102
33103 void  CS_LDK_Record_set_channel_id(int64_t this_ptr, int64_t val) {
33104         LDKRecord this_ptr_conv;
33105         this_ptr_conv.inner = untag_ptr(this_ptr);
33106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33108         this_ptr_conv.is_owned = false;
33109         void* val_ptr = untag_ptr(val);
33110         CHECK_ACCESS(val_ptr);
33111         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
33112         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
33113         Record_set_channel_id(&this_ptr_conv, val_conv);
33114 }
33115
33116 jstring  CS_LDK_Record_get_args(int64_t this_ptr) {
33117         LDKRecord this_ptr_conv;
33118         this_ptr_conv.inner = untag_ptr(this_ptr);
33119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33121         this_ptr_conv.is_owned = false;
33122         LDKStr ret_str = Record_get_args(&this_ptr_conv);
33123         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
33124         Str_free(ret_str);
33125         return ret_conv;
33126 }
33127
33128 void  CS_LDK_Record_set_args(int64_t this_ptr, jstring val) {
33129         LDKRecord this_ptr_conv;
33130         this_ptr_conv.inner = untag_ptr(this_ptr);
33131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33133         this_ptr_conv.is_owned = false;
33134         LDKStr val_conv = str_ref_to_owned_c(val);
33135         Record_set_args(&this_ptr_conv, val_conv);
33136 }
33137
33138 jstring  CS_LDK_Record_get_module_path(int64_t this_ptr) {
33139         LDKRecord this_ptr_conv;
33140         this_ptr_conv.inner = untag_ptr(this_ptr);
33141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33143         this_ptr_conv.is_owned = false;
33144         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
33145         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
33146         Str_free(ret_str);
33147         return ret_conv;
33148 }
33149
33150 void  CS_LDK_Record_set_module_path(int64_t this_ptr, jstring val) {
33151         LDKRecord this_ptr_conv;
33152         this_ptr_conv.inner = untag_ptr(this_ptr);
33153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33155         this_ptr_conv.is_owned = false;
33156         LDKStr val_conv = str_ref_to_owned_c(val);
33157         Record_set_module_path(&this_ptr_conv, val_conv);
33158 }
33159
33160 jstring  CS_LDK_Record_get_file(int64_t this_ptr) {
33161         LDKRecord this_ptr_conv;
33162         this_ptr_conv.inner = untag_ptr(this_ptr);
33163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33165         this_ptr_conv.is_owned = false;
33166         LDKStr ret_str = Record_get_file(&this_ptr_conv);
33167         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
33168         Str_free(ret_str);
33169         return ret_conv;
33170 }
33171
33172 void  CS_LDK_Record_set_file(int64_t this_ptr, jstring val) {
33173         LDKRecord this_ptr_conv;
33174         this_ptr_conv.inner = untag_ptr(this_ptr);
33175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33177         this_ptr_conv.is_owned = false;
33178         LDKStr val_conv = str_ref_to_owned_c(val);
33179         Record_set_file(&this_ptr_conv, val_conv);
33180 }
33181
33182 int32_t  CS_LDK_Record_get_line(int64_t this_ptr) {
33183         LDKRecord this_ptr_conv;
33184         this_ptr_conv.inner = untag_ptr(this_ptr);
33185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33187         this_ptr_conv.is_owned = false;
33188         int32_t ret_conv = Record_get_line(&this_ptr_conv);
33189         return ret_conv;
33190 }
33191
33192 void  CS_LDK_Record_set_line(int64_t this_ptr, int32_t val) {
33193         LDKRecord this_ptr_conv;
33194         this_ptr_conv.inner = untag_ptr(this_ptr);
33195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33197         this_ptr_conv.is_owned = false;
33198         Record_set_line(&this_ptr_conv, val);
33199 }
33200
33201 int64_t  CS_LDK_Record_new(int32_t level_arg, int8_tArray peer_id_arg, int64_t channel_id_arg, jstring args_arg, jstring module_path_arg, jstring file_arg, int32_t line_arg) {
33202         LDKLevel level_arg_conv = LDKLevel_from_cs(level_arg);
33203         LDKPublicKey peer_id_arg_ref;
33204         CHECK(peer_id_arg->arr_len == 33);
33205         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
33206         void* channel_id_arg_ptr = untag_ptr(channel_id_arg);
33207         CHECK_ACCESS(channel_id_arg_ptr);
33208         LDKCOption_ThirtyTwoBytesZ channel_id_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_arg_ptr);
33209         channel_id_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id_arg));
33210         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
33211         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
33212         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
33213         LDKRecord ret_var = Record_new(level_arg_conv, peer_id_arg_ref, channel_id_arg_conv, args_arg_conv, module_path_arg_conv, file_arg_conv, line_arg);
33214         int64_t ret_ref = 0;
33215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33217         return ret_ref;
33218 }
33219
33220 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
33221         LDKRecord ret_var = Record_clone(arg);
33222         int64_t ret_ref = 0;
33223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33225         return ret_ref;
33226 }
33227 int64_t  CS_LDK_Record_clone_ptr(int64_t arg) {
33228         LDKRecord arg_conv;
33229         arg_conv.inner = untag_ptr(arg);
33230         arg_conv.is_owned = ptr_is_owned(arg);
33231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33232         arg_conv.is_owned = false;
33233         int64_t ret_conv = Record_clone_ptr(&arg_conv);
33234         return ret_conv;
33235 }
33236
33237 int64_t  CS_LDK_Record_clone(int64_t orig) {
33238         LDKRecord orig_conv;
33239         orig_conv.inner = untag_ptr(orig);
33240         orig_conv.is_owned = ptr_is_owned(orig);
33241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33242         orig_conv.is_owned = false;
33243         LDKRecord ret_var = Record_clone(&orig_conv);
33244         int64_t ret_ref = 0;
33245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33247         return ret_ref;
33248 }
33249
33250 void  CS_LDK_Logger_free(int64_t this_ptr) {
33251         if (!ptr_is_owned(this_ptr)) return;
33252         void* this_ptr_ptr = untag_ptr(this_ptr);
33253         CHECK_ACCESS(this_ptr_ptr);
33254         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
33255         FREE(untag_ptr(this_ptr));
33256         Logger_free(this_ptr_conv);
33257 }
33258
33259 void  CS_LDK_ChannelHandshakeConfig_free(int64_t this_obj) {
33260         LDKChannelHandshakeConfig this_obj_conv;
33261         this_obj_conv.inner = untag_ptr(this_obj);
33262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33264         ChannelHandshakeConfig_free(this_obj_conv);
33265 }
33266
33267 int32_t  CS_LDK_ChannelHandshakeConfig_get_minimum_depth(int64_t this_ptr) {
33268         LDKChannelHandshakeConfig this_ptr_conv;
33269         this_ptr_conv.inner = untag_ptr(this_ptr);
33270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33272         this_ptr_conv.is_owned = false;
33273         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
33274         return ret_conv;
33275 }
33276
33277 void  CS_LDK_ChannelHandshakeConfig_set_minimum_depth(int64_t this_ptr, int32_t val) {
33278         LDKChannelHandshakeConfig this_ptr_conv;
33279         this_ptr_conv.inner = untag_ptr(this_ptr);
33280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33282         this_ptr_conv.is_owned = false;
33283         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
33284 }
33285
33286 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_to_self_delay(int64_t this_ptr) {
33287         LDKChannelHandshakeConfig this_ptr_conv;
33288         this_ptr_conv.inner = untag_ptr(this_ptr);
33289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33291         this_ptr_conv.is_owned = false;
33292         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
33293         return ret_conv;
33294 }
33295
33296 void  CS_LDK_ChannelHandshakeConfig_set_our_to_self_delay(int64_t this_ptr, int16_t val) {
33297         LDKChannelHandshakeConfig this_ptr_conv;
33298         this_ptr_conv.inner = untag_ptr(this_ptr);
33299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33301         this_ptr_conv.is_owned = false;
33302         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
33303 }
33304
33305 int64_t  CS_LDK_ChannelHandshakeConfig_get_our_htlc_minimum_msat(int64_t this_ptr) {
33306         LDKChannelHandshakeConfig this_ptr_conv;
33307         this_ptr_conv.inner = untag_ptr(this_ptr);
33308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33310         this_ptr_conv.is_owned = false;
33311         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
33312         return ret_conv;
33313 }
33314
33315 void  CS_LDK_ChannelHandshakeConfig_set_our_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
33316         LDKChannelHandshakeConfig this_ptr_conv;
33317         this_ptr_conv.inner = untag_ptr(this_ptr);
33318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33320         this_ptr_conv.is_owned = false;
33321         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
33322 }
33323
33324 int8_t  CS_LDK_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr) {
33325         LDKChannelHandshakeConfig this_ptr_conv;
33326         this_ptr_conv.inner = untag_ptr(this_ptr);
33327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33329         this_ptr_conv.is_owned = false;
33330         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
33331         return ret_conv;
33332 }
33333
33334 void  CS_LDK_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr, int8_t val) {
33335         LDKChannelHandshakeConfig this_ptr_conv;
33336         this_ptr_conv.inner = untag_ptr(this_ptr);
33337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33339         this_ptr_conv.is_owned = false;
33340         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
33341 }
33342
33343 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_scid_privacy(int64_t this_ptr) {
33344         LDKChannelHandshakeConfig this_ptr_conv;
33345         this_ptr_conv.inner = untag_ptr(this_ptr);
33346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33348         this_ptr_conv.is_owned = false;
33349         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
33350         return ret_conv;
33351 }
33352
33353 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_scid_privacy(int64_t this_ptr, jboolean val) {
33354         LDKChannelHandshakeConfig this_ptr_conv;
33355         this_ptr_conv.inner = untag_ptr(this_ptr);
33356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33358         this_ptr_conv.is_owned = false;
33359         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
33360 }
33361
33362 jboolean  CS_LDK_ChannelHandshakeConfig_get_announced_channel(int64_t this_ptr) {
33363         LDKChannelHandshakeConfig this_ptr_conv;
33364         this_ptr_conv.inner = untag_ptr(this_ptr);
33365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33367         this_ptr_conv.is_owned = false;
33368         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
33369         return ret_conv;
33370 }
33371
33372 void  CS_LDK_ChannelHandshakeConfig_set_announced_channel(int64_t this_ptr, jboolean val) {
33373         LDKChannelHandshakeConfig this_ptr_conv;
33374         this_ptr_conv.inner = untag_ptr(this_ptr);
33375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33377         this_ptr_conv.is_owned = false;
33378         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
33379 }
33380
33381 jboolean  CS_LDK_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(int64_t this_ptr) {
33382         LDKChannelHandshakeConfig this_ptr_conv;
33383         this_ptr_conv.inner = untag_ptr(this_ptr);
33384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33386         this_ptr_conv.is_owned = false;
33387         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
33388         return ret_conv;
33389 }
33390
33391 void  CS_LDK_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(int64_t this_ptr, jboolean val) {
33392         LDKChannelHandshakeConfig this_ptr_conv;
33393         this_ptr_conv.inner = untag_ptr(this_ptr);
33394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33396         this_ptr_conv.is_owned = false;
33397         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
33398 }
33399
33400 int32_t  CS_LDK_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(int64_t this_ptr) {
33401         LDKChannelHandshakeConfig this_ptr_conv;
33402         this_ptr_conv.inner = untag_ptr(this_ptr);
33403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33405         this_ptr_conv.is_owned = false;
33406         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
33407         return ret_conv;
33408 }
33409
33410 void  CS_LDK_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(int64_t this_ptr, int32_t val) {
33411         LDKChannelHandshakeConfig this_ptr_conv;
33412         this_ptr_conv.inner = untag_ptr(this_ptr);
33413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33415         this_ptr_conv.is_owned = false;
33416         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
33417 }
33418
33419 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr) {
33420         LDKChannelHandshakeConfig this_ptr_conv;
33421         this_ptr_conv.inner = untag_ptr(this_ptr);
33422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33424         this_ptr_conv.is_owned = false;
33425         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
33426         return ret_conv;
33427 }
33428
33429 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr, jboolean val) {
33430         LDKChannelHandshakeConfig this_ptr_conv;
33431         this_ptr_conv.inner = untag_ptr(this_ptr);
33432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33434         this_ptr_conv.is_owned = false;
33435         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
33436 }
33437
33438 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_max_accepted_htlcs(int64_t this_ptr) {
33439         LDKChannelHandshakeConfig this_ptr_conv;
33440         this_ptr_conv.inner = untag_ptr(this_ptr);
33441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33443         this_ptr_conv.is_owned = false;
33444         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
33445         return ret_conv;
33446 }
33447
33448 void  CS_LDK_ChannelHandshakeConfig_set_our_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
33449         LDKChannelHandshakeConfig this_ptr_conv;
33450         this_ptr_conv.inner = untag_ptr(this_ptr);
33451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33453         this_ptr_conv.is_owned = false;
33454         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
33455 }
33456
33457 int64_t  CS_LDK_ChannelHandshakeConfig_new(int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int32_t their_channel_reserve_proportional_millionths_arg, jboolean negotiate_anchors_zero_fee_htlc_tx_arg, int16_t our_max_accepted_htlcs_arg) {
33458         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg, negotiate_anchors_zero_fee_htlc_tx_arg, our_max_accepted_htlcs_arg);
33459         int64_t ret_ref = 0;
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33462         return ret_ref;
33463 }
33464
33465 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
33466         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
33467         int64_t ret_ref = 0;
33468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33470         return ret_ref;
33471 }
33472 int64_t  CS_LDK_ChannelHandshakeConfig_clone_ptr(int64_t arg) {
33473         LDKChannelHandshakeConfig arg_conv;
33474         arg_conv.inner = untag_ptr(arg);
33475         arg_conv.is_owned = ptr_is_owned(arg);
33476         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33477         arg_conv.is_owned = false;
33478         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
33479         return ret_conv;
33480 }
33481
33482 int64_t  CS_LDK_ChannelHandshakeConfig_clone(int64_t orig) {
33483         LDKChannelHandshakeConfig orig_conv;
33484         orig_conv.inner = untag_ptr(orig);
33485         orig_conv.is_owned = ptr_is_owned(orig);
33486         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33487         orig_conv.is_owned = false;
33488         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
33489         int64_t ret_ref = 0;
33490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33492         return ret_ref;
33493 }
33494
33495 int64_t  CS_LDK_ChannelHandshakeConfig_default() {
33496         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
33497         int64_t ret_ref = 0;
33498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33500         return ret_ref;
33501 }
33502
33503 void  CS_LDK_ChannelHandshakeLimits_free(int64_t this_obj) {
33504         LDKChannelHandshakeLimits this_obj_conv;
33505         this_obj_conv.inner = untag_ptr(this_obj);
33506         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33508         ChannelHandshakeLimits_free(this_obj_conv);
33509 }
33510
33511 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_funding_satoshis(int64_t this_ptr) {
33512         LDKChannelHandshakeLimits this_ptr_conv;
33513         this_ptr_conv.inner = untag_ptr(this_ptr);
33514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33516         this_ptr_conv.is_owned = false;
33517         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
33518         return ret_conv;
33519 }
33520
33521 void  CS_LDK_ChannelHandshakeLimits_set_min_funding_satoshis(int64_t this_ptr, int64_t val) {
33522         LDKChannelHandshakeLimits this_ptr_conv;
33523         this_ptr_conv.inner = untag_ptr(this_ptr);
33524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33526         this_ptr_conv.is_owned = false;
33527         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
33528 }
33529
33530 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_funding_satoshis(int64_t this_ptr) {
33531         LDKChannelHandshakeLimits this_ptr_conv;
33532         this_ptr_conv.inner = untag_ptr(this_ptr);
33533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33535         this_ptr_conv.is_owned = false;
33536         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
33537         return ret_conv;
33538 }
33539
33540 void  CS_LDK_ChannelHandshakeLimits_set_max_funding_satoshis(int64_t this_ptr, int64_t val) {
33541         LDKChannelHandshakeLimits this_ptr_conv;
33542         this_ptr_conv.inner = untag_ptr(this_ptr);
33543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33545         this_ptr_conv.is_owned = false;
33546         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
33547 }
33548
33549 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_htlc_minimum_msat(int64_t this_ptr) {
33550         LDKChannelHandshakeLimits this_ptr_conv;
33551         this_ptr_conv.inner = untag_ptr(this_ptr);
33552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33554         this_ptr_conv.is_owned = false;
33555         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
33556         return ret_conv;
33557 }
33558
33559 void  CS_LDK_ChannelHandshakeLimits_set_max_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
33560         LDKChannelHandshakeLimits this_ptr_conv;
33561         this_ptr_conv.inner = untag_ptr(this_ptr);
33562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33564         this_ptr_conv.is_owned = false;
33565         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
33566 }
33567
33568 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(int64_t this_ptr) {
33569         LDKChannelHandshakeLimits this_ptr_conv;
33570         this_ptr_conv.inner = untag_ptr(this_ptr);
33571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33573         this_ptr_conv.is_owned = false;
33574         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
33575         return ret_conv;
33576 }
33577
33578 void  CS_LDK_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
33579         LDKChannelHandshakeLimits this_ptr_conv;
33580         this_ptr_conv.inner = untag_ptr(this_ptr);
33581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33583         this_ptr_conv.is_owned = false;
33584         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
33585 }
33586
33587 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(int64_t this_ptr) {
33588         LDKChannelHandshakeLimits this_ptr_conv;
33589         this_ptr_conv.inner = untag_ptr(this_ptr);
33590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33592         this_ptr_conv.is_owned = false;
33593         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
33594         return ret_conv;
33595 }
33596
33597 void  CS_LDK_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
33598         LDKChannelHandshakeLimits this_ptr_conv;
33599         this_ptr_conv.inner = untag_ptr(this_ptr);
33600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33602         this_ptr_conv.is_owned = false;
33603         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
33604 }
33605
33606 int16_t  CS_LDK_ChannelHandshakeLimits_get_min_max_accepted_htlcs(int64_t this_ptr) {
33607         LDKChannelHandshakeLimits this_ptr_conv;
33608         this_ptr_conv.inner = untag_ptr(this_ptr);
33609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33611         this_ptr_conv.is_owned = false;
33612         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
33613         return ret_conv;
33614 }
33615
33616 void  CS_LDK_ChannelHandshakeLimits_set_min_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
33617         LDKChannelHandshakeLimits this_ptr_conv;
33618         this_ptr_conv.inner = untag_ptr(this_ptr);
33619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33621         this_ptr_conv.is_owned = false;
33622         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
33623 }
33624
33625 int32_t  CS_LDK_ChannelHandshakeLimits_get_max_minimum_depth(int64_t this_ptr) {
33626         LDKChannelHandshakeLimits this_ptr_conv;
33627         this_ptr_conv.inner = untag_ptr(this_ptr);
33628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33630         this_ptr_conv.is_owned = false;
33631         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
33632         return ret_conv;
33633 }
33634
33635 void  CS_LDK_ChannelHandshakeLimits_set_max_minimum_depth(int64_t this_ptr, int32_t val) {
33636         LDKChannelHandshakeLimits this_ptr_conv;
33637         this_ptr_conv.inner = untag_ptr(this_ptr);
33638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33640         this_ptr_conv.is_owned = false;
33641         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
33642 }
33643
33644 jboolean  CS_LDK_ChannelHandshakeLimits_get_trust_own_funding_0conf(int64_t this_ptr) {
33645         LDKChannelHandshakeLimits this_ptr_conv;
33646         this_ptr_conv.inner = untag_ptr(this_ptr);
33647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33649         this_ptr_conv.is_owned = false;
33650         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
33651         return ret_conv;
33652 }
33653
33654 void  CS_LDK_ChannelHandshakeLimits_set_trust_own_funding_0conf(int64_t this_ptr, jboolean val) {
33655         LDKChannelHandshakeLimits this_ptr_conv;
33656         this_ptr_conv.inner = untag_ptr(this_ptr);
33657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33659         this_ptr_conv.is_owned = false;
33660         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
33661 }
33662
33663 jboolean  CS_LDK_ChannelHandshakeLimits_get_force_announced_channel_preference(int64_t this_ptr) {
33664         LDKChannelHandshakeLimits this_ptr_conv;
33665         this_ptr_conv.inner = untag_ptr(this_ptr);
33666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33668         this_ptr_conv.is_owned = false;
33669         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
33670         return ret_conv;
33671 }
33672
33673 void  CS_LDK_ChannelHandshakeLimits_set_force_announced_channel_preference(int64_t this_ptr, jboolean val) {
33674         LDKChannelHandshakeLimits this_ptr_conv;
33675         this_ptr_conv.inner = untag_ptr(this_ptr);
33676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33678         this_ptr_conv.is_owned = false;
33679         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
33680 }
33681
33682 int16_t  CS_LDK_ChannelHandshakeLimits_get_their_to_self_delay(int64_t this_ptr) {
33683         LDKChannelHandshakeLimits this_ptr_conv;
33684         this_ptr_conv.inner = untag_ptr(this_ptr);
33685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33687         this_ptr_conv.is_owned = false;
33688         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
33689         return ret_conv;
33690 }
33691
33692 void  CS_LDK_ChannelHandshakeLimits_set_their_to_self_delay(int64_t this_ptr, int16_t val) {
33693         LDKChannelHandshakeLimits this_ptr_conv;
33694         this_ptr_conv.inner = untag_ptr(this_ptr);
33695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33697         this_ptr_conv.is_owned = false;
33698         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
33699 }
33700
33701 int64_t  CS_LDK_ChannelHandshakeLimits_new(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) {
33702         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);
33703         int64_t ret_ref = 0;
33704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33706         return ret_ref;
33707 }
33708
33709 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
33710         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
33711         int64_t ret_ref = 0;
33712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33714         return ret_ref;
33715 }
33716 int64_t  CS_LDK_ChannelHandshakeLimits_clone_ptr(int64_t arg) {
33717         LDKChannelHandshakeLimits arg_conv;
33718         arg_conv.inner = untag_ptr(arg);
33719         arg_conv.is_owned = ptr_is_owned(arg);
33720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33721         arg_conv.is_owned = false;
33722         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
33723         return ret_conv;
33724 }
33725
33726 int64_t  CS_LDK_ChannelHandshakeLimits_clone(int64_t orig) {
33727         LDKChannelHandshakeLimits orig_conv;
33728         orig_conv.inner = untag_ptr(orig);
33729         orig_conv.is_owned = ptr_is_owned(orig);
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33731         orig_conv.is_owned = false;
33732         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
33733         int64_t ret_ref = 0;
33734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33736         return ret_ref;
33737 }
33738
33739 int64_t  CS_LDK_ChannelHandshakeLimits_default() {
33740         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
33741         int64_t ret_ref = 0;
33742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33744         return ret_ref;
33745 }
33746
33747 void  CS_LDK_MaxDustHTLCExposure_free(int64_t this_ptr) {
33748         if (!ptr_is_owned(this_ptr)) return;
33749         void* this_ptr_ptr = untag_ptr(this_ptr);
33750         CHECK_ACCESS(this_ptr_ptr);
33751         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
33752         FREE(untag_ptr(this_ptr));
33753         MaxDustHTLCExposure_free(this_ptr_conv);
33754 }
33755
33756 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
33757         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33758         *ret_copy = MaxDustHTLCExposure_clone(arg);
33759         int64_t ret_ref = tag_ptr(ret_copy, true);
33760         return ret_ref;
33761 }
33762 int64_t  CS_LDK_MaxDustHTLCExposure_clone_ptr(int64_t arg) {
33763         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
33764         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
33765         return ret_conv;
33766 }
33767
33768 int64_t  CS_LDK_MaxDustHTLCExposure_clone(int64_t orig) {
33769         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
33770         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33771         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
33772         int64_t ret_ref = tag_ptr(ret_copy, true);
33773         return ret_ref;
33774 }
33775
33776 int64_t  CS_LDK_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
33777         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33778         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
33779         int64_t ret_ref = tag_ptr(ret_copy, true);
33780         return ret_ref;
33781 }
33782
33783 int64_t  CS_LDK_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
33784         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33785         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
33786         int64_t ret_ref = tag_ptr(ret_copy, true);
33787         return ret_ref;
33788 }
33789
33790 jboolean  CS_LDK_MaxDustHTLCExposure_eq(int64_t a, int64_t b) {
33791         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
33792         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
33793         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
33794         return ret_conv;
33795 }
33796
33797 int8_tArray  CS_LDK_MaxDustHTLCExposure_write(int64_t obj) {
33798         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
33799         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
33800         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33801         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33802         CVec_u8Z_free(ret_var);
33803         return ret_arr;
33804 }
33805
33806 int64_t  CS_LDK_MaxDustHTLCExposure_read(int8_tArray ser) {
33807         LDKu8slice ser_ref;
33808         ser_ref.datalen = ser->arr_len;
33809         ser_ref.data = ser->elems;
33810         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
33811         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
33812         FREE(ser);
33813         return tag_ptr(ret_conv, true);
33814 }
33815
33816 void  CS_LDK_ChannelConfig_free(int64_t this_obj) {
33817         LDKChannelConfig this_obj_conv;
33818         this_obj_conv.inner = untag_ptr(this_obj);
33819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33821         ChannelConfig_free(this_obj_conv);
33822 }
33823
33824 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
33825         LDKChannelConfig this_ptr_conv;
33826         this_ptr_conv.inner = untag_ptr(this_ptr);
33827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33829         this_ptr_conv.is_owned = false;
33830         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
33831         return ret_conv;
33832 }
33833
33834 void  CS_LDK_ChannelConfig_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
33835         LDKChannelConfig this_ptr_conv;
33836         this_ptr_conv.inner = untag_ptr(this_ptr);
33837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33839         this_ptr_conv.is_owned = false;
33840         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
33841 }
33842
33843 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_base_msat(int64_t this_ptr) {
33844         LDKChannelConfig this_ptr_conv;
33845         this_ptr_conv.inner = untag_ptr(this_ptr);
33846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33848         this_ptr_conv.is_owned = false;
33849         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
33850         return ret_conv;
33851 }
33852
33853 void  CS_LDK_ChannelConfig_set_forwarding_fee_base_msat(int64_t this_ptr, int32_t val) {
33854         LDKChannelConfig this_ptr_conv;
33855         this_ptr_conv.inner = untag_ptr(this_ptr);
33856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33858         this_ptr_conv.is_owned = false;
33859         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
33860 }
33861
33862 int16_t  CS_LDK_ChannelConfig_get_cltv_expiry_delta(int64_t this_ptr) {
33863         LDKChannelConfig this_ptr_conv;
33864         this_ptr_conv.inner = untag_ptr(this_ptr);
33865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33867         this_ptr_conv.is_owned = false;
33868         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
33869         return ret_conv;
33870 }
33871
33872 void  CS_LDK_ChannelConfig_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
33873         LDKChannelConfig this_ptr_conv;
33874         this_ptr_conv.inner = untag_ptr(this_ptr);
33875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33877         this_ptr_conv.is_owned = false;
33878         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
33879 }
33880
33881 int64_t  CS_LDK_ChannelConfig_get_max_dust_htlc_exposure(int64_t this_ptr) {
33882         LDKChannelConfig this_ptr_conv;
33883         this_ptr_conv.inner = untag_ptr(this_ptr);
33884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33886         this_ptr_conv.is_owned = false;
33887         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33888         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
33889         int64_t ret_ref = tag_ptr(ret_copy, true);
33890         return ret_ref;
33891 }
33892
33893 void  CS_LDK_ChannelConfig_set_max_dust_htlc_exposure(int64_t this_ptr, int64_t val) {
33894         LDKChannelConfig this_ptr_conv;
33895         this_ptr_conv.inner = untag_ptr(this_ptr);
33896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33898         this_ptr_conv.is_owned = false;
33899         void* val_ptr = untag_ptr(val);
33900         CHECK_ACCESS(val_ptr);
33901         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
33902         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
33903         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
33904 }
33905
33906 int64_t  CS_LDK_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
33907         LDKChannelConfig this_ptr_conv;
33908         this_ptr_conv.inner = untag_ptr(this_ptr);
33909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33911         this_ptr_conv.is_owned = false;
33912         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
33913         return ret_conv;
33914 }
33915
33916 void  CS_LDK_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
33917         LDKChannelConfig this_ptr_conv;
33918         this_ptr_conv.inner = untag_ptr(this_ptr);
33919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33921         this_ptr_conv.is_owned = false;
33922         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
33923 }
33924
33925 jboolean  CS_LDK_ChannelConfig_get_accept_underpaying_htlcs(int64_t this_ptr) {
33926         LDKChannelConfig this_ptr_conv;
33927         this_ptr_conv.inner = untag_ptr(this_ptr);
33928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33930         this_ptr_conv.is_owned = false;
33931         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
33932         return ret_conv;
33933 }
33934
33935 void  CS_LDK_ChannelConfig_set_accept_underpaying_htlcs(int64_t this_ptr, jboolean val) {
33936         LDKChannelConfig this_ptr_conv;
33937         this_ptr_conv.inner = untag_ptr(this_ptr);
33938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33940         this_ptr_conv.is_owned = false;
33941         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
33942 }
33943
33944 int64_t  CS_LDK_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_arg, int64_t force_close_avoidance_max_fee_satoshis_arg, jboolean accept_underpaying_htlcs_arg) {
33945         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
33946         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
33947         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
33948         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
33949         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_arg_conv, force_close_avoidance_max_fee_satoshis_arg, accept_underpaying_htlcs_arg);
33950         int64_t ret_ref = 0;
33951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33953         return ret_ref;
33954 }
33955
33956 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
33957         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
33958         int64_t ret_ref = 0;
33959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33961         return ret_ref;
33962 }
33963 int64_t  CS_LDK_ChannelConfig_clone_ptr(int64_t arg) {
33964         LDKChannelConfig arg_conv;
33965         arg_conv.inner = untag_ptr(arg);
33966         arg_conv.is_owned = ptr_is_owned(arg);
33967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33968         arg_conv.is_owned = false;
33969         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
33970         return ret_conv;
33971 }
33972
33973 int64_t  CS_LDK_ChannelConfig_clone(int64_t orig) {
33974         LDKChannelConfig orig_conv;
33975         orig_conv.inner = untag_ptr(orig);
33976         orig_conv.is_owned = ptr_is_owned(orig);
33977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33978         orig_conv.is_owned = false;
33979         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
33980         int64_t ret_ref = 0;
33981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33983         return ret_ref;
33984 }
33985
33986 jboolean  CS_LDK_ChannelConfig_eq(int64_t a, int64_t b) {
33987         LDKChannelConfig a_conv;
33988         a_conv.inner = untag_ptr(a);
33989         a_conv.is_owned = ptr_is_owned(a);
33990         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33991         a_conv.is_owned = false;
33992         LDKChannelConfig b_conv;
33993         b_conv.inner = untag_ptr(b);
33994         b_conv.is_owned = ptr_is_owned(b);
33995         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33996         b_conv.is_owned = false;
33997         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
33998         return ret_conv;
33999 }
34000
34001 void  CS_LDK_ChannelConfig_apply(int64_t this_arg, int64_t update) {
34002         LDKChannelConfig this_arg_conv;
34003         this_arg_conv.inner = untag_ptr(this_arg);
34004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34006         this_arg_conv.is_owned = false;
34007         LDKChannelConfigUpdate update_conv;
34008         update_conv.inner = untag_ptr(update);
34009         update_conv.is_owned = ptr_is_owned(update);
34010         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
34011         update_conv.is_owned = false;
34012         ChannelConfig_apply(&this_arg_conv, &update_conv);
34013 }
34014
34015 int64_t  CS_LDK_ChannelConfig_default() {
34016         LDKChannelConfig ret_var = ChannelConfig_default();
34017         int64_t ret_ref = 0;
34018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34020         return ret_ref;
34021 }
34022
34023 int8_tArray  CS_LDK_ChannelConfig_write(int64_t obj) {
34024         LDKChannelConfig obj_conv;
34025         obj_conv.inner = untag_ptr(obj);
34026         obj_conv.is_owned = ptr_is_owned(obj);
34027         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34028         obj_conv.is_owned = false;
34029         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
34030         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34031         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34032         CVec_u8Z_free(ret_var);
34033         return ret_arr;
34034 }
34035
34036 int64_t  CS_LDK_ChannelConfig_read(int8_tArray ser) {
34037         LDKu8slice ser_ref;
34038         ser_ref.datalen = ser->arr_len;
34039         ser_ref.data = ser->elems;
34040         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
34041         *ret_conv = ChannelConfig_read(ser_ref);
34042         FREE(ser);
34043         return tag_ptr(ret_conv, true);
34044 }
34045
34046 void  CS_LDK_ChannelConfigUpdate_free(int64_t this_obj) {
34047         LDKChannelConfigUpdate this_obj_conv;
34048         this_obj_conv.inner = untag_ptr(this_obj);
34049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34051         ChannelConfigUpdate_free(this_obj_conv);
34052 }
34053
34054 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
34055         LDKChannelConfigUpdate this_ptr_conv;
34056         this_ptr_conv.inner = untag_ptr(this_ptr);
34057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34059         this_ptr_conv.is_owned = false;
34060         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34061         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
34062         int64_t ret_ref = tag_ptr(ret_copy, true);
34063         return ret_ref;
34064 }
34065
34066 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int64_t val) {
34067         LDKChannelConfigUpdate this_ptr_conv;
34068         this_ptr_conv.inner = untag_ptr(this_ptr);
34069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34071         this_ptr_conv.is_owned = false;
34072         void* val_ptr = untag_ptr(val);
34073         CHECK_ACCESS(val_ptr);
34074         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34075         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34076         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
34077 }
34078
34079 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_base_msat(int64_t this_ptr) {
34080         LDKChannelConfigUpdate this_ptr_conv;
34081         this_ptr_conv.inner = untag_ptr(this_ptr);
34082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34084         this_ptr_conv.is_owned = false;
34085         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34086         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
34087         int64_t ret_ref = tag_ptr(ret_copy, true);
34088         return ret_ref;
34089 }
34090
34091 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_base_msat(int64_t this_ptr, int64_t val) {
34092         LDKChannelConfigUpdate this_ptr_conv;
34093         this_ptr_conv.inner = untag_ptr(this_ptr);
34094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34096         this_ptr_conv.is_owned = false;
34097         void* val_ptr = untag_ptr(val);
34098         CHECK_ACCESS(val_ptr);
34099         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34100         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34101         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
34102 }
34103
34104 int64_t  CS_LDK_ChannelConfigUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
34105         LDKChannelConfigUpdate this_ptr_conv;
34106         this_ptr_conv.inner = untag_ptr(this_ptr);
34107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34109         this_ptr_conv.is_owned = false;
34110         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34111         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34112         int64_t ret_ref = tag_ptr(ret_copy, true);
34113         return ret_ref;
34114 }
34115
34116 void  CS_LDK_ChannelConfigUpdate_set_cltv_expiry_delta(int64_t this_ptr, int64_t val) {
34117         LDKChannelConfigUpdate this_ptr_conv;
34118         this_ptr_conv.inner = untag_ptr(this_ptr);
34119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34121         this_ptr_conv.is_owned = false;
34122         void* val_ptr = untag_ptr(val);
34123         CHECK_ACCESS(val_ptr);
34124         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34125         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34126         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
34127 }
34128
34129 int64_t  CS_LDK_ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(int64_t this_ptr) {
34130         LDKChannelConfigUpdate this_ptr_conv;
34131         this_ptr_conv.inner = untag_ptr(this_ptr);
34132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34134         this_ptr_conv.is_owned = false;
34135         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
34136         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
34137         int64_t ret_ref = tag_ptr(ret_copy, true);
34138         return ret_ref;
34139 }
34140
34141 void  CS_LDK_ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(int64_t this_ptr, int64_t val) {
34142         LDKChannelConfigUpdate this_ptr_conv;
34143         this_ptr_conv.inner = untag_ptr(this_ptr);
34144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34146         this_ptr_conv.is_owned = false;
34147         void* val_ptr = untag_ptr(val);
34148         CHECK_ACCESS(val_ptr);
34149         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
34150         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
34151         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
34152 }
34153
34154 int64_t  CS_LDK_ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
34155         LDKChannelConfigUpdate 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34161         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
34162         int64_t ret_ref = tag_ptr(ret_copy, true);
34163         return ret_ref;
34164 }
34165
34166 void  CS_LDK_ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
34167         LDKChannelConfigUpdate this_ptr_conv;
34168         this_ptr_conv.inner = untag_ptr(this_ptr);
34169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34171         this_ptr_conv.is_owned = false;
34172         void* val_ptr = untag_ptr(val);
34173         CHECK_ACCESS(val_ptr);
34174         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34175         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34176         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
34177 }
34178
34179 int64_t  CS_LDK_ChannelConfigUpdate_new(int64_t forwarding_fee_proportional_millionths_arg, int64_t forwarding_fee_base_msat_arg, int64_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
34180         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
34181         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
34182         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
34183         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
34184         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
34185         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
34186         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
34187         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
34188         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
34189         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
34190         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
34191         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
34192         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
34193         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
34194         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
34195         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
34196         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
34197         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
34198         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
34199         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
34200         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_new(forwarding_fee_proportional_millionths_arg_conv, forwarding_fee_base_msat_arg_conv, cltv_expiry_delta_arg_conv, max_dust_htlc_exposure_msat_arg_conv, force_close_avoidance_max_fee_satoshis_arg_conv);
34201         int64_t ret_ref = 0;
34202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34204         return ret_ref;
34205 }
34206
34207 int64_t  CS_LDK_ChannelConfigUpdate_default() {
34208         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
34209         int64_t ret_ref = 0;
34210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34212         return ret_ref;
34213 }
34214
34215 void  CS_LDK_UserConfig_free(int64_t this_obj) {
34216         LDKUserConfig this_obj_conv;
34217         this_obj_conv.inner = untag_ptr(this_obj);
34218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34220         UserConfig_free(this_obj_conv);
34221 }
34222
34223 int64_t  CS_LDK_UserConfig_get_channel_handshake_config(int64_t this_ptr) {
34224         LDKUserConfig this_ptr_conv;
34225         this_ptr_conv.inner = untag_ptr(this_ptr);
34226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34228         this_ptr_conv.is_owned = false;
34229         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
34230         int64_t ret_ref = 0;
34231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34233         return ret_ref;
34234 }
34235
34236 void  CS_LDK_UserConfig_set_channel_handshake_config(int64_t this_ptr, int64_t val) {
34237         LDKUserConfig this_ptr_conv;
34238         this_ptr_conv.inner = untag_ptr(this_ptr);
34239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34241         this_ptr_conv.is_owned = false;
34242         LDKChannelHandshakeConfig val_conv;
34243         val_conv.inner = untag_ptr(val);
34244         val_conv.is_owned = ptr_is_owned(val);
34245         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34246         val_conv = ChannelHandshakeConfig_clone(&val_conv);
34247         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
34248 }
34249
34250 int64_t  CS_LDK_UserConfig_get_channel_handshake_limits(int64_t this_ptr) {
34251         LDKUserConfig this_ptr_conv;
34252         this_ptr_conv.inner = untag_ptr(this_ptr);
34253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34255         this_ptr_conv.is_owned = false;
34256         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
34257         int64_t ret_ref = 0;
34258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34260         return ret_ref;
34261 }
34262
34263 void  CS_LDK_UserConfig_set_channel_handshake_limits(int64_t this_ptr, int64_t val) {
34264         LDKUserConfig this_ptr_conv;
34265         this_ptr_conv.inner = untag_ptr(this_ptr);
34266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34268         this_ptr_conv.is_owned = false;
34269         LDKChannelHandshakeLimits val_conv;
34270         val_conv.inner = untag_ptr(val);
34271         val_conv.is_owned = ptr_is_owned(val);
34272         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34273         val_conv = ChannelHandshakeLimits_clone(&val_conv);
34274         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
34275 }
34276
34277 int64_t  CS_LDK_UserConfig_get_channel_config(int64_t this_ptr) {
34278         LDKUserConfig this_ptr_conv;
34279         this_ptr_conv.inner = untag_ptr(this_ptr);
34280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34282         this_ptr_conv.is_owned = false;
34283         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
34284         int64_t ret_ref = 0;
34285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34287         return ret_ref;
34288 }
34289
34290 void  CS_LDK_UserConfig_set_channel_config(int64_t this_ptr, int64_t val) {
34291         LDKUserConfig this_ptr_conv;
34292         this_ptr_conv.inner = untag_ptr(this_ptr);
34293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34295         this_ptr_conv.is_owned = false;
34296         LDKChannelConfig val_conv;
34297         val_conv.inner = untag_ptr(val);
34298         val_conv.is_owned = ptr_is_owned(val);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34300         val_conv = ChannelConfig_clone(&val_conv);
34301         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
34302 }
34303
34304 jboolean  CS_LDK_UserConfig_get_accept_forwards_to_priv_channels(int64_t this_ptr) {
34305         LDKUserConfig this_ptr_conv;
34306         this_ptr_conv.inner = untag_ptr(this_ptr);
34307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34309         this_ptr_conv.is_owned = false;
34310         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
34311         return ret_conv;
34312 }
34313
34314 void  CS_LDK_UserConfig_set_accept_forwards_to_priv_channels(int64_t this_ptr, jboolean val) {
34315         LDKUserConfig this_ptr_conv;
34316         this_ptr_conv.inner = untag_ptr(this_ptr);
34317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34319         this_ptr_conv.is_owned = false;
34320         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
34321 }
34322
34323 jboolean  CS_LDK_UserConfig_get_accept_inbound_channels(int64_t this_ptr) {
34324         LDKUserConfig this_ptr_conv;
34325         this_ptr_conv.inner = untag_ptr(this_ptr);
34326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34328         this_ptr_conv.is_owned = false;
34329         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
34330         return ret_conv;
34331 }
34332
34333 void  CS_LDK_UserConfig_set_accept_inbound_channels(int64_t this_ptr, jboolean val) {
34334         LDKUserConfig this_ptr_conv;
34335         this_ptr_conv.inner = untag_ptr(this_ptr);
34336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34338         this_ptr_conv.is_owned = false;
34339         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
34340 }
34341
34342 jboolean  CS_LDK_UserConfig_get_manually_accept_inbound_channels(int64_t this_ptr) {
34343         LDKUserConfig this_ptr_conv;
34344         this_ptr_conv.inner = untag_ptr(this_ptr);
34345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34347         this_ptr_conv.is_owned = false;
34348         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
34349         return ret_conv;
34350 }
34351
34352 void  CS_LDK_UserConfig_set_manually_accept_inbound_channels(int64_t this_ptr, jboolean val) {
34353         LDKUserConfig this_ptr_conv;
34354         this_ptr_conv.inner = untag_ptr(this_ptr);
34355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34357         this_ptr_conv.is_owned = false;
34358         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
34359 }
34360
34361 jboolean  CS_LDK_UserConfig_get_accept_intercept_htlcs(int64_t this_ptr) {
34362         LDKUserConfig this_ptr_conv;
34363         this_ptr_conv.inner = untag_ptr(this_ptr);
34364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34366         this_ptr_conv.is_owned = false;
34367         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
34368         return ret_conv;
34369 }
34370
34371 void  CS_LDK_UserConfig_set_accept_intercept_htlcs(int64_t this_ptr, jboolean val) {
34372         LDKUserConfig this_ptr_conv;
34373         this_ptr_conv.inner = untag_ptr(this_ptr);
34374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34376         this_ptr_conv.is_owned = false;
34377         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
34378 }
34379
34380 jboolean  CS_LDK_UserConfig_get_accept_mpp_keysend(int64_t this_ptr) {
34381         LDKUserConfig this_ptr_conv;
34382         this_ptr_conv.inner = untag_ptr(this_ptr);
34383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34385         this_ptr_conv.is_owned = false;
34386         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
34387         return ret_conv;
34388 }
34389
34390 void  CS_LDK_UserConfig_set_accept_mpp_keysend(int64_t this_ptr, jboolean val) {
34391         LDKUserConfig this_ptr_conv;
34392         this_ptr_conv.inner = untag_ptr(this_ptr);
34393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34395         this_ptr_conv.is_owned = false;
34396         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
34397 }
34398
34399 int64_t  CS_LDK_UserConfig_new(int64_t channel_handshake_config_arg, int64_t channel_handshake_limits_arg, int64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg, jboolean accept_intercept_htlcs_arg, jboolean accept_mpp_keysend_arg) {
34400         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
34401         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
34402         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
34403         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
34404         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
34405         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
34406         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
34407         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
34408         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
34409         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
34410         LDKChannelConfig channel_config_arg_conv;
34411         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
34412         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
34413         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
34414         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
34415         LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg, accept_mpp_keysend_arg);
34416         int64_t ret_ref = 0;
34417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34419         return ret_ref;
34420 }
34421
34422 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
34423         LDKUserConfig ret_var = UserConfig_clone(arg);
34424         int64_t ret_ref = 0;
34425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34427         return ret_ref;
34428 }
34429 int64_t  CS_LDK_UserConfig_clone_ptr(int64_t arg) {
34430         LDKUserConfig arg_conv;
34431         arg_conv.inner = untag_ptr(arg);
34432         arg_conv.is_owned = ptr_is_owned(arg);
34433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34434         arg_conv.is_owned = false;
34435         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
34436         return ret_conv;
34437 }
34438
34439 int64_t  CS_LDK_UserConfig_clone(int64_t orig) {
34440         LDKUserConfig orig_conv;
34441         orig_conv.inner = untag_ptr(orig);
34442         orig_conv.is_owned = ptr_is_owned(orig);
34443         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34444         orig_conv.is_owned = false;
34445         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
34446         int64_t ret_ref = 0;
34447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34449         return ret_ref;
34450 }
34451
34452 int64_t  CS_LDK_UserConfig_default() {
34453         LDKUserConfig ret_var = UserConfig_default();
34454         int64_t ret_ref = 0;
34455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34457         return ret_ref;
34458 }
34459
34460 void  CS_LDK_BestBlock_free(int64_t this_obj) {
34461         LDKBestBlock this_obj_conv;
34462         this_obj_conv.inner = untag_ptr(this_obj);
34463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34465         BestBlock_free(this_obj_conv);
34466 }
34467
34468 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
34469         LDKBestBlock ret_var = BestBlock_clone(arg);
34470         int64_t ret_ref = 0;
34471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34473         return ret_ref;
34474 }
34475 int64_t  CS_LDK_BestBlock_clone_ptr(int64_t arg) {
34476         LDKBestBlock arg_conv;
34477         arg_conv.inner = untag_ptr(arg);
34478         arg_conv.is_owned = ptr_is_owned(arg);
34479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34480         arg_conv.is_owned = false;
34481         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
34482         return ret_conv;
34483 }
34484
34485 int64_t  CS_LDK_BestBlock_clone(int64_t orig) {
34486         LDKBestBlock orig_conv;
34487         orig_conv.inner = untag_ptr(orig);
34488         orig_conv.is_owned = ptr_is_owned(orig);
34489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34490         orig_conv.is_owned = false;
34491         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
34492         int64_t ret_ref = 0;
34493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34495         return ret_ref;
34496 }
34497
34498 jboolean  CS_LDK_BestBlock_eq(int64_t a, int64_t b) {
34499         LDKBestBlock a_conv;
34500         a_conv.inner = untag_ptr(a);
34501         a_conv.is_owned = ptr_is_owned(a);
34502         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34503         a_conv.is_owned = false;
34504         LDKBestBlock b_conv;
34505         b_conv.inner = untag_ptr(b);
34506         b_conv.is_owned = ptr_is_owned(b);
34507         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34508         b_conv.is_owned = false;
34509         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
34510         return ret_conv;
34511 }
34512
34513 int64_t  CS_LDK_BestBlock_from_network(int32_t network) {
34514         LDKNetwork network_conv = LDKNetwork_from_cs(network);
34515         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
34516         int64_t ret_ref = 0;
34517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34519         return ret_ref;
34520 }
34521
34522 int64_t  CS_LDK_BestBlock_new(int8_tArray block_hash, int32_t height) {
34523         LDKThirtyTwoBytes block_hash_ref;
34524         CHECK(block_hash->arr_len == 32);
34525         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
34526         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
34527         int64_t ret_ref = 0;
34528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34530         return ret_ref;
34531 }
34532
34533 int8_tArray  CS_LDK_BestBlock_block_hash(int64_t this_arg) {
34534         LDKBestBlock this_arg_conv;
34535         this_arg_conv.inner = untag_ptr(this_arg);
34536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34538         this_arg_conv.is_owned = false;
34539         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34540         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
34541         return ret_arr;
34542 }
34543
34544 int32_t  CS_LDK_BestBlock_height(int64_t this_arg) {
34545         LDKBestBlock this_arg_conv;
34546         this_arg_conv.inner = untag_ptr(this_arg);
34547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34549         this_arg_conv.is_owned = false;
34550         int32_t ret_conv = BestBlock_height(&this_arg_conv);
34551         return ret_conv;
34552 }
34553
34554 void  CS_LDK_Listen_free(int64_t this_ptr) {
34555         if (!ptr_is_owned(this_ptr)) return;
34556         void* this_ptr_ptr = untag_ptr(this_ptr);
34557         CHECK_ACCESS(this_ptr_ptr);
34558         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
34559         FREE(untag_ptr(this_ptr));
34560         Listen_free(this_ptr_conv);
34561 }
34562
34563 void  CS_LDK_Confirm_free(int64_t this_ptr) {
34564         if (!ptr_is_owned(this_ptr)) return;
34565         void* this_ptr_ptr = untag_ptr(this_ptr);
34566         CHECK_ACCESS(this_ptr_ptr);
34567         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
34568         FREE(untag_ptr(this_ptr));
34569         Confirm_free(this_ptr_conv);
34570 }
34571
34572 int32_t  CS_LDK_ChannelMonitorUpdateStatus_clone(int64_t orig) {
34573         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
34574         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_clone(orig_conv));
34575         return ret_conv;
34576 }
34577
34578 int32_t  CS_LDK_ChannelMonitorUpdateStatus_completed() {
34579         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_completed());
34580         return ret_conv;
34581 }
34582
34583 int32_t  CS_LDK_ChannelMonitorUpdateStatus_in_progress() {
34584         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_in_progress());
34585         return ret_conv;
34586 }
34587
34588 int32_t  CS_LDK_ChannelMonitorUpdateStatus_unrecoverable_error() {
34589         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_unrecoverable_error());
34590         return ret_conv;
34591 }
34592
34593 jboolean  CS_LDK_ChannelMonitorUpdateStatus_eq(int64_t a, int64_t b) {
34594         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
34595         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
34596         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
34597         return ret_conv;
34598 }
34599
34600 void  CS_LDK_Watch_free(int64_t this_ptr) {
34601         if (!ptr_is_owned(this_ptr)) return;
34602         void* this_ptr_ptr = untag_ptr(this_ptr);
34603         CHECK_ACCESS(this_ptr_ptr);
34604         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
34605         FREE(untag_ptr(this_ptr));
34606         Watch_free(this_ptr_conv);
34607 }
34608
34609 void  CS_LDK_Filter_free(int64_t this_ptr) {
34610         if (!ptr_is_owned(this_ptr)) return;
34611         void* this_ptr_ptr = untag_ptr(this_ptr);
34612         CHECK_ACCESS(this_ptr_ptr);
34613         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
34614         FREE(untag_ptr(this_ptr));
34615         Filter_free(this_ptr_conv);
34616 }
34617
34618 void  CS_LDK_WatchedOutput_free(int64_t this_obj) {
34619         LDKWatchedOutput this_obj_conv;
34620         this_obj_conv.inner = untag_ptr(this_obj);
34621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34623         WatchedOutput_free(this_obj_conv);
34624 }
34625
34626 int64_t  CS_LDK_WatchedOutput_get_block_hash(int64_t this_ptr) {
34627         LDKWatchedOutput this_ptr_conv;
34628         this_ptr_conv.inner = untag_ptr(this_ptr);
34629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34631         this_ptr_conv.is_owned = false;
34632         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
34633         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
34634         int64_t ret_ref = tag_ptr(ret_copy, true);
34635         return ret_ref;
34636 }
34637
34638 void  CS_LDK_WatchedOutput_set_block_hash(int64_t this_ptr, int64_t val) {
34639         LDKWatchedOutput this_ptr_conv;
34640         this_ptr_conv.inner = untag_ptr(this_ptr);
34641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34643         this_ptr_conv.is_owned = false;
34644         void* val_ptr = untag_ptr(val);
34645         CHECK_ACCESS(val_ptr);
34646         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
34647         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
34648         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
34649 }
34650
34651 int64_t  CS_LDK_WatchedOutput_get_outpoint(int64_t this_ptr) {
34652         LDKWatchedOutput this_ptr_conv;
34653         this_ptr_conv.inner = untag_ptr(this_ptr);
34654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34656         this_ptr_conv.is_owned = false;
34657         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
34658         int64_t ret_ref = 0;
34659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34661         return ret_ref;
34662 }
34663
34664 void  CS_LDK_WatchedOutput_set_outpoint(int64_t this_ptr, int64_t val) {
34665         LDKWatchedOutput this_ptr_conv;
34666         this_ptr_conv.inner = untag_ptr(this_ptr);
34667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34669         this_ptr_conv.is_owned = false;
34670         LDKOutPoint val_conv;
34671         val_conv.inner = untag_ptr(val);
34672         val_conv.is_owned = ptr_is_owned(val);
34673         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34674         val_conv = OutPoint_clone(&val_conv);
34675         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
34676 }
34677
34678 int8_tArray  CS_LDK_WatchedOutput_get_script_pubkey(int64_t this_ptr) {
34679         LDKWatchedOutput this_ptr_conv;
34680         this_ptr_conv.inner = untag_ptr(this_ptr);
34681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34683         this_ptr_conv.is_owned = false;
34684         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
34685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34687         CVec_u8Z_free(ret_var);
34688         return ret_arr;
34689 }
34690
34691 void  CS_LDK_WatchedOutput_set_script_pubkey(int64_t this_ptr, int8_tArray val) {
34692         LDKWatchedOutput this_ptr_conv;
34693         this_ptr_conv.inner = untag_ptr(this_ptr);
34694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34696         this_ptr_conv.is_owned = false;
34697         LDKCVec_u8Z val_ref;
34698         val_ref.datalen = val->arr_len;
34699         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34700         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34701         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
34702 }
34703
34704 int64_t  CS_LDK_WatchedOutput_new(int64_t block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
34705         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
34706         CHECK_ACCESS(block_hash_arg_ptr);
34707         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
34708         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
34709         LDKOutPoint outpoint_arg_conv;
34710         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
34711         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
34712         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
34713         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
34714         LDKCVec_u8Z script_pubkey_arg_ref;
34715         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
34716         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34717         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
34718         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
34719         int64_t ret_ref = 0;
34720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34722         return ret_ref;
34723 }
34724
34725 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
34726         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
34727         int64_t ret_ref = 0;
34728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34730         return ret_ref;
34731 }
34732 int64_t  CS_LDK_WatchedOutput_clone_ptr(int64_t arg) {
34733         LDKWatchedOutput arg_conv;
34734         arg_conv.inner = untag_ptr(arg);
34735         arg_conv.is_owned = ptr_is_owned(arg);
34736         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34737         arg_conv.is_owned = false;
34738         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
34739         return ret_conv;
34740 }
34741
34742 int64_t  CS_LDK_WatchedOutput_clone(int64_t orig) {
34743         LDKWatchedOutput orig_conv;
34744         orig_conv.inner = untag_ptr(orig);
34745         orig_conv.is_owned = ptr_is_owned(orig);
34746         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34747         orig_conv.is_owned = false;
34748         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
34749         int64_t ret_ref = 0;
34750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34752         return ret_ref;
34753 }
34754
34755 jboolean  CS_LDK_WatchedOutput_eq(int64_t a, int64_t b) {
34756         LDKWatchedOutput a_conv;
34757         a_conv.inner = untag_ptr(a);
34758         a_conv.is_owned = ptr_is_owned(a);
34759         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34760         a_conv.is_owned = false;
34761         LDKWatchedOutput b_conv;
34762         b_conv.inner = untag_ptr(b);
34763         b_conv.is_owned = ptr_is_owned(b);
34764         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34765         b_conv.is_owned = false;
34766         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
34767         return ret_conv;
34768 }
34769
34770 int64_t  CS_LDK_WatchedOutput_hash(int64_t o) {
34771         LDKWatchedOutput o_conv;
34772         o_conv.inner = untag_ptr(o);
34773         o_conv.is_owned = ptr_is_owned(o);
34774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34775         o_conv.is_owned = false;
34776         int64_t ret_conv = WatchedOutput_hash(&o_conv);
34777         return ret_conv;
34778 }
34779
34780 void  CS_LDK_BroadcasterInterface_free(int64_t this_ptr) {
34781         if (!ptr_is_owned(this_ptr)) return;
34782         void* this_ptr_ptr = untag_ptr(this_ptr);
34783         CHECK_ACCESS(this_ptr_ptr);
34784         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
34785         FREE(untag_ptr(this_ptr));
34786         BroadcasterInterface_free(this_ptr_conv);
34787 }
34788
34789 int32_t  CS_LDK_ConfirmationTarget_clone(int64_t orig) {
34790         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
34791         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_clone(orig_conv));
34792         return ret_conv;
34793 }
34794
34795 int32_t  CS_LDK_ConfirmationTarget_on_chain_sweep() {
34796         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_on_chain_sweep());
34797         return ret_conv;
34798 }
34799
34800 int32_t  CS_LDK_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
34801         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
34802         return ret_conv;
34803 }
34804
34805 int32_t  CS_LDK_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
34806         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
34807         return ret_conv;
34808 }
34809
34810 int32_t  CS_LDK_ConfirmationTarget_anchor_channel_fee() {
34811         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_anchor_channel_fee());
34812         return ret_conv;
34813 }
34814
34815 int32_t  CS_LDK_ConfirmationTarget_non_anchor_channel_fee() {
34816         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_non_anchor_channel_fee());
34817         return ret_conv;
34818 }
34819
34820 int32_t  CS_LDK_ConfirmationTarget_channel_close_minimum() {
34821         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_channel_close_minimum());
34822         return ret_conv;
34823 }
34824
34825 int64_t  CS_LDK_ConfirmationTarget_hash(int64_t o) {
34826         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
34827         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
34828         return ret_conv;
34829 }
34830
34831 jboolean  CS_LDK_ConfirmationTarget_eq(int64_t a, int64_t b) {
34832         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
34833         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
34834         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
34835         return ret_conv;
34836 }
34837
34838 void  CS_LDK_FeeEstimator_free(int64_t this_ptr) {
34839         if (!ptr_is_owned(this_ptr)) return;
34840         void* this_ptr_ptr = untag_ptr(this_ptr);
34841         CHECK_ACCESS(this_ptr_ptr);
34842         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
34843         FREE(untag_ptr(this_ptr));
34844         FeeEstimator_free(this_ptr_conv);
34845 }
34846
34847 void  CS_LDK_MonitorUpdateId_free(int64_t this_obj) {
34848         LDKMonitorUpdateId this_obj_conv;
34849         this_obj_conv.inner = untag_ptr(this_obj);
34850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34852         MonitorUpdateId_free(this_obj_conv);
34853 }
34854
34855 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
34856         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
34857         int64_t ret_ref = 0;
34858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34860         return ret_ref;
34861 }
34862 int64_t  CS_LDK_MonitorUpdateId_clone_ptr(int64_t arg) {
34863         LDKMonitorUpdateId arg_conv;
34864         arg_conv.inner = untag_ptr(arg);
34865         arg_conv.is_owned = ptr_is_owned(arg);
34866         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34867         arg_conv.is_owned = false;
34868         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
34869         return ret_conv;
34870 }
34871
34872 int64_t  CS_LDK_MonitorUpdateId_clone(int64_t orig) {
34873         LDKMonitorUpdateId orig_conv;
34874         orig_conv.inner = untag_ptr(orig);
34875         orig_conv.is_owned = ptr_is_owned(orig);
34876         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34877         orig_conv.is_owned = false;
34878         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
34879         int64_t ret_ref = 0;
34880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34882         return ret_ref;
34883 }
34884
34885 int64_t  CS_LDK_MonitorUpdateId_hash(int64_t o) {
34886         LDKMonitorUpdateId o_conv;
34887         o_conv.inner = untag_ptr(o);
34888         o_conv.is_owned = ptr_is_owned(o);
34889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34890         o_conv.is_owned = false;
34891         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
34892         return ret_conv;
34893 }
34894
34895 jboolean  CS_LDK_MonitorUpdateId_eq(int64_t a, int64_t b) {
34896         LDKMonitorUpdateId a_conv;
34897         a_conv.inner = untag_ptr(a);
34898         a_conv.is_owned = ptr_is_owned(a);
34899         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34900         a_conv.is_owned = false;
34901         LDKMonitorUpdateId b_conv;
34902         b_conv.inner = untag_ptr(b);
34903         b_conv.is_owned = ptr_is_owned(b);
34904         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34905         b_conv.is_owned = false;
34906         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
34907         return ret_conv;
34908 }
34909
34910 void  CS_LDK_Persist_free(int64_t this_ptr) {
34911         if (!ptr_is_owned(this_ptr)) return;
34912         void* this_ptr_ptr = untag_ptr(this_ptr);
34913         CHECK_ACCESS(this_ptr_ptr);
34914         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
34915         FREE(untag_ptr(this_ptr));
34916         Persist_free(this_ptr_conv);
34917 }
34918
34919 void  CS_LDK_LockedChannelMonitor_free(int64_t this_obj) {
34920         LDKLockedChannelMonitor this_obj_conv;
34921         this_obj_conv.inner = untag_ptr(this_obj);
34922         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34924         LockedChannelMonitor_free(this_obj_conv);
34925 }
34926
34927 void  CS_LDK_ChainMonitor_free(int64_t this_obj) {
34928         LDKChainMonitor this_obj_conv;
34929         this_obj_conv.inner = untag_ptr(this_obj);
34930         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34932         ChainMonitor_free(this_obj_conv);
34933 }
34934
34935 int64_t  CS_LDK_ChainMonitor_new(int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
34936         void* chain_source_ptr = untag_ptr(chain_source);
34937         CHECK_ACCESS(chain_source_ptr);
34938         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
34939         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
34940         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
34941                 // Manually implement clone for Java trait instances
34942                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
34943                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34944                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
34945                 }
34946         }
34947         void* broadcaster_ptr = untag_ptr(broadcaster);
34948         CHECK_ACCESS(broadcaster_ptr);
34949         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
34950         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34951                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34952                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
34953         }
34954         void* logger_ptr = untag_ptr(logger);
34955         CHECK_ACCESS(logger_ptr);
34956         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34957         if (logger_conv.free == LDKLogger_JCalls_free) {
34958                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34959                 LDKLogger_JCalls_cloned(&logger_conv);
34960         }
34961         void* feeest_ptr = untag_ptr(feeest);
34962         CHECK_ACCESS(feeest_ptr);
34963         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
34964         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
34965                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34966                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
34967         }
34968         void* persister_ptr = untag_ptr(persister);
34969         CHECK_ACCESS(persister_ptr);
34970         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
34971         if (persister_conv.free == LDKPersist_JCalls_free) {
34972                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34973                 LDKPersist_JCalls_cloned(&persister_conv);
34974         }
34975         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
34976         int64_t ret_ref = 0;
34977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34979         return ret_ref;
34980 }
34981
34982 int64_tArray  CS_LDK_ChainMonitor_get_claimable_balances(int64_t this_arg, int64_tArray ignored_channels) {
34983         LDKChainMonitor this_arg_conv;
34984         this_arg_conv.inner = untag_ptr(this_arg);
34985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34987         this_arg_conv.is_owned = false;
34988         LDKCVec_ChannelDetailsZ ignored_channels_constr;
34989         ignored_channels_constr.datalen = ignored_channels->arr_len;
34990         if (ignored_channels_constr.datalen > 0)
34991                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34992         else
34993                 ignored_channels_constr.data = NULL;
34994         int64_t* ignored_channels_vals = ignored_channels->elems;
34995         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
34996                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
34997                 LDKChannelDetails ignored_channels_conv_16_conv;
34998                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
34999                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
35000                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
35001                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
35002                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
35003         }
35004         FREE(ignored_channels);
35005         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
35006         int64_tArray ret_arr = NULL;
35007         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35008         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35009         for (size_t j = 0; j < ret_var.datalen; j++) {
35010                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35011                 *ret_conv_9_copy = ret_var.data[j];
35012                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
35013                 ret_arr_ptr[j] = ret_conv_9_ref;
35014         }
35015         
35016         FREE(ret_var.data);
35017         return ret_arr;
35018 }
35019
35020 int64_t  CS_LDK_ChainMonitor_get_monitor(int64_t this_arg, int64_t funding_txo) {
35021         LDKChainMonitor this_arg_conv;
35022         this_arg_conv.inner = untag_ptr(this_arg);
35023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35025         this_arg_conv.is_owned = false;
35026         LDKOutPoint funding_txo_conv;
35027         funding_txo_conv.inner = untag_ptr(funding_txo);
35028         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35029         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35030         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35031         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35032         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
35033         return tag_ptr(ret_conv, true);
35034 }
35035
35036 int64_tArray  CS_LDK_ChainMonitor_list_monitors(int64_t this_arg) {
35037         LDKChainMonitor this_arg_conv;
35038         this_arg_conv.inner = untag_ptr(this_arg);
35039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35041         this_arg_conv.is_owned = false;
35042         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
35043         int64_tArray ret_arr = NULL;
35044         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35045         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35046         for (size_t k = 0; k < ret_var.datalen; k++) {
35047                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
35048                 int64_t ret_conv_10_ref = 0;
35049                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
35050                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
35051                 ret_arr_ptr[k] = ret_conv_10_ref;
35052         }
35053         
35054         FREE(ret_var.data);
35055         return ret_arr;
35056 }
35057
35058 int64_tArray  CS_LDK_ChainMonitor_list_pending_monitor_updates(int64_t this_arg) {
35059         LDKChainMonitor this_arg_conv;
35060         this_arg_conv.inner = untag_ptr(this_arg);
35061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35063         this_arg_conv.is_owned = false;
35064         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
35065         int64_tArray ret_arr = NULL;
35066         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35067         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35068         for (size_t p = 0; p < ret_var.datalen; p++) {
35069                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35070                 *ret_conv_41_conv = ret_var.data[p];
35071                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
35072         }
35073         
35074         FREE(ret_var.data);
35075         return ret_arr;
35076 }
35077
35078 int64_t  CS_LDK_ChainMonitor_channel_monitor_updated(int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
35079         LDKChainMonitor this_arg_conv;
35080         this_arg_conv.inner = untag_ptr(this_arg);
35081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35083         this_arg_conv.is_owned = false;
35084         LDKOutPoint funding_txo_conv;
35085         funding_txo_conv.inner = untag_ptr(funding_txo);
35086         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35087         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35088         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35089         LDKMonitorUpdateId completed_update_id_conv;
35090         completed_update_id_conv.inner = untag_ptr(completed_update_id);
35091         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
35092         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
35093         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
35094         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35095         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
35096         return tag_ptr(ret_conv, true);
35097 }
35098
35099 int64_t  CS_LDK_ChainMonitor_get_update_future(int64_t this_arg) {
35100         LDKChainMonitor this_arg_conv;
35101         this_arg_conv.inner = untag_ptr(this_arg);
35102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35104         this_arg_conv.is_owned = false;
35105         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
35106         int64_t ret_ref = 0;
35107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35109         return ret_ref;
35110 }
35111
35112 void  CS_LDK_ChainMonitor_rebroadcast_pending_claims(int64_t this_arg) {
35113         LDKChainMonitor this_arg_conv;
35114         this_arg_conv.inner = untag_ptr(this_arg);
35115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35117         this_arg_conv.is_owned = false;
35118         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
35119 }
35120
35121 int64_t  CS_LDK_ChainMonitor_as_Listen(int64_t this_arg) {
35122         LDKChainMonitor this_arg_conv;
35123         this_arg_conv.inner = untag_ptr(this_arg);
35124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35126         this_arg_conv.is_owned = false;
35127         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
35128         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
35129         return tag_ptr(ret_ret, true);
35130 }
35131
35132 int64_t  CS_LDK_ChainMonitor_as_Confirm(int64_t this_arg) {
35133         LDKChainMonitor this_arg_conv;
35134         this_arg_conv.inner = untag_ptr(this_arg);
35135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35137         this_arg_conv.is_owned = false;
35138         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
35139         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
35140         return tag_ptr(ret_ret, true);
35141 }
35142
35143 int64_t  CS_LDK_ChainMonitor_as_Watch(int64_t this_arg) {
35144         LDKChainMonitor this_arg_conv;
35145         this_arg_conv.inner = untag_ptr(this_arg);
35146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35148         this_arg_conv.is_owned = false;
35149         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
35150         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
35151         return tag_ptr(ret_ret, true);
35152 }
35153
35154 int64_t  CS_LDK_ChainMonitor_as_EventsProvider(int64_t this_arg) {
35155         LDKChainMonitor this_arg_conv;
35156         this_arg_conv.inner = untag_ptr(this_arg);
35157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35159         this_arg_conv.is_owned = false;
35160         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
35161         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
35162         return tag_ptr(ret_ret, true);
35163 }
35164
35165 void  CS_LDK_ChannelMonitorUpdate_free(int64_t this_obj) {
35166         LDKChannelMonitorUpdate this_obj_conv;
35167         this_obj_conv.inner = untag_ptr(this_obj);
35168         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35170         ChannelMonitorUpdate_free(this_obj_conv);
35171 }
35172
35173 int64_t  CS_LDK_ChannelMonitorUpdate_get_update_id(int64_t this_ptr) {
35174         LDKChannelMonitorUpdate this_ptr_conv;
35175         this_ptr_conv.inner = untag_ptr(this_ptr);
35176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35178         this_ptr_conv.is_owned = false;
35179         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
35180         return ret_conv;
35181 }
35182
35183 void  CS_LDK_ChannelMonitorUpdate_set_update_id(int64_t this_ptr, int64_t val) {
35184         LDKChannelMonitorUpdate this_ptr_conv;
35185         this_ptr_conv.inner = untag_ptr(this_ptr);
35186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35188         this_ptr_conv.is_owned = false;
35189         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
35190 }
35191
35192 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
35193         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
35194         int64_t ret_ref = 0;
35195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35197         return ret_ref;
35198 }
35199 int64_t  CS_LDK_ChannelMonitorUpdate_clone_ptr(int64_t arg) {
35200         LDKChannelMonitorUpdate arg_conv;
35201         arg_conv.inner = untag_ptr(arg);
35202         arg_conv.is_owned = ptr_is_owned(arg);
35203         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35204         arg_conv.is_owned = false;
35205         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
35206         return ret_conv;
35207 }
35208
35209 int64_t  CS_LDK_ChannelMonitorUpdate_clone(int64_t orig) {
35210         LDKChannelMonitorUpdate orig_conv;
35211         orig_conv.inner = untag_ptr(orig);
35212         orig_conv.is_owned = ptr_is_owned(orig);
35213         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35214         orig_conv.is_owned = false;
35215         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
35216         int64_t ret_ref = 0;
35217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35219         return ret_ref;
35220 }
35221
35222 jboolean  CS_LDK_ChannelMonitorUpdate_eq(int64_t a, int64_t b) {
35223         LDKChannelMonitorUpdate a_conv;
35224         a_conv.inner = untag_ptr(a);
35225         a_conv.is_owned = ptr_is_owned(a);
35226         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35227         a_conv.is_owned = false;
35228         LDKChannelMonitorUpdate b_conv;
35229         b_conv.inner = untag_ptr(b);
35230         b_conv.is_owned = ptr_is_owned(b);
35231         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35232         b_conv.is_owned = false;
35233         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
35234         return ret_conv;
35235 }
35236
35237 int8_tArray  CS_LDK_ChannelMonitorUpdate_write(int64_t obj) {
35238         LDKChannelMonitorUpdate obj_conv;
35239         obj_conv.inner = untag_ptr(obj);
35240         obj_conv.is_owned = ptr_is_owned(obj);
35241         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35242         obj_conv.is_owned = false;
35243         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
35244         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35245         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35246         CVec_u8Z_free(ret_var);
35247         return ret_arr;
35248 }
35249
35250 int64_t  CS_LDK_ChannelMonitorUpdate_read(int8_tArray ser) {
35251         LDKu8slice ser_ref;
35252         ser_ref.datalen = ser->arr_len;
35253         ser_ref.data = ser->elems;
35254         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
35255         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
35256         FREE(ser);
35257         return tag_ptr(ret_conv, true);
35258 }
35259
35260 void  CS_LDK_MonitorEvent_free(int64_t this_ptr) {
35261         if (!ptr_is_owned(this_ptr)) return;
35262         void* this_ptr_ptr = untag_ptr(this_ptr);
35263         CHECK_ACCESS(this_ptr_ptr);
35264         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
35265         FREE(untag_ptr(this_ptr));
35266         MonitorEvent_free(this_ptr_conv);
35267 }
35268
35269 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
35270         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35271         *ret_copy = MonitorEvent_clone(arg);
35272         int64_t ret_ref = tag_ptr(ret_copy, true);
35273         return ret_ref;
35274 }
35275 int64_t  CS_LDK_MonitorEvent_clone_ptr(int64_t arg) {
35276         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
35277         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
35278         return ret_conv;
35279 }
35280
35281 int64_t  CS_LDK_MonitorEvent_clone(int64_t orig) {
35282         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
35283         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35284         *ret_copy = MonitorEvent_clone(orig_conv);
35285         int64_t ret_ref = tag_ptr(ret_copy, true);
35286         return ret_ref;
35287 }
35288
35289 int64_t  CS_LDK_MonitorEvent_htlcevent(int64_t a) {
35290         LDKHTLCUpdate a_conv;
35291         a_conv.inner = untag_ptr(a);
35292         a_conv.is_owned = ptr_is_owned(a);
35293         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35294         a_conv = HTLCUpdate_clone(&a_conv);
35295         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35296         *ret_copy = MonitorEvent_htlcevent(a_conv);
35297         int64_t ret_ref = tag_ptr(ret_copy, true);
35298         return ret_ref;
35299 }
35300
35301 int64_t  CS_LDK_MonitorEvent_holder_force_closed(int64_t a) {
35302         LDKOutPoint a_conv;
35303         a_conv.inner = untag_ptr(a);
35304         a_conv.is_owned = ptr_is_owned(a);
35305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35306         a_conv = OutPoint_clone(&a_conv);
35307         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35308         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
35309         int64_t ret_ref = tag_ptr(ret_copy, true);
35310         return ret_ref;
35311 }
35312
35313 int64_t  CS_LDK_MonitorEvent_completed(int64_t funding_txo, int64_t monitor_update_id) {
35314         LDKOutPoint funding_txo_conv;
35315         funding_txo_conv.inner = untag_ptr(funding_txo);
35316         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35317         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35318         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35319         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35320         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
35321         int64_t ret_ref = tag_ptr(ret_copy, true);
35322         return ret_ref;
35323 }
35324
35325 jboolean  CS_LDK_MonitorEvent_eq(int64_t a, int64_t b) {
35326         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
35327         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
35328         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
35329         return ret_conv;
35330 }
35331
35332 int8_tArray  CS_LDK_MonitorEvent_write(int64_t obj) {
35333         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
35334         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
35335         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35336         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35337         CVec_u8Z_free(ret_var);
35338         return ret_arr;
35339 }
35340
35341 int64_t  CS_LDK_MonitorEvent_read(int8_tArray ser) {
35342         LDKu8slice ser_ref;
35343         ser_ref.datalen = ser->arr_len;
35344         ser_ref.data = ser->elems;
35345         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
35346         *ret_conv = MonitorEvent_read(ser_ref);
35347         FREE(ser);
35348         return tag_ptr(ret_conv, true);
35349 }
35350
35351 void  CS_LDK_HTLCUpdate_free(int64_t this_obj) {
35352         LDKHTLCUpdate this_obj_conv;
35353         this_obj_conv.inner = untag_ptr(this_obj);
35354         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35356         HTLCUpdate_free(this_obj_conv);
35357 }
35358
35359 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
35360         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
35361         int64_t ret_ref = 0;
35362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35364         return ret_ref;
35365 }
35366 int64_t  CS_LDK_HTLCUpdate_clone_ptr(int64_t arg) {
35367         LDKHTLCUpdate arg_conv;
35368         arg_conv.inner = untag_ptr(arg);
35369         arg_conv.is_owned = ptr_is_owned(arg);
35370         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35371         arg_conv.is_owned = false;
35372         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
35373         return ret_conv;
35374 }
35375
35376 int64_t  CS_LDK_HTLCUpdate_clone(int64_t orig) {
35377         LDKHTLCUpdate orig_conv;
35378         orig_conv.inner = untag_ptr(orig);
35379         orig_conv.is_owned = ptr_is_owned(orig);
35380         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35381         orig_conv.is_owned = false;
35382         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
35383         int64_t ret_ref = 0;
35384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35386         return ret_ref;
35387 }
35388
35389 jboolean  CS_LDK_HTLCUpdate_eq(int64_t a, int64_t b) {
35390         LDKHTLCUpdate a_conv;
35391         a_conv.inner = untag_ptr(a);
35392         a_conv.is_owned = ptr_is_owned(a);
35393         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35394         a_conv.is_owned = false;
35395         LDKHTLCUpdate b_conv;
35396         b_conv.inner = untag_ptr(b);
35397         b_conv.is_owned = ptr_is_owned(b);
35398         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35399         b_conv.is_owned = false;
35400         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
35401         return ret_conv;
35402 }
35403
35404 int8_tArray  CS_LDK_HTLCUpdate_write(int64_t obj) {
35405         LDKHTLCUpdate obj_conv;
35406         obj_conv.inner = untag_ptr(obj);
35407         obj_conv.is_owned = ptr_is_owned(obj);
35408         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35409         obj_conv.is_owned = false;
35410         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
35411         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35412         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35413         CVec_u8Z_free(ret_var);
35414         return ret_arr;
35415 }
35416
35417 int64_t  CS_LDK_HTLCUpdate_read(int8_tArray ser) {
35418         LDKu8slice ser_ref;
35419         ser_ref.datalen = ser->arr_len;
35420         ser_ref.data = ser->elems;
35421         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
35422         *ret_conv = HTLCUpdate_read(ser_ref);
35423         FREE(ser);
35424         return tag_ptr(ret_conv, true);
35425 }
35426
35427 void  CS_LDK_Balance_free(int64_t this_ptr) {
35428         if (!ptr_is_owned(this_ptr)) return;
35429         void* this_ptr_ptr = untag_ptr(this_ptr);
35430         CHECK_ACCESS(this_ptr_ptr);
35431         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
35432         FREE(untag_ptr(this_ptr));
35433         Balance_free(this_ptr_conv);
35434 }
35435
35436 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
35437         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35438         *ret_copy = Balance_clone(arg);
35439         int64_t ret_ref = tag_ptr(ret_copy, true);
35440         return ret_ref;
35441 }
35442 int64_t  CS_LDK_Balance_clone_ptr(int64_t arg) {
35443         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
35444         int64_t ret_conv = Balance_clone_ptr(arg_conv);
35445         return ret_conv;
35446 }
35447
35448 int64_t  CS_LDK_Balance_clone(int64_t orig) {
35449         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
35450         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35451         *ret_copy = Balance_clone(orig_conv);
35452         int64_t ret_ref = tag_ptr(ret_copy, true);
35453         return ret_ref;
35454 }
35455
35456 int64_t  CS_LDK_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
35457         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35458         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
35459         int64_t ret_ref = tag_ptr(ret_copy, true);
35460         return ret_ref;
35461 }
35462
35463 int64_t  CS_LDK_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
35464         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35465         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
35466         int64_t ret_ref = tag_ptr(ret_copy, true);
35467         return ret_ref;
35468 }
35469
35470 int64_t  CS_LDK_Balance_contentious_claimable(int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
35471         LDKThirtyTwoBytes payment_hash_ref;
35472         CHECK(payment_hash->arr_len == 32);
35473         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35474         LDKThirtyTwoBytes payment_preimage_ref;
35475         CHECK(payment_preimage->arr_len == 32);
35476         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35477         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35478         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
35479         int64_t ret_ref = tag_ptr(ret_copy, true);
35480         return ret_ref;
35481 }
35482
35483 int64_t  CS_LDK_Balance_maybe_timeout_claimable_htlc(int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
35484         LDKThirtyTwoBytes payment_hash_ref;
35485         CHECK(payment_hash->arr_len == 32);
35486         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35487         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35488         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
35489         int64_t ret_ref = tag_ptr(ret_copy, true);
35490         return ret_ref;
35491 }
35492
35493 int64_t  CS_LDK_Balance_maybe_preimage_claimable_htlc(int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
35494         LDKThirtyTwoBytes payment_hash_ref;
35495         CHECK(payment_hash->arr_len == 32);
35496         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35497         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35498         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
35499         int64_t ret_ref = tag_ptr(ret_copy, true);
35500         return ret_ref;
35501 }
35502
35503 int64_t  CS_LDK_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
35504         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35505         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
35506         int64_t ret_ref = tag_ptr(ret_copy, true);
35507         return ret_ref;
35508 }
35509
35510 jboolean  CS_LDK_Balance_eq(int64_t a, int64_t b) {
35511         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
35512         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
35513         jboolean ret_conv = Balance_eq(a_conv, b_conv);
35514         return ret_conv;
35515 }
35516
35517 int64_t  CS_LDK_Balance_claimable_amount_satoshis(int64_t this_arg) {
35518         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
35519         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
35520         return ret_conv;
35521 }
35522
35523 void  CS_LDK_ChannelMonitor_free(int64_t this_obj) {
35524         LDKChannelMonitor this_obj_conv;
35525         this_obj_conv.inner = untag_ptr(this_obj);
35526         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35528         ChannelMonitor_free(this_obj_conv);
35529 }
35530
35531 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
35532         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
35533         int64_t ret_ref = 0;
35534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35536         return ret_ref;
35537 }
35538 int64_t  CS_LDK_ChannelMonitor_clone_ptr(int64_t arg) {
35539         LDKChannelMonitor arg_conv;
35540         arg_conv.inner = untag_ptr(arg);
35541         arg_conv.is_owned = ptr_is_owned(arg);
35542         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35543         arg_conv.is_owned = false;
35544         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
35545         return ret_conv;
35546 }
35547
35548 int64_t  CS_LDK_ChannelMonitor_clone(int64_t orig) {
35549         LDKChannelMonitor orig_conv;
35550         orig_conv.inner = untag_ptr(orig);
35551         orig_conv.is_owned = ptr_is_owned(orig);
35552         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35553         orig_conv.is_owned = false;
35554         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
35555         int64_t ret_ref = 0;
35556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35558         return ret_ref;
35559 }
35560
35561 int8_tArray  CS_LDK_ChannelMonitor_write(int64_t obj) {
35562         LDKChannelMonitor obj_conv;
35563         obj_conv.inner = untag_ptr(obj);
35564         obj_conv.is_owned = ptr_is_owned(obj);
35565         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35566         obj_conv.is_owned = false;
35567         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
35568         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35569         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35570         CVec_u8Z_free(ret_var);
35571         return ret_arr;
35572 }
35573
35574 int64_t  CS_LDK_ChannelMonitor_update_monitor(int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35575         LDKChannelMonitor this_arg_conv;
35576         this_arg_conv.inner = untag_ptr(this_arg);
35577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35579         this_arg_conv.is_owned = false;
35580         LDKChannelMonitorUpdate updates_conv;
35581         updates_conv.inner = untag_ptr(updates);
35582         updates_conv.is_owned = ptr_is_owned(updates);
35583         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
35584         updates_conv.is_owned = false;
35585         void* broadcaster_ptr = untag_ptr(broadcaster);
35586         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35587         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35588         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35589         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35590         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35591         void* logger_ptr = untag_ptr(logger);
35592         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35593         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35594         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35595         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35596         return tag_ptr(ret_conv, true);
35597 }
35598
35599 int64_t  CS_LDK_ChannelMonitor_get_latest_update_id(int64_t this_arg) {
35600         LDKChannelMonitor this_arg_conv;
35601         this_arg_conv.inner = untag_ptr(this_arg);
35602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35604         this_arg_conv.is_owned = false;
35605         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
35606         return ret_conv;
35607 }
35608
35609 int64_t  CS_LDK_ChannelMonitor_get_funding_txo(int64_t this_arg) {
35610         LDKChannelMonitor this_arg_conv;
35611         this_arg_conv.inner = untag_ptr(this_arg);
35612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35614         this_arg_conv.is_owned = false;
35615         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
35616         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
35617         return tag_ptr(ret_conv, true);
35618 }
35619
35620 int64_tArray  CS_LDK_ChannelMonitor_get_outputs_to_watch(int64_t this_arg) {
35621         LDKChannelMonitor this_arg_conv;
35622         this_arg_conv.inner = untag_ptr(this_arg);
35623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35625         this_arg_conv.is_owned = false;
35626         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
35627         int64_tArray ret_arr = NULL;
35628         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35629         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35630         for (size_t a = 0; a < ret_var.datalen; a++) {
35631                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
35632                 *ret_conv_52_conv = ret_var.data[a];
35633                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
35634         }
35635         
35636         FREE(ret_var.data);
35637         return ret_arr;
35638 }
35639
35640 void  CS_LDK_ChannelMonitor_load_outputs_to_watch(int64_t this_arg, int64_t filter, int64_t logger) {
35641         LDKChannelMonitor this_arg_conv;
35642         this_arg_conv.inner = untag_ptr(this_arg);
35643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35645         this_arg_conv.is_owned = false;
35646         void* filter_ptr = untag_ptr(filter);
35647         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
35648         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
35649         void* logger_ptr = untag_ptr(logger);
35650         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35651         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35652         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
35653 }
35654
35655 int64_tArray  CS_LDK_ChannelMonitor_get_and_clear_pending_monitor_events(int64_t this_arg) {
35656         LDKChannelMonitor this_arg_conv;
35657         this_arg_conv.inner = untag_ptr(this_arg);
35658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35660         this_arg_conv.is_owned = false;
35661         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
35662         int64_tArray ret_arr = NULL;
35663         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35664         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35665         for (size_t o = 0; o < ret_var.datalen; o++) {
35666                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35667                 *ret_conv_14_copy = ret_var.data[o];
35668                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
35669                 ret_arr_ptr[o] = ret_conv_14_ref;
35670         }
35671         
35672         FREE(ret_var.data);
35673         return ret_arr;
35674 }
35675
35676 void  CS_LDK_ChannelMonitor_process_pending_events(int64_t this_arg, int64_t handler) {
35677         LDKChannelMonitor this_arg_conv;
35678         this_arg_conv.inner = untag_ptr(this_arg);
35679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35681         this_arg_conv.is_owned = false;
35682         void* handler_ptr = untag_ptr(handler);
35683         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
35684         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
35685         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
35686 }
35687
35688 int64_t  CS_LDK_ChannelMonitor_initial_counterparty_commitment_tx(int64_t this_arg) {
35689         LDKChannelMonitor this_arg_conv;
35690         this_arg_conv.inner = untag_ptr(this_arg);
35691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35693         this_arg_conv.is_owned = false;
35694         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
35695         int64_t ret_ref = 0;
35696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35698         return ret_ref;
35699 }
35700
35701 int64_tArray  CS_LDK_ChannelMonitor_counterparty_commitment_txs_from_update(int64_t this_arg, int64_t update) {
35702         LDKChannelMonitor this_arg_conv;
35703         this_arg_conv.inner = untag_ptr(this_arg);
35704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35706         this_arg_conv.is_owned = false;
35707         LDKChannelMonitorUpdate update_conv;
35708         update_conv.inner = untag_ptr(update);
35709         update_conv.is_owned = ptr_is_owned(update);
35710         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
35711         update_conv.is_owned = false;
35712         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
35713         int64_tArray ret_arr = NULL;
35714         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35715         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35716         for (size_t x = 0; x < ret_var.datalen; x++) {
35717                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
35718                 int64_t ret_conv_23_ref = 0;
35719                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
35720                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
35721                 ret_arr_ptr[x] = ret_conv_23_ref;
35722         }
35723         
35724         FREE(ret_var.data);
35725         return ret_arr;
35726 }
35727
35728 int64_t  CS_LDK_ChannelMonitor_sign_to_local_justice_tx(int64_t this_arg, int8_tArray justice_tx, int64_t input_idx, int64_t value, int64_t commitment_number) {
35729         LDKChannelMonitor this_arg_conv;
35730         this_arg_conv.inner = untag_ptr(this_arg);
35731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35733         this_arg_conv.is_owned = false;
35734         LDKTransaction justice_tx_ref;
35735         justice_tx_ref.datalen = justice_tx->arr_len;
35736         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
35737         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
35738         justice_tx_ref.data_is_owned = true;
35739         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
35740         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
35741         return tag_ptr(ret_conv, true);
35742 }
35743
35744 int8_tArray  CS_LDK_ChannelMonitor_get_counterparty_node_id(int64_t this_arg) {
35745         LDKChannelMonitor this_arg_conv;
35746         this_arg_conv.inner = untag_ptr(this_arg);
35747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35749         this_arg_conv.is_owned = false;
35750         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35751         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
35752         return ret_arr;
35753 }
35754
35755 ptrArray  CS_LDK_ChannelMonitor_get_latest_holder_commitment_txn(int64_t this_arg, int64_t logger) {
35756         LDKChannelMonitor this_arg_conv;
35757         this_arg_conv.inner = untag_ptr(this_arg);
35758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35760         this_arg_conv.is_owned = false;
35761         void* logger_ptr = untag_ptr(logger);
35762         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35763         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35764         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
35765         ptrArray ret_arr = NULL;
35766         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
35767         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
35768         for (size_t i = 0; i < ret_var.datalen; i++) {
35769                 LDKTransaction ret_conv_8_var = ret_var.data[i];
35770                 int8_tArray ret_conv_8_arr = init_int8_tArray(ret_conv_8_var.datalen, __LINE__);
35771                 memcpy(ret_conv_8_arr->elems, ret_conv_8_var.data, ret_conv_8_var.datalen);
35772                 Transaction_free(ret_conv_8_var);
35773                 ret_arr_ptr[i] = ret_conv_8_arr;
35774         }
35775         
35776         FREE(ret_var.data);
35777         return ret_arr;
35778 }
35779
35780 int64_tArray  CS_LDK_ChannelMonitor_block_connected(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35781         LDKChannelMonitor this_arg_conv;
35782         this_arg_conv.inner = untag_ptr(this_arg);
35783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35785         this_arg_conv.is_owned = false;
35786         uint8_t header_arr[80];
35787         CHECK(header->arr_len == 80);
35788         memcpy(header_arr, header->elems, 80); FREE(header);
35789         uint8_t (*header_ref)[80] = &header_arr;
35790         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35791         txdata_constr.datalen = txdata->arr_len;
35792         if (txdata_constr.datalen > 0)
35793                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35794         else
35795                 txdata_constr.data = NULL;
35796         int64_t* txdata_vals = txdata->elems;
35797         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35798                 int64_t txdata_conv_28 = txdata_vals[c];
35799                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35800                 CHECK_ACCESS(txdata_conv_28_ptr);
35801                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35802                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35803                 txdata_constr.data[c] = txdata_conv_28_conv;
35804         }
35805         FREE(txdata);
35806         void* broadcaster_ptr = untag_ptr(broadcaster);
35807         CHECK_ACCESS(broadcaster_ptr);
35808         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35809         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35810                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35811                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35812         }
35813         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35814         CHECK_ACCESS(fee_estimator_ptr);
35815         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35816         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35817                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35818                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35819         }
35820         void* logger_ptr = untag_ptr(logger);
35821         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35822         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35823         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35824         int64_tArray ret_arr = NULL;
35825         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35826         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35827         for (size_t x = 0; x < ret_var.datalen; x++) {
35828                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35829                 *ret_conv_49_conv = ret_var.data[x];
35830                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35831         }
35832         
35833         FREE(ret_var.data);
35834         return ret_arr;
35835 }
35836
35837 void  CS_LDK_ChannelMonitor_block_disconnected(int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35838         LDKChannelMonitor this_arg_conv;
35839         this_arg_conv.inner = untag_ptr(this_arg);
35840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35842         this_arg_conv.is_owned = false;
35843         uint8_t header_arr[80];
35844         CHECK(header->arr_len == 80);
35845         memcpy(header_arr, header->elems, 80); FREE(header);
35846         uint8_t (*header_ref)[80] = &header_arr;
35847         void* broadcaster_ptr = untag_ptr(broadcaster);
35848         CHECK_ACCESS(broadcaster_ptr);
35849         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35850         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35851                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35852                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35853         }
35854         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35855         CHECK_ACCESS(fee_estimator_ptr);
35856         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35857         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35858                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35859                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35860         }
35861         void* logger_ptr = untag_ptr(logger);
35862         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35863         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35864         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35865 }
35866
35867 int64_tArray  CS_LDK_ChannelMonitor_transactions_confirmed(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35868         LDKChannelMonitor this_arg_conv;
35869         this_arg_conv.inner = untag_ptr(this_arg);
35870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35872         this_arg_conv.is_owned = false;
35873         uint8_t header_arr[80];
35874         CHECK(header->arr_len == 80);
35875         memcpy(header_arr, header->elems, 80); FREE(header);
35876         uint8_t (*header_ref)[80] = &header_arr;
35877         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35878         txdata_constr.datalen = txdata->arr_len;
35879         if (txdata_constr.datalen > 0)
35880                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35881         else
35882                 txdata_constr.data = NULL;
35883         int64_t* txdata_vals = txdata->elems;
35884         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35885                 int64_t txdata_conv_28 = txdata_vals[c];
35886                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35887                 CHECK_ACCESS(txdata_conv_28_ptr);
35888                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35889                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35890                 txdata_constr.data[c] = txdata_conv_28_conv;
35891         }
35892         FREE(txdata);
35893         void* broadcaster_ptr = untag_ptr(broadcaster);
35894         CHECK_ACCESS(broadcaster_ptr);
35895         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35896         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35897                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35898                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35899         }
35900         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35901         CHECK_ACCESS(fee_estimator_ptr);
35902         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35903         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35904                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35905                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35906         }
35907         void* logger_ptr = untag_ptr(logger);
35908         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35909         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35910         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35911         int64_tArray ret_arr = NULL;
35912         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35913         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35914         for (size_t x = 0; x < ret_var.datalen; x++) {
35915                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35916                 *ret_conv_49_conv = ret_var.data[x];
35917                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35918         }
35919         
35920         FREE(ret_var.data);
35921         return ret_arr;
35922 }
35923
35924 void  CS_LDK_ChannelMonitor_transaction_unconfirmed(int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35925         LDKChannelMonitor this_arg_conv;
35926         this_arg_conv.inner = untag_ptr(this_arg);
35927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35929         this_arg_conv.is_owned = false;
35930         uint8_t txid_arr[32];
35931         CHECK(txid->arr_len == 32);
35932         memcpy(txid_arr, txid->elems, 32); FREE(txid);
35933         uint8_t (*txid_ref)[32] = &txid_arr;
35934         void* broadcaster_ptr = untag_ptr(broadcaster);
35935         CHECK_ACCESS(broadcaster_ptr);
35936         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35937         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35938                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35939                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35940         }
35941         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35942         CHECK_ACCESS(fee_estimator_ptr);
35943         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35944         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35945                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35946                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35947         }
35948         void* logger_ptr = untag_ptr(logger);
35949         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35950         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35951         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
35952 }
35953
35954 int64_tArray  CS_LDK_ChannelMonitor_best_block_updated(int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35955         LDKChannelMonitor this_arg_conv;
35956         this_arg_conv.inner = untag_ptr(this_arg);
35957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35959         this_arg_conv.is_owned = false;
35960         uint8_t header_arr[80];
35961         CHECK(header->arr_len == 80);
35962         memcpy(header_arr, header->elems, 80); FREE(header);
35963         uint8_t (*header_ref)[80] = &header_arr;
35964         void* broadcaster_ptr = untag_ptr(broadcaster);
35965         CHECK_ACCESS(broadcaster_ptr);
35966         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35967         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35968                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35969                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35970         }
35971         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35972         CHECK_ACCESS(fee_estimator_ptr);
35973         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35974         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35975                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35976                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35977         }
35978         void* logger_ptr = untag_ptr(logger);
35979         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35980         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35981         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35982         int64_tArray ret_arr = NULL;
35983         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35984         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35985         for (size_t x = 0; x < ret_var.datalen; x++) {
35986                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35987                 *ret_conv_49_conv = ret_var.data[x];
35988                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35989         }
35990         
35991         FREE(ret_var.data);
35992         return ret_arr;
35993 }
35994
35995 int64_tArray  CS_LDK_ChannelMonitor_get_relevant_txids(int64_t this_arg) {
35996         LDKChannelMonitor this_arg_conv;
35997         this_arg_conv.inner = untag_ptr(this_arg);
35998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36000         this_arg_conv.is_owned = false;
36001         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
36002         int64_tArray ret_arr = NULL;
36003         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36004         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36005         for (size_t c = 0; c < ret_var.datalen; c++) {
36006                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
36007                 *ret_conv_54_conv = ret_var.data[c];
36008                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
36009         }
36010         
36011         FREE(ret_var.data);
36012         return ret_arr;
36013 }
36014
36015 int64_t  CS_LDK_ChannelMonitor_current_best_block(int64_t this_arg) {
36016         LDKChannelMonitor this_arg_conv;
36017         this_arg_conv.inner = untag_ptr(this_arg);
36018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36020         this_arg_conv.is_owned = false;
36021         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
36022         int64_t ret_ref = 0;
36023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36025         return ret_ref;
36026 }
36027
36028 void  CS_LDK_ChannelMonitor_rebroadcast_pending_claims(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
36029         LDKChannelMonitor this_arg_conv;
36030         this_arg_conv.inner = untag_ptr(this_arg);
36031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36033         this_arg_conv.is_owned = false;
36034         void* broadcaster_ptr = untag_ptr(broadcaster);
36035         CHECK_ACCESS(broadcaster_ptr);
36036         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36037         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36038                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36039                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36040         }
36041         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36042         CHECK_ACCESS(fee_estimator_ptr);
36043         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36044         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36046                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36047         }
36048         void* logger_ptr = untag_ptr(logger);
36049         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
36050         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
36051         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
36052 }
36053
36054 int64_tArray  CS_LDK_ChannelMonitor_get_spendable_outputs(int64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
36055         LDKChannelMonitor this_arg_conv;
36056         this_arg_conv.inner = untag_ptr(this_arg);
36057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36059         this_arg_conv.is_owned = false;
36060         LDKTransaction tx_ref;
36061         tx_ref.datalen = tx->arr_len;
36062         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
36063         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
36064         tx_ref.data_is_owned = true;
36065         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
36066         int64_tArray ret_arr = NULL;
36067         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36068         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36069         for (size_t b = 0; b < ret_var.datalen; b++) {
36070                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
36071                 *ret_conv_27_copy = ret_var.data[b];
36072                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
36073                 ret_arr_ptr[b] = ret_conv_27_ref;
36074         }
36075         
36076         FREE(ret_var.data);
36077         return ret_arr;
36078 }
36079
36080 int64_tArray  CS_LDK_ChannelMonitor_get_claimable_balances(int64_t this_arg) {
36081         LDKChannelMonitor this_arg_conv;
36082         this_arg_conv.inner = untag_ptr(this_arg);
36083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36085         this_arg_conv.is_owned = false;
36086         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
36087         int64_tArray ret_arr = NULL;
36088         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36089         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36090         for (size_t j = 0; j < ret_var.datalen; j++) {
36091                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
36092                 *ret_conv_9_copy = ret_var.data[j];
36093                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
36094                 ret_arr_ptr[j] = ret_conv_9_ref;
36095         }
36096         
36097         FREE(ret_var.data);
36098         return ret_arr;
36099 }
36100
36101 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
36102         LDKu8slice ser_ref;
36103         ser_ref.datalen = ser->arr_len;
36104         ser_ref.data = ser->elems;
36105         void* arg_a_ptr = untag_ptr(arg_a);
36106         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
36107         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
36108         void* arg_b_ptr = untag_ptr(arg_b);
36109         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
36110         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
36111         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
36112         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
36113         FREE(ser);
36114         return tag_ptr(ret_conv, true);
36115 }
36116
36117 void  CS_LDK_OutPoint_free(int64_t this_obj) {
36118         LDKOutPoint this_obj_conv;
36119         this_obj_conv.inner = untag_ptr(this_obj);
36120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36122         OutPoint_free(this_obj_conv);
36123 }
36124
36125 int8_tArray  CS_LDK_OutPoint_get_txid(int64_t this_ptr) {
36126         LDKOutPoint this_ptr_conv;
36127         this_ptr_conv.inner = untag_ptr(this_ptr);
36128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36130         this_ptr_conv.is_owned = false;
36131         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36132         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
36133         return ret_arr;
36134 }
36135
36136 void  CS_LDK_OutPoint_set_txid(int64_t this_ptr, int8_tArray val) {
36137         LDKOutPoint this_ptr_conv;
36138         this_ptr_conv.inner = untag_ptr(this_ptr);
36139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36141         this_ptr_conv.is_owned = false;
36142         LDKThirtyTwoBytes val_ref;
36143         CHECK(val->arr_len == 32);
36144         memcpy(val_ref.data, val->elems, 32); FREE(val);
36145         OutPoint_set_txid(&this_ptr_conv, val_ref);
36146 }
36147
36148 int16_t  CS_LDK_OutPoint_get_index(int64_t this_ptr) {
36149         LDKOutPoint this_ptr_conv;
36150         this_ptr_conv.inner = untag_ptr(this_ptr);
36151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36153         this_ptr_conv.is_owned = false;
36154         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
36155         return ret_conv;
36156 }
36157
36158 void  CS_LDK_OutPoint_set_index(int64_t this_ptr, int16_t val) {
36159         LDKOutPoint this_ptr_conv;
36160         this_ptr_conv.inner = untag_ptr(this_ptr);
36161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36163         this_ptr_conv.is_owned = false;
36164         OutPoint_set_index(&this_ptr_conv, val);
36165 }
36166
36167 int64_t  CS_LDK_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
36168         LDKThirtyTwoBytes txid_arg_ref;
36169         CHECK(txid_arg->arr_len == 32);
36170         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
36171         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
36172         int64_t ret_ref = 0;
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36175         return ret_ref;
36176 }
36177
36178 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
36179         LDKOutPoint ret_var = OutPoint_clone(arg);
36180         int64_t ret_ref = 0;
36181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36183         return ret_ref;
36184 }
36185 int64_t  CS_LDK_OutPoint_clone_ptr(int64_t arg) {
36186         LDKOutPoint arg_conv;
36187         arg_conv.inner = untag_ptr(arg);
36188         arg_conv.is_owned = ptr_is_owned(arg);
36189         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36190         arg_conv.is_owned = false;
36191         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
36192         return ret_conv;
36193 }
36194
36195 int64_t  CS_LDK_OutPoint_clone(int64_t orig) {
36196         LDKOutPoint orig_conv;
36197         orig_conv.inner = untag_ptr(orig);
36198         orig_conv.is_owned = ptr_is_owned(orig);
36199         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36200         orig_conv.is_owned = false;
36201         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
36202         int64_t ret_ref = 0;
36203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36205         return ret_ref;
36206 }
36207
36208 jboolean  CS_LDK_OutPoint_eq(int64_t a, int64_t b) {
36209         LDKOutPoint a_conv;
36210         a_conv.inner = untag_ptr(a);
36211         a_conv.is_owned = ptr_is_owned(a);
36212         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36213         a_conv.is_owned = false;
36214         LDKOutPoint b_conv;
36215         b_conv.inner = untag_ptr(b);
36216         b_conv.is_owned = ptr_is_owned(b);
36217         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36218         b_conv.is_owned = false;
36219         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
36220         return ret_conv;
36221 }
36222
36223 int64_t  CS_LDK_OutPoint_hash(int64_t o) {
36224         LDKOutPoint o_conv;
36225         o_conv.inner = untag_ptr(o);
36226         o_conv.is_owned = ptr_is_owned(o);
36227         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36228         o_conv.is_owned = false;
36229         int64_t ret_conv = OutPoint_hash(&o_conv);
36230         return ret_conv;
36231 }
36232
36233 int8_tArray  CS_LDK_OutPoint_to_channel_id(int64_t this_arg) {
36234         LDKOutPoint this_arg_conv;
36235         this_arg_conv.inner = untag_ptr(this_arg);
36236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36238         this_arg_conv.is_owned = false;
36239         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36240         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
36241         return ret_arr;
36242 }
36243
36244 int8_tArray  CS_LDK_OutPoint_write(int64_t obj) {
36245         LDKOutPoint obj_conv;
36246         obj_conv.inner = untag_ptr(obj);
36247         obj_conv.is_owned = ptr_is_owned(obj);
36248         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36249         obj_conv.is_owned = false;
36250         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
36251         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36252         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36253         CVec_u8Z_free(ret_var);
36254         return ret_arr;
36255 }
36256
36257 int64_t  CS_LDK_OutPoint_read(int8_tArray ser) {
36258         LDKu8slice ser_ref;
36259         ser_ref.datalen = ser->arr_len;
36260         ser_ref.data = ser->elems;
36261         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
36262         *ret_conv = OutPoint_read(ser_ref);
36263         FREE(ser);
36264         return tag_ptr(ret_conv, true);
36265 }
36266
36267 void  CS_LDK_InboundHTLCErr_free(int64_t this_obj) {
36268         LDKInboundHTLCErr this_obj_conv;
36269         this_obj_conv.inner = untag_ptr(this_obj);
36270         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36272         InboundHTLCErr_free(this_obj_conv);
36273 }
36274
36275 int16_t  CS_LDK_InboundHTLCErr_get_err_code(int64_t this_ptr) {
36276         LDKInboundHTLCErr this_ptr_conv;
36277         this_ptr_conv.inner = untag_ptr(this_ptr);
36278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36280         this_ptr_conv.is_owned = false;
36281         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
36282         return ret_conv;
36283 }
36284
36285 void  CS_LDK_InboundHTLCErr_set_err_code(int64_t this_ptr, int16_t val) {
36286         LDKInboundHTLCErr this_ptr_conv;
36287         this_ptr_conv.inner = untag_ptr(this_ptr);
36288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36290         this_ptr_conv.is_owned = false;
36291         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
36292 }
36293
36294 int8_tArray  CS_LDK_InboundHTLCErr_get_err_data(int64_t this_ptr) {
36295         LDKInboundHTLCErr this_ptr_conv;
36296         this_ptr_conv.inner = untag_ptr(this_ptr);
36297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36299         this_ptr_conv.is_owned = false;
36300         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
36301         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36302         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36303         CVec_u8Z_free(ret_var);
36304         return ret_arr;
36305 }
36306
36307 void  CS_LDK_InboundHTLCErr_set_err_data(int64_t this_ptr, int8_tArray val) {
36308         LDKInboundHTLCErr this_ptr_conv;
36309         this_ptr_conv.inner = untag_ptr(this_ptr);
36310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36312         this_ptr_conv.is_owned = false;
36313         LDKCVec_u8Z val_ref;
36314         val_ref.datalen = val->arr_len;
36315         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36316         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
36317         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
36318 }
36319
36320 jstring  CS_LDK_InboundHTLCErr_get_msg(int64_t this_ptr) {
36321         LDKInboundHTLCErr this_ptr_conv;
36322         this_ptr_conv.inner = untag_ptr(this_ptr);
36323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36325         this_ptr_conv.is_owned = false;
36326         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
36327         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36328         Str_free(ret_str);
36329         return ret_conv;
36330 }
36331
36332 void  CS_LDK_InboundHTLCErr_set_msg(int64_t this_ptr, jstring val) {
36333         LDKInboundHTLCErr this_ptr_conv;
36334         this_ptr_conv.inner = untag_ptr(this_ptr);
36335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36337         this_ptr_conv.is_owned = false;
36338         LDKStr val_conv = str_ref_to_owned_c(val);
36339         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
36340 }
36341
36342 int64_t  CS_LDK_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
36343         LDKCVec_u8Z err_data_arg_ref;
36344         err_data_arg_ref.datalen = err_data_arg->arr_len;
36345         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36346         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
36347         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
36348         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
36349         int64_t ret_ref = 0;
36350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36352         return ret_ref;
36353 }
36354
36355 int64_t  CS_LDK_peel_payment_onion(int64_t msg, int64_t node_signer, int64_t logger, int32_t cur_height, jboolean accept_mpp_keysend, jboolean allow_skimmed_fees) {
36356         LDKUpdateAddHTLC msg_conv;
36357         msg_conv.inner = untag_ptr(msg);
36358         msg_conv.is_owned = ptr_is_owned(msg);
36359         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36360         msg_conv.is_owned = false;
36361         void* node_signer_ptr = untag_ptr(node_signer);
36362         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
36363         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
36364         void* logger_ptr = untag_ptr(logger);
36365         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
36366         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
36367         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
36368         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
36369         return tag_ptr(ret_conv, true);
36370 }
36371
36372 void  CS_LDK_PendingHTLCRouting_free(int64_t this_ptr) {
36373         if (!ptr_is_owned(this_ptr)) return;
36374         void* this_ptr_ptr = untag_ptr(this_ptr);
36375         CHECK_ACCESS(this_ptr_ptr);
36376         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
36377         FREE(untag_ptr(this_ptr));
36378         PendingHTLCRouting_free(this_ptr_conv);
36379 }
36380
36381 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
36382         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36383         *ret_copy = PendingHTLCRouting_clone(arg);
36384         int64_t ret_ref = tag_ptr(ret_copy, true);
36385         return ret_ref;
36386 }
36387 int64_t  CS_LDK_PendingHTLCRouting_clone_ptr(int64_t arg) {
36388         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
36389         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
36390         return ret_conv;
36391 }
36392
36393 int64_t  CS_LDK_PendingHTLCRouting_clone(int64_t orig) {
36394         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
36395         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36396         *ret_copy = PendingHTLCRouting_clone(orig_conv);
36397         int64_t ret_ref = tag_ptr(ret_copy, true);
36398         return ret_ref;
36399 }
36400
36401 int64_t  CS_LDK_PendingHTLCRouting_forward(int64_t onion_packet, int64_t short_channel_id, int64_t blinded) {
36402         LDKOnionPacket onion_packet_conv;
36403         onion_packet_conv.inner = untag_ptr(onion_packet);
36404         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
36405         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
36406         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
36407         LDKBlindedForward blinded_conv;
36408         blinded_conv.inner = untag_ptr(blinded);
36409         blinded_conv.is_owned = ptr_is_owned(blinded);
36410         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
36411         blinded_conv = BlindedForward_clone(&blinded_conv);
36412         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36413         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
36414         int64_t ret_ref = tag_ptr(ret_copy, true);
36415         return ret_ref;
36416 }
36417
36418 int64_t  CS_LDK_PendingHTLCRouting_receive(int64_t payment_data, int64_t payment_metadata, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
36419         LDKFinalOnionHopData payment_data_conv;
36420         payment_data_conv.inner = untag_ptr(payment_data);
36421         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36422         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36423         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36424         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36425         CHECK_ACCESS(payment_metadata_ptr);
36426         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36427         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36428         LDKThirtyTwoBytes phantom_shared_secret_ref;
36429         CHECK(phantom_shared_secret->arr_len == 32);
36430         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
36431         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36432         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36433         if (custom_tlvs_constr.datalen > 0)
36434                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36435         else
36436                 custom_tlvs_constr.data = NULL;
36437         int64_t* custom_tlvs_vals = custom_tlvs->elems;
36438         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36439                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36440                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36441                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36442                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36443                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36444                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36445         }
36446         FREE(custom_tlvs);
36447         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36448         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
36449         int64_t ret_ref = tag_ptr(ret_copy, true);
36450         return ret_ref;
36451 }
36452
36453 int64_t  CS_LDK_PendingHTLCRouting_receive_keysend(int64_t payment_data, int8_tArray payment_preimage, int64_t payment_metadata, int32_t incoming_cltv_expiry, int64_tArray custom_tlvs) {
36454         LDKFinalOnionHopData payment_data_conv;
36455         payment_data_conv.inner = untag_ptr(payment_data);
36456         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36457         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36458         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36459         LDKThirtyTwoBytes payment_preimage_ref;
36460         CHECK(payment_preimage->arr_len == 32);
36461         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
36462         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36463         CHECK_ACCESS(payment_metadata_ptr);
36464         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36465         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36466         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36467         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36468         if (custom_tlvs_constr.datalen > 0)
36469                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36470         else
36471                 custom_tlvs_constr.data = NULL;
36472         int64_t* custom_tlvs_vals = custom_tlvs->elems;
36473         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36474                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36475                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36476                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36477                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36478                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36479                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36480         }
36481         FREE(custom_tlvs);
36482         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36483         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr);
36484         int64_t ret_ref = tag_ptr(ret_copy, true);
36485         return ret_ref;
36486 }
36487
36488 void  CS_LDK_BlindedForward_free(int64_t this_obj) {
36489         LDKBlindedForward this_obj_conv;
36490         this_obj_conv.inner = untag_ptr(this_obj);
36491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36493         BlindedForward_free(this_obj_conv);
36494 }
36495
36496 int8_tArray  CS_LDK_BlindedForward_get_inbound_blinding_point(int64_t this_ptr) {
36497         LDKBlindedForward this_ptr_conv;
36498         this_ptr_conv.inner = untag_ptr(this_ptr);
36499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36501         this_ptr_conv.is_owned = false;
36502         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36503         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
36504         return ret_arr;
36505 }
36506
36507 void  CS_LDK_BlindedForward_set_inbound_blinding_point(int64_t this_ptr, int8_tArray val) {
36508         LDKBlindedForward this_ptr_conv;
36509         this_ptr_conv.inner = untag_ptr(this_ptr);
36510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36512         this_ptr_conv.is_owned = false;
36513         LDKPublicKey val_ref;
36514         CHECK(val->arr_len == 33);
36515         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36516         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
36517 }
36518
36519 int32_t  CS_LDK_BlindedForward_get_failure(int64_t this_ptr) {
36520         LDKBlindedForward this_ptr_conv;
36521         this_ptr_conv.inner = untag_ptr(this_ptr);
36522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36524         this_ptr_conv.is_owned = false;
36525         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedForward_get_failure(&this_ptr_conv));
36526         return ret_conv;
36527 }
36528
36529 void  CS_LDK_BlindedForward_set_failure(int64_t this_ptr, int32_t val) {
36530         LDKBlindedForward this_ptr_conv;
36531         this_ptr_conv.inner = untag_ptr(this_ptr);
36532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36534         this_ptr_conv.is_owned = false;
36535         LDKBlindedFailure val_conv = LDKBlindedFailure_from_cs(val);
36536         BlindedForward_set_failure(&this_ptr_conv, val_conv);
36537 }
36538
36539 int64_t  CS_LDK_BlindedForward_new(int8_tArray inbound_blinding_point_arg, int32_t failure_arg) {
36540         LDKPublicKey inbound_blinding_point_arg_ref;
36541         CHECK(inbound_blinding_point_arg->arr_len == 33);
36542         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
36543         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_cs(failure_arg);
36544         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
36545         int64_t ret_ref = 0;
36546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36548         return ret_ref;
36549 }
36550
36551 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
36552         LDKBlindedForward ret_var = BlindedForward_clone(arg);
36553         int64_t ret_ref = 0;
36554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36556         return ret_ref;
36557 }
36558 int64_t  CS_LDK_BlindedForward_clone_ptr(int64_t arg) {
36559         LDKBlindedForward arg_conv;
36560         arg_conv.inner = untag_ptr(arg);
36561         arg_conv.is_owned = ptr_is_owned(arg);
36562         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36563         arg_conv.is_owned = false;
36564         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
36565         return ret_conv;
36566 }
36567
36568 int64_t  CS_LDK_BlindedForward_clone(int64_t orig) {
36569         LDKBlindedForward orig_conv;
36570         orig_conv.inner = untag_ptr(orig);
36571         orig_conv.is_owned = ptr_is_owned(orig);
36572         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36573         orig_conv.is_owned = false;
36574         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
36575         int64_t ret_ref = 0;
36576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36578         return ret_ref;
36579 }
36580
36581 int64_t  CS_LDK_BlindedForward_hash(int64_t o) {
36582         LDKBlindedForward o_conv;
36583         o_conv.inner = untag_ptr(o);
36584         o_conv.is_owned = ptr_is_owned(o);
36585         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36586         o_conv.is_owned = false;
36587         int64_t ret_conv = BlindedForward_hash(&o_conv);
36588         return ret_conv;
36589 }
36590
36591 jboolean  CS_LDK_BlindedForward_eq(int64_t a, int64_t b) {
36592         LDKBlindedForward a_conv;
36593         a_conv.inner = untag_ptr(a);
36594         a_conv.is_owned = ptr_is_owned(a);
36595         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36596         a_conv.is_owned = false;
36597         LDKBlindedForward b_conv;
36598         b_conv.inner = untag_ptr(b);
36599         b_conv.is_owned = ptr_is_owned(b);
36600         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36601         b_conv.is_owned = false;
36602         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
36603         return ret_conv;
36604 }
36605
36606 void  CS_LDK_PendingHTLCInfo_free(int64_t this_obj) {
36607         LDKPendingHTLCInfo this_obj_conv;
36608         this_obj_conv.inner = untag_ptr(this_obj);
36609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36611         PendingHTLCInfo_free(this_obj_conv);
36612 }
36613
36614 int64_t  CS_LDK_PendingHTLCInfo_get_routing(int64_t this_ptr) {
36615         LDKPendingHTLCInfo this_ptr_conv;
36616         this_ptr_conv.inner = untag_ptr(this_ptr);
36617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36619         this_ptr_conv.is_owned = false;
36620         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36621         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
36622         int64_t ret_ref = tag_ptr(ret_copy, true);
36623         return ret_ref;
36624 }
36625
36626 void  CS_LDK_PendingHTLCInfo_set_routing(int64_t this_ptr, int64_t val) {
36627         LDKPendingHTLCInfo this_ptr_conv;
36628         this_ptr_conv.inner = untag_ptr(this_ptr);
36629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36631         this_ptr_conv.is_owned = false;
36632         void* val_ptr = untag_ptr(val);
36633         CHECK_ACCESS(val_ptr);
36634         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
36635         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
36636         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
36637 }
36638
36639 int8_tArray  CS_LDK_PendingHTLCInfo_get_incoming_shared_secret(int64_t this_ptr) {
36640         LDKPendingHTLCInfo this_ptr_conv;
36641         this_ptr_conv.inner = untag_ptr(this_ptr);
36642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36644         this_ptr_conv.is_owned = false;
36645         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36646         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
36647         return ret_arr;
36648 }
36649
36650 void  CS_LDK_PendingHTLCInfo_set_incoming_shared_secret(int64_t this_ptr, int8_tArray val) {
36651         LDKPendingHTLCInfo this_ptr_conv;
36652         this_ptr_conv.inner = untag_ptr(this_ptr);
36653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36655         this_ptr_conv.is_owned = false;
36656         LDKThirtyTwoBytes val_ref;
36657         CHECK(val->arr_len == 32);
36658         memcpy(val_ref.data, val->elems, 32); FREE(val);
36659         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
36660 }
36661
36662 int8_tArray  CS_LDK_PendingHTLCInfo_get_payment_hash(int64_t this_ptr) {
36663         LDKPendingHTLCInfo this_ptr_conv;
36664         this_ptr_conv.inner = untag_ptr(this_ptr);
36665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36667         this_ptr_conv.is_owned = false;
36668         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36669         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
36670         return ret_arr;
36671 }
36672
36673 void  CS_LDK_PendingHTLCInfo_set_payment_hash(int64_t this_ptr, int8_tArray val) {
36674         LDKPendingHTLCInfo this_ptr_conv;
36675         this_ptr_conv.inner = untag_ptr(this_ptr);
36676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36678         this_ptr_conv.is_owned = false;
36679         LDKThirtyTwoBytes val_ref;
36680         CHECK(val->arr_len == 32);
36681         memcpy(val_ref.data, val->elems, 32); FREE(val);
36682         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
36683 }
36684
36685 int64_t  CS_LDK_PendingHTLCInfo_get_incoming_amt_msat(int64_t this_ptr) {
36686         LDKPendingHTLCInfo this_ptr_conv;
36687         this_ptr_conv.inner = untag_ptr(this_ptr);
36688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36690         this_ptr_conv.is_owned = false;
36691         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36692         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
36693         int64_t ret_ref = tag_ptr(ret_copy, true);
36694         return ret_ref;
36695 }
36696
36697 void  CS_LDK_PendingHTLCInfo_set_incoming_amt_msat(int64_t this_ptr, int64_t val) {
36698         LDKPendingHTLCInfo this_ptr_conv;
36699         this_ptr_conv.inner = untag_ptr(this_ptr);
36700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36702         this_ptr_conv.is_owned = false;
36703         void* val_ptr = untag_ptr(val);
36704         CHECK_ACCESS(val_ptr);
36705         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36706         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36707         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
36708 }
36709
36710 int64_t  CS_LDK_PendingHTLCInfo_get_outgoing_amt_msat(int64_t this_ptr) {
36711         LDKPendingHTLCInfo this_ptr_conv;
36712         this_ptr_conv.inner = untag_ptr(this_ptr);
36713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36715         this_ptr_conv.is_owned = false;
36716         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
36717         return ret_conv;
36718 }
36719
36720 void  CS_LDK_PendingHTLCInfo_set_outgoing_amt_msat(int64_t this_ptr, int64_t val) {
36721         LDKPendingHTLCInfo this_ptr_conv;
36722         this_ptr_conv.inner = untag_ptr(this_ptr);
36723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36725         this_ptr_conv.is_owned = false;
36726         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
36727 }
36728
36729 int32_t  CS_LDK_PendingHTLCInfo_get_outgoing_cltv_value(int64_t this_ptr) {
36730         LDKPendingHTLCInfo this_ptr_conv;
36731         this_ptr_conv.inner = untag_ptr(this_ptr);
36732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36734         this_ptr_conv.is_owned = false;
36735         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
36736         return ret_conv;
36737 }
36738
36739 void  CS_LDK_PendingHTLCInfo_set_outgoing_cltv_value(int64_t this_ptr, int32_t val) {
36740         LDKPendingHTLCInfo this_ptr_conv;
36741         this_ptr_conv.inner = untag_ptr(this_ptr);
36742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36744         this_ptr_conv.is_owned = false;
36745         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
36746 }
36747
36748 int64_t  CS_LDK_PendingHTLCInfo_get_skimmed_fee_msat(int64_t this_ptr) {
36749         LDKPendingHTLCInfo this_ptr_conv;
36750         this_ptr_conv.inner = untag_ptr(this_ptr);
36751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36753         this_ptr_conv.is_owned = false;
36754         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36755         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
36756         int64_t ret_ref = tag_ptr(ret_copy, true);
36757         return ret_ref;
36758 }
36759
36760 void  CS_LDK_PendingHTLCInfo_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
36761         LDKPendingHTLCInfo this_ptr_conv;
36762         this_ptr_conv.inner = untag_ptr(this_ptr);
36763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36765         this_ptr_conv.is_owned = false;
36766         void* val_ptr = untag_ptr(val);
36767         CHECK_ACCESS(val_ptr);
36768         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36769         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36770         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
36771 }
36772
36773 int64_t  CS_LDK_PendingHTLCInfo_new(int64_t routing_arg, int8_tArray incoming_shared_secret_arg, int8_tArray payment_hash_arg, int64_t incoming_amt_msat_arg, int64_t outgoing_amt_msat_arg, int32_t outgoing_cltv_value_arg, int64_t skimmed_fee_msat_arg) {
36774         void* routing_arg_ptr = untag_ptr(routing_arg);
36775         CHECK_ACCESS(routing_arg_ptr);
36776         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
36777         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
36778         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
36779         CHECK(incoming_shared_secret_arg->arr_len == 32);
36780         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
36781         LDKThirtyTwoBytes payment_hash_arg_ref;
36782         CHECK(payment_hash_arg->arr_len == 32);
36783         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
36784         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
36785         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
36786         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
36787         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
36788         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
36789         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
36790         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
36791         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
36792         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_new(routing_arg_conv, incoming_shared_secret_arg_ref, payment_hash_arg_ref, incoming_amt_msat_arg_conv, outgoing_amt_msat_arg, outgoing_cltv_value_arg, skimmed_fee_msat_arg_conv);
36793         int64_t ret_ref = 0;
36794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36796         return ret_ref;
36797 }
36798
36799 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
36800         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
36801         int64_t ret_ref = 0;
36802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36804         return ret_ref;
36805 }
36806 int64_t  CS_LDK_PendingHTLCInfo_clone_ptr(int64_t arg) {
36807         LDKPendingHTLCInfo arg_conv;
36808         arg_conv.inner = untag_ptr(arg);
36809         arg_conv.is_owned = ptr_is_owned(arg);
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36811         arg_conv.is_owned = false;
36812         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
36813         return ret_conv;
36814 }
36815
36816 int64_t  CS_LDK_PendingHTLCInfo_clone(int64_t orig) {
36817         LDKPendingHTLCInfo orig_conv;
36818         orig_conv.inner = untag_ptr(orig);
36819         orig_conv.is_owned = ptr_is_owned(orig);
36820         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36821         orig_conv.is_owned = false;
36822         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
36823         int64_t ret_ref = 0;
36824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36826         return ret_ref;
36827 }
36828
36829 int32_t  CS_LDK_BlindedFailure_clone(int64_t orig) {
36830         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
36831         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_clone(orig_conv));
36832         return ret_conv;
36833 }
36834
36835 int32_t  CS_LDK_BlindedFailure_from_introduction_node() {
36836         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_introduction_node());
36837         return ret_conv;
36838 }
36839
36840 int32_t  CS_LDK_BlindedFailure_from_blinded_node() {
36841         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_blinded_node());
36842         return ret_conv;
36843 }
36844
36845 int64_t  CS_LDK_BlindedFailure_hash(int64_t o) {
36846         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
36847         int64_t ret_conv = BlindedFailure_hash(o_conv);
36848         return ret_conv;
36849 }
36850
36851 jboolean  CS_LDK_BlindedFailure_eq(int64_t a, int64_t b) {
36852         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
36853         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
36854         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
36855         return ret_conv;
36856 }
36857
36858 void  CS_LDK_FailureCode_free(int64_t this_ptr) {
36859         if (!ptr_is_owned(this_ptr)) return;
36860         void* this_ptr_ptr = untag_ptr(this_ptr);
36861         CHECK_ACCESS(this_ptr_ptr);
36862         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
36863         FREE(untag_ptr(this_ptr));
36864         FailureCode_free(this_ptr_conv);
36865 }
36866
36867 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
36868         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36869         *ret_copy = FailureCode_clone(arg);
36870         int64_t ret_ref = tag_ptr(ret_copy, true);
36871         return ret_ref;
36872 }
36873 int64_t  CS_LDK_FailureCode_clone_ptr(int64_t arg) {
36874         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
36875         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
36876         return ret_conv;
36877 }
36878
36879 int64_t  CS_LDK_FailureCode_clone(int64_t orig) {
36880         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
36881         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36882         *ret_copy = FailureCode_clone(orig_conv);
36883         int64_t ret_ref = tag_ptr(ret_copy, true);
36884         return ret_ref;
36885 }
36886
36887 int64_t  CS_LDK_FailureCode_temporary_node_failure() {
36888         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36889         *ret_copy = FailureCode_temporary_node_failure();
36890         int64_t ret_ref = tag_ptr(ret_copy, true);
36891         return ret_ref;
36892 }
36893
36894 int64_t  CS_LDK_FailureCode_required_node_feature_missing() {
36895         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36896         *ret_copy = FailureCode_required_node_feature_missing();
36897         int64_t ret_ref = tag_ptr(ret_copy, true);
36898         return ret_ref;
36899 }
36900
36901 int64_t  CS_LDK_FailureCode_incorrect_or_unknown_payment_details() {
36902         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36903         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
36904         int64_t ret_ref = tag_ptr(ret_copy, true);
36905         return ret_ref;
36906 }
36907
36908 int64_t  CS_LDK_FailureCode_invalid_onion_payload(int64_t a) {
36909         void* a_ptr = untag_ptr(a);
36910         CHECK_ACCESS(a_ptr);
36911         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
36912         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
36913         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36914         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
36915         int64_t ret_ref = tag_ptr(ret_copy, true);
36916         return ret_ref;
36917 }
36918
36919 void  CS_LDK_ChannelManager_free(int64_t this_obj) {
36920         LDKChannelManager this_obj_conv;
36921         this_obj_conv.inner = untag_ptr(this_obj);
36922         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36924         ChannelManager_free(this_obj_conv);
36925 }
36926
36927 void  CS_LDK_ChainParameters_free(int64_t this_obj) {
36928         LDKChainParameters this_obj_conv;
36929         this_obj_conv.inner = untag_ptr(this_obj);
36930         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36932         ChainParameters_free(this_obj_conv);
36933 }
36934
36935 int32_t  CS_LDK_ChainParameters_get_network(int64_t this_ptr) {
36936         LDKChainParameters this_ptr_conv;
36937         this_ptr_conv.inner = untag_ptr(this_ptr);
36938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36940         this_ptr_conv.is_owned = false;
36941         int32_t ret_conv = LDKNetwork_to_cs(ChainParameters_get_network(&this_ptr_conv));
36942         return ret_conv;
36943 }
36944
36945 void  CS_LDK_ChainParameters_set_network(int64_t this_ptr, int32_t val) {
36946         LDKChainParameters this_ptr_conv;
36947         this_ptr_conv.inner = untag_ptr(this_ptr);
36948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36950         this_ptr_conv.is_owned = false;
36951         LDKNetwork val_conv = LDKNetwork_from_cs(val);
36952         ChainParameters_set_network(&this_ptr_conv, val_conv);
36953 }
36954
36955 int64_t  CS_LDK_ChainParameters_get_best_block(int64_t this_ptr) {
36956         LDKChainParameters this_ptr_conv;
36957         this_ptr_conv.inner = untag_ptr(this_ptr);
36958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36960         this_ptr_conv.is_owned = false;
36961         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
36962         int64_t ret_ref = 0;
36963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36965         return ret_ref;
36966 }
36967
36968 void  CS_LDK_ChainParameters_set_best_block(int64_t this_ptr, int64_t val) {
36969         LDKChainParameters this_ptr_conv;
36970         this_ptr_conv.inner = untag_ptr(this_ptr);
36971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36973         this_ptr_conv.is_owned = false;
36974         LDKBestBlock val_conv;
36975         val_conv.inner = untag_ptr(val);
36976         val_conv.is_owned = ptr_is_owned(val);
36977         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36978         val_conv = BestBlock_clone(&val_conv);
36979         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
36980 }
36981
36982 int64_t  CS_LDK_ChainParameters_new(int32_t network_arg, int64_t best_block_arg) {
36983         LDKNetwork network_arg_conv = LDKNetwork_from_cs(network_arg);
36984         LDKBestBlock best_block_arg_conv;
36985         best_block_arg_conv.inner = untag_ptr(best_block_arg);
36986         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
36987         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
36988         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
36989         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
36990         int64_t ret_ref = 0;
36991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36993         return ret_ref;
36994 }
36995
36996 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
36997         LDKChainParameters ret_var = ChainParameters_clone(arg);
36998         int64_t ret_ref = 0;
36999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37001         return ret_ref;
37002 }
37003 int64_t  CS_LDK_ChainParameters_clone_ptr(int64_t arg) {
37004         LDKChainParameters arg_conv;
37005         arg_conv.inner = untag_ptr(arg);
37006         arg_conv.is_owned = ptr_is_owned(arg);
37007         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37008         arg_conv.is_owned = false;
37009         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
37010         return ret_conv;
37011 }
37012
37013 int64_t  CS_LDK_ChainParameters_clone(int64_t orig) {
37014         LDKChainParameters orig_conv;
37015         orig_conv.inner = untag_ptr(orig);
37016         orig_conv.is_owned = ptr_is_owned(orig);
37017         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37018         orig_conv.is_owned = false;
37019         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
37020         int64_t ret_ref = 0;
37021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37023         return ret_ref;
37024 }
37025
37026 void  CS_LDK_CounterpartyForwardingInfo_free(int64_t this_obj) {
37027         LDKCounterpartyForwardingInfo this_obj_conv;
37028         this_obj_conv.inner = untag_ptr(this_obj);
37029         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37031         CounterpartyForwardingInfo_free(this_obj_conv);
37032 }
37033
37034 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_base_msat(int64_t this_ptr) {
37035         LDKCounterpartyForwardingInfo this_ptr_conv;
37036         this_ptr_conv.inner = untag_ptr(this_ptr);
37037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37039         this_ptr_conv.is_owned = false;
37040         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
37041         return ret_conv;
37042 }
37043
37044 void  CS_LDK_CounterpartyForwardingInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
37045         LDKCounterpartyForwardingInfo this_ptr_conv;
37046         this_ptr_conv.inner = untag_ptr(this_ptr);
37047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37049         this_ptr_conv.is_owned = false;
37050         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
37051 }
37052
37053 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_proportional_millionths(int64_t this_ptr) {
37054         LDKCounterpartyForwardingInfo this_ptr_conv;
37055         this_ptr_conv.inner = untag_ptr(this_ptr);
37056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37058         this_ptr_conv.is_owned = false;
37059         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
37060         return ret_conv;
37061 }
37062
37063 void  CS_LDK_CounterpartyForwardingInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
37064         LDKCounterpartyForwardingInfo this_ptr_conv;
37065         this_ptr_conv.inner = untag_ptr(this_ptr);
37066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37068         this_ptr_conv.is_owned = false;
37069         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
37070 }
37071
37072 int16_t  CS_LDK_CounterpartyForwardingInfo_get_cltv_expiry_delta(int64_t this_ptr) {
37073         LDKCounterpartyForwardingInfo this_ptr_conv;
37074         this_ptr_conv.inner = untag_ptr(this_ptr);
37075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37077         this_ptr_conv.is_owned = false;
37078         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
37079         return ret_conv;
37080 }
37081
37082 void  CS_LDK_CounterpartyForwardingInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
37083         LDKCounterpartyForwardingInfo this_ptr_conv;
37084         this_ptr_conv.inner = untag_ptr(this_ptr);
37085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37087         this_ptr_conv.is_owned = false;
37088         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
37089 }
37090
37091 int64_t  CS_LDK_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
37092         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
37093         int64_t ret_ref = 0;
37094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37096         return ret_ref;
37097 }
37098
37099 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
37100         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
37101         int64_t ret_ref = 0;
37102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37104         return ret_ref;
37105 }
37106 int64_t  CS_LDK_CounterpartyForwardingInfo_clone_ptr(int64_t arg) {
37107         LDKCounterpartyForwardingInfo arg_conv;
37108         arg_conv.inner = untag_ptr(arg);
37109         arg_conv.is_owned = ptr_is_owned(arg);
37110         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37111         arg_conv.is_owned = false;
37112         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
37113         return ret_conv;
37114 }
37115
37116 int64_t  CS_LDK_CounterpartyForwardingInfo_clone(int64_t orig) {
37117         LDKCounterpartyForwardingInfo orig_conv;
37118         orig_conv.inner = untag_ptr(orig);
37119         orig_conv.is_owned = ptr_is_owned(orig);
37120         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37121         orig_conv.is_owned = false;
37122         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
37123         int64_t ret_ref = 0;
37124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37126         return ret_ref;
37127 }
37128
37129 void  CS_LDK_ChannelCounterparty_free(int64_t this_obj) {
37130         LDKChannelCounterparty this_obj_conv;
37131         this_obj_conv.inner = untag_ptr(this_obj);
37132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37134         ChannelCounterparty_free(this_obj_conv);
37135 }
37136
37137 int8_tArray  CS_LDK_ChannelCounterparty_get_node_id(int64_t this_ptr) {
37138         LDKChannelCounterparty this_ptr_conv;
37139         this_ptr_conv.inner = untag_ptr(this_ptr);
37140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37142         this_ptr_conv.is_owned = false;
37143         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37144         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
37145         return ret_arr;
37146 }
37147
37148 void  CS_LDK_ChannelCounterparty_set_node_id(int64_t this_ptr, int8_tArray val) {
37149         LDKChannelCounterparty this_ptr_conv;
37150         this_ptr_conv.inner = untag_ptr(this_ptr);
37151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37153         this_ptr_conv.is_owned = false;
37154         LDKPublicKey val_ref;
37155         CHECK(val->arr_len == 33);
37156         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37157         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
37158 }
37159
37160 int64_t  CS_LDK_ChannelCounterparty_get_features(int64_t this_ptr) {
37161         LDKChannelCounterparty this_ptr_conv;
37162         this_ptr_conv.inner = untag_ptr(this_ptr);
37163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37165         this_ptr_conv.is_owned = false;
37166         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
37167         int64_t ret_ref = 0;
37168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37170         return ret_ref;
37171 }
37172
37173 void  CS_LDK_ChannelCounterparty_set_features(int64_t this_ptr, int64_t val) {
37174         LDKChannelCounterparty this_ptr_conv;
37175         this_ptr_conv.inner = untag_ptr(this_ptr);
37176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37178         this_ptr_conv.is_owned = false;
37179         LDKInitFeatures val_conv;
37180         val_conv.inner = untag_ptr(val);
37181         val_conv.is_owned = ptr_is_owned(val);
37182         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37183         val_conv = InitFeatures_clone(&val_conv);
37184         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
37185 }
37186
37187 int64_t  CS_LDK_ChannelCounterparty_get_unspendable_punishment_reserve(int64_t this_ptr) {
37188         LDKChannelCounterparty this_ptr_conv;
37189         this_ptr_conv.inner = untag_ptr(this_ptr);
37190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37192         this_ptr_conv.is_owned = false;
37193         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
37194         return ret_conv;
37195 }
37196
37197 void  CS_LDK_ChannelCounterparty_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
37198         LDKChannelCounterparty this_ptr_conv;
37199         this_ptr_conv.inner = untag_ptr(this_ptr);
37200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37202         this_ptr_conv.is_owned = false;
37203         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
37204 }
37205
37206 int64_t  CS_LDK_ChannelCounterparty_get_forwarding_info(int64_t this_ptr) {
37207         LDKChannelCounterparty this_ptr_conv;
37208         this_ptr_conv.inner = untag_ptr(this_ptr);
37209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37211         this_ptr_conv.is_owned = false;
37212         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
37213         int64_t ret_ref = 0;
37214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37216         return ret_ref;
37217 }
37218
37219 void  CS_LDK_ChannelCounterparty_set_forwarding_info(int64_t this_ptr, int64_t val) {
37220         LDKChannelCounterparty this_ptr_conv;
37221         this_ptr_conv.inner = untag_ptr(this_ptr);
37222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37224         this_ptr_conv.is_owned = false;
37225         LDKCounterpartyForwardingInfo val_conv;
37226         val_conv.inner = untag_ptr(val);
37227         val_conv.is_owned = ptr_is_owned(val);
37228         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37229         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
37230         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
37231 }
37232
37233 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_minimum_msat(int64_t this_ptr) {
37234         LDKChannelCounterparty this_ptr_conv;
37235         this_ptr_conv.inner = untag_ptr(this_ptr);
37236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37238         this_ptr_conv.is_owned = false;
37239         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37240         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
37241         int64_t ret_ref = tag_ptr(ret_copy, true);
37242         return ret_ref;
37243 }
37244
37245 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37246         LDKChannelCounterparty this_ptr_conv;
37247         this_ptr_conv.inner = untag_ptr(this_ptr);
37248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37250         this_ptr_conv.is_owned = false;
37251         void* val_ptr = untag_ptr(val);
37252         CHECK_ACCESS(val_ptr);
37253         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37254         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37255         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37256 }
37257
37258 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_maximum_msat(int64_t this_ptr) {
37259         LDKChannelCounterparty this_ptr_conv;
37260         this_ptr_conv.inner = untag_ptr(this_ptr);
37261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37263         this_ptr_conv.is_owned = false;
37264         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37265         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
37266         int64_t ret_ref = tag_ptr(ret_copy, true);
37267         return ret_ref;
37268 }
37269
37270 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
37271         LDKChannelCounterparty this_ptr_conv;
37272         this_ptr_conv.inner = untag_ptr(this_ptr);
37273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37275         this_ptr_conv.is_owned = false;
37276         void* val_ptr = untag_ptr(val);
37277         CHECK_ACCESS(val_ptr);
37278         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37279         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37280         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37281 }
37282
37283 int64_t  CS_LDK_ChannelCounterparty_new(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) {
37284         LDKPublicKey node_id_arg_ref;
37285         CHECK(node_id_arg->arr_len == 33);
37286         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
37287         LDKInitFeatures features_arg_conv;
37288         features_arg_conv.inner = untag_ptr(features_arg);
37289         features_arg_conv.is_owned = ptr_is_owned(features_arg);
37290         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
37291         features_arg_conv = InitFeatures_clone(&features_arg_conv);
37292         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
37293         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
37294         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
37295         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
37296         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
37297         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
37298         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
37299         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
37300         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
37301         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
37302         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
37303         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
37304         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
37305         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);
37306         int64_t ret_ref = 0;
37307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37309         return ret_ref;
37310 }
37311
37312 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
37313         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
37314         int64_t ret_ref = 0;
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37317         return ret_ref;
37318 }
37319 int64_t  CS_LDK_ChannelCounterparty_clone_ptr(int64_t arg) {
37320         LDKChannelCounterparty arg_conv;
37321         arg_conv.inner = untag_ptr(arg);
37322         arg_conv.is_owned = ptr_is_owned(arg);
37323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37324         arg_conv.is_owned = false;
37325         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
37326         return ret_conv;
37327 }
37328
37329 int64_t  CS_LDK_ChannelCounterparty_clone(int64_t orig) {
37330         LDKChannelCounterparty orig_conv;
37331         orig_conv.inner = untag_ptr(orig);
37332         orig_conv.is_owned = ptr_is_owned(orig);
37333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37334         orig_conv.is_owned = false;
37335         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
37336         int64_t ret_ref = 0;
37337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37339         return ret_ref;
37340 }
37341
37342 void  CS_LDK_ChannelDetails_free(int64_t this_obj) {
37343         LDKChannelDetails this_obj_conv;
37344         this_obj_conv.inner = untag_ptr(this_obj);
37345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37347         ChannelDetails_free(this_obj_conv);
37348 }
37349
37350 int8_tArray  CS_LDK_ChannelDetails_get_channel_id(int64_t this_ptr) {
37351         LDKChannelDetails 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37357         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
37358         return ret_arr;
37359 }
37360
37361 void  CS_LDK_ChannelDetails_set_channel_id(int64_t this_ptr, int8_tArray val) {
37362         LDKChannelDetails this_ptr_conv;
37363         this_ptr_conv.inner = untag_ptr(this_ptr);
37364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37366         this_ptr_conv.is_owned = false;
37367         LDKThirtyTwoBytes val_ref;
37368         CHECK(val->arr_len == 32);
37369         memcpy(val_ref.data, val->elems, 32); FREE(val);
37370         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
37371 }
37372
37373 int64_t  CS_LDK_ChannelDetails_get_counterparty(int64_t this_ptr) {
37374         LDKChannelDetails this_ptr_conv;
37375         this_ptr_conv.inner = untag_ptr(this_ptr);
37376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37378         this_ptr_conv.is_owned = false;
37379         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
37380         int64_t ret_ref = 0;
37381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37383         return ret_ref;
37384 }
37385
37386 void  CS_LDK_ChannelDetails_set_counterparty(int64_t this_ptr, int64_t val) {
37387         LDKChannelDetails this_ptr_conv;
37388         this_ptr_conv.inner = untag_ptr(this_ptr);
37389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37391         this_ptr_conv.is_owned = false;
37392         LDKChannelCounterparty val_conv;
37393         val_conv.inner = untag_ptr(val);
37394         val_conv.is_owned = ptr_is_owned(val);
37395         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37396         val_conv = ChannelCounterparty_clone(&val_conv);
37397         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
37398 }
37399
37400 int64_t  CS_LDK_ChannelDetails_get_funding_txo(int64_t this_ptr) {
37401         LDKChannelDetails this_ptr_conv;
37402         this_ptr_conv.inner = untag_ptr(this_ptr);
37403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37405         this_ptr_conv.is_owned = false;
37406         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
37407         int64_t ret_ref = 0;
37408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37410         return ret_ref;
37411 }
37412
37413 void  CS_LDK_ChannelDetails_set_funding_txo(int64_t this_ptr, int64_t val) {
37414         LDKChannelDetails this_ptr_conv;
37415         this_ptr_conv.inner = untag_ptr(this_ptr);
37416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37418         this_ptr_conv.is_owned = false;
37419         LDKOutPoint val_conv;
37420         val_conv.inner = untag_ptr(val);
37421         val_conv.is_owned = ptr_is_owned(val);
37422         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37423         val_conv = OutPoint_clone(&val_conv);
37424         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
37425 }
37426
37427 int64_t  CS_LDK_ChannelDetails_get_channel_type(int64_t this_ptr) {
37428         LDKChannelDetails this_ptr_conv;
37429         this_ptr_conv.inner = untag_ptr(this_ptr);
37430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37432         this_ptr_conv.is_owned = false;
37433         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
37434         int64_t ret_ref = 0;
37435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37437         return ret_ref;
37438 }
37439
37440 void  CS_LDK_ChannelDetails_set_channel_type(int64_t this_ptr, int64_t val) {
37441         LDKChannelDetails this_ptr_conv;
37442         this_ptr_conv.inner = untag_ptr(this_ptr);
37443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37445         this_ptr_conv.is_owned = false;
37446         LDKChannelTypeFeatures val_conv;
37447         val_conv.inner = untag_ptr(val);
37448         val_conv.is_owned = ptr_is_owned(val);
37449         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37450         val_conv = ChannelTypeFeatures_clone(&val_conv);
37451         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
37452 }
37453
37454 int64_t  CS_LDK_ChannelDetails_get_short_channel_id(int64_t this_ptr) {
37455         LDKChannelDetails this_ptr_conv;
37456         this_ptr_conv.inner = untag_ptr(this_ptr);
37457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37459         this_ptr_conv.is_owned = false;
37460         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37461         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
37462         int64_t ret_ref = tag_ptr(ret_copy, true);
37463         return ret_ref;
37464 }
37465
37466 void  CS_LDK_ChannelDetails_set_short_channel_id(int64_t this_ptr, int64_t val) {
37467         LDKChannelDetails this_ptr_conv;
37468         this_ptr_conv.inner = untag_ptr(this_ptr);
37469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37471         this_ptr_conv.is_owned = false;
37472         void* val_ptr = untag_ptr(val);
37473         CHECK_ACCESS(val_ptr);
37474         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37475         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37476         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
37477 }
37478
37479 int64_t  CS_LDK_ChannelDetails_get_outbound_scid_alias(int64_t this_ptr) {
37480         LDKChannelDetails this_ptr_conv;
37481         this_ptr_conv.inner = untag_ptr(this_ptr);
37482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37484         this_ptr_conv.is_owned = false;
37485         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37486         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
37487         int64_t ret_ref = tag_ptr(ret_copy, true);
37488         return ret_ref;
37489 }
37490
37491 void  CS_LDK_ChannelDetails_set_outbound_scid_alias(int64_t this_ptr, int64_t val) {
37492         LDKChannelDetails this_ptr_conv;
37493         this_ptr_conv.inner = untag_ptr(this_ptr);
37494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37496         this_ptr_conv.is_owned = false;
37497         void* val_ptr = untag_ptr(val);
37498         CHECK_ACCESS(val_ptr);
37499         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37500         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37501         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
37502 }
37503
37504 int64_t  CS_LDK_ChannelDetails_get_inbound_scid_alias(int64_t this_ptr) {
37505         LDKChannelDetails this_ptr_conv;
37506         this_ptr_conv.inner = untag_ptr(this_ptr);
37507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37509         this_ptr_conv.is_owned = false;
37510         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37511         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
37512         int64_t ret_ref = tag_ptr(ret_copy, true);
37513         return ret_ref;
37514 }
37515
37516 void  CS_LDK_ChannelDetails_set_inbound_scid_alias(int64_t this_ptr, int64_t val) {
37517         LDKChannelDetails this_ptr_conv;
37518         this_ptr_conv.inner = untag_ptr(this_ptr);
37519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37521         this_ptr_conv.is_owned = false;
37522         void* val_ptr = untag_ptr(val);
37523         CHECK_ACCESS(val_ptr);
37524         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37525         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37526         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
37527 }
37528
37529 int64_t  CS_LDK_ChannelDetails_get_channel_value_satoshis(int64_t this_ptr) {
37530         LDKChannelDetails this_ptr_conv;
37531         this_ptr_conv.inner = untag_ptr(this_ptr);
37532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37534         this_ptr_conv.is_owned = false;
37535         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
37536         return ret_conv;
37537 }
37538
37539 void  CS_LDK_ChannelDetails_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
37540         LDKChannelDetails this_ptr_conv;
37541         this_ptr_conv.inner = untag_ptr(this_ptr);
37542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37544         this_ptr_conv.is_owned = false;
37545         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
37546 }
37547
37548 int64_t  CS_LDK_ChannelDetails_get_unspendable_punishment_reserve(int64_t this_ptr) {
37549         LDKChannelDetails this_ptr_conv;
37550         this_ptr_conv.inner = untag_ptr(this_ptr);
37551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37553         this_ptr_conv.is_owned = false;
37554         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37555         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
37556         int64_t ret_ref = tag_ptr(ret_copy, true);
37557         return ret_ref;
37558 }
37559
37560 void  CS_LDK_ChannelDetails_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
37561         LDKChannelDetails this_ptr_conv;
37562         this_ptr_conv.inner = untag_ptr(this_ptr);
37563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37565         this_ptr_conv.is_owned = false;
37566         void* val_ptr = untag_ptr(val);
37567         CHECK_ACCESS(val_ptr);
37568         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37569         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37570         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
37571 }
37572
37573 int8_tArray  CS_LDK_ChannelDetails_get_user_channel_id(int64_t this_ptr) {
37574         LDKChannelDetails this_ptr_conv;
37575         this_ptr_conv.inner = untag_ptr(this_ptr);
37576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37578         this_ptr_conv.is_owned = false;
37579         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
37580         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
37581         return ret_arr;
37582 }
37583
37584 void  CS_LDK_ChannelDetails_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
37585         LDKChannelDetails this_ptr_conv;
37586         this_ptr_conv.inner = untag_ptr(this_ptr);
37587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37589         this_ptr_conv.is_owned = false;
37590         LDKU128 val_ref;
37591         CHECK(val->arr_len == 16);
37592         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
37593         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
37594 }
37595
37596 int64_t  CS_LDK_ChannelDetails_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
37597         LDKChannelDetails this_ptr_conv;
37598         this_ptr_conv.inner = untag_ptr(this_ptr);
37599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37601         this_ptr_conv.is_owned = false;
37602         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37603         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
37604         int64_t ret_ref = tag_ptr(ret_copy, true);
37605         return ret_ref;
37606 }
37607
37608 void  CS_LDK_ChannelDetails_set_feerate_sat_per_1000_weight(int64_t this_ptr, int64_t val) {
37609         LDKChannelDetails this_ptr_conv;
37610         this_ptr_conv.inner = untag_ptr(this_ptr);
37611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37613         this_ptr_conv.is_owned = false;
37614         void* val_ptr = untag_ptr(val);
37615         CHECK_ACCESS(val_ptr);
37616         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37617         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37618         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
37619 }
37620
37621 int64_t  CS_LDK_ChannelDetails_get_balance_msat(int64_t this_ptr) {
37622         LDKChannelDetails this_ptr_conv;
37623         this_ptr_conv.inner = untag_ptr(this_ptr);
37624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37626         this_ptr_conv.is_owned = false;
37627         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
37628         return ret_conv;
37629 }
37630
37631 void  CS_LDK_ChannelDetails_set_balance_msat(int64_t this_ptr, int64_t val) {
37632         LDKChannelDetails this_ptr_conv;
37633         this_ptr_conv.inner = untag_ptr(this_ptr);
37634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37636         this_ptr_conv.is_owned = false;
37637         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
37638 }
37639
37640 int64_t  CS_LDK_ChannelDetails_get_outbound_capacity_msat(int64_t this_ptr) {
37641         LDKChannelDetails this_ptr_conv;
37642         this_ptr_conv.inner = untag_ptr(this_ptr);
37643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37645         this_ptr_conv.is_owned = false;
37646         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
37647         return ret_conv;
37648 }
37649
37650 void  CS_LDK_ChannelDetails_set_outbound_capacity_msat(int64_t this_ptr, int64_t val) {
37651         LDKChannelDetails this_ptr_conv;
37652         this_ptr_conv.inner = untag_ptr(this_ptr);
37653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37655         this_ptr_conv.is_owned = false;
37656         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
37657 }
37658
37659 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_limit_msat(int64_t this_ptr) {
37660         LDKChannelDetails this_ptr_conv;
37661         this_ptr_conv.inner = untag_ptr(this_ptr);
37662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37664         this_ptr_conv.is_owned = false;
37665         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
37666         return ret_conv;
37667 }
37668
37669 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_limit_msat(int64_t this_ptr, int64_t val) {
37670         LDKChannelDetails this_ptr_conv;
37671         this_ptr_conv.inner = untag_ptr(this_ptr);
37672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37674         this_ptr_conv.is_owned = false;
37675         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
37676 }
37677
37678 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_minimum_msat(int64_t this_ptr) {
37679         LDKChannelDetails this_ptr_conv;
37680         this_ptr_conv.inner = untag_ptr(this_ptr);
37681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37683         this_ptr_conv.is_owned = false;
37684         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
37685         return ret_conv;
37686 }
37687
37688 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37689         LDKChannelDetails this_ptr_conv;
37690         this_ptr_conv.inner = untag_ptr(this_ptr);
37691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37693         this_ptr_conv.is_owned = false;
37694         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
37695 }
37696
37697 int64_t  CS_LDK_ChannelDetails_get_inbound_capacity_msat(int64_t this_ptr) {
37698         LDKChannelDetails this_ptr_conv;
37699         this_ptr_conv.inner = untag_ptr(this_ptr);
37700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37702         this_ptr_conv.is_owned = false;
37703         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
37704         return ret_conv;
37705 }
37706
37707 void  CS_LDK_ChannelDetails_set_inbound_capacity_msat(int64_t this_ptr, int64_t val) {
37708         LDKChannelDetails this_ptr_conv;
37709         this_ptr_conv.inner = untag_ptr(this_ptr);
37710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37712         this_ptr_conv.is_owned = false;
37713         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
37714 }
37715
37716 int64_t  CS_LDK_ChannelDetails_get_confirmations_required(int64_t this_ptr) {
37717         LDKChannelDetails this_ptr_conv;
37718         this_ptr_conv.inner = untag_ptr(this_ptr);
37719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37721         this_ptr_conv.is_owned = false;
37722         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37723         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
37724         int64_t ret_ref = tag_ptr(ret_copy, true);
37725         return ret_ref;
37726 }
37727
37728 void  CS_LDK_ChannelDetails_set_confirmations_required(int64_t this_ptr, int64_t val) {
37729         LDKChannelDetails this_ptr_conv;
37730         this_ptr_conv.inner = untag_ptr(this_ptr);
37731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37733         this_ptr_conv.is_owned = false;
37734         void* val_ptr = untag_ptr(val);
37735         CHECK_ACCESS(val_ptr);
37736         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37737         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37738         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
37739 }
37740
37741 int64_t  CS_LDK_ChannelDetails_get_confirmations(int64_t this_ptr) {
37742         LDKChannelDetails this_ptr_conv;
37743         this_ptr_conv.inner = untag_ptr(this_ptr);
37744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37746         this_ptr_conv.is_owned = false;
37747         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37748         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
37749         int64_t ret_ref = tag_ptr(ret_copy, true);
37750         return ret_ref;
37751 }
37752
37753 void  CS_LDK_ChannelDetails_set_confirmations(int64_t this_ptr, int64_t val) {
37754         LDKChannelDetails this_ptr_conv;
37755         this_ptr_conv.inner = untag_ptr(this_ptr);
37756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37758         this_ptr_conv.is_owned = false;
37759         void* val_ptr = untag_ptr(val);
37760         CHECK_ACCESS(val_ptr);
37761         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37762         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37763         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
37764 }
37765
37766 int64_t  CS_LDK_ChannelDetails_get_force_close_spend_delay(int64_t this_ptr) {
37767         LDKChannelDetails this_ptr_conv;
37768         this_ptr_conv.inner = untag_ptr(this_ptr);
37769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37771         this_ptr_conv.is_owned = false;
37772         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37773         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
37774         int64_t ret_ref = tag_ptr(ret_copy, true);
37775         return ret_ref;
37776 }
37777
37778 void  CS_LDK_ChannelDetails_set_force_close_spend_delay(int64_t this_ptr, int64_t val) {
37779         LDKChannelDetails this_ptr_conv;
37780         this_ptr_conv.inner = untag_ptr(this_ptr);
37781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37783         this_ptr_conv.is_owned = false;
37784         void* val_ptr = untag_ptr(val);
37785         CHECK_ACCESS(val_ptr);
37786         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37787         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37788         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
37789 }
37790
37791 jboolean  CS_LDK_ChannelDetails_get_is_outbound(int64_t this_ptr) {
37792         LDKChannelDetails this_ptr_conv;
37793         this_ptr_conv.inner = untag_ptr(this_ptr);
37794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37796         this_ptr_conv.is_owned = false;
37797         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
37798         return ret_conv;
37799 }
37800
37801 void  CS_LDK_ChannelDetails_set_is_outbound(int64_t this_ptr, jboolean val) {
37802         LDKChannelDetails this_ptr_conv;
37803         this_ptr_conv.inner = untag_ptr(this_ptr);
37804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37806         this_ptr_conv.is_owned = false;
37807         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
37808 }
37809
37810 jboolean  CS_LDK_ChannelDetails_get_is_channel_ready(int64_t this_ptr) {
37811         LDKChannelDetails this_ptr_conv;
37812         this_ptr_conv.inner = untag_ptr(this_ptr);
37813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37815         this_ptr_conv.is_owned = false;
37816         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
37817         return ret_conv;
37818 }
37819
37820 void  CS_LDK_ChannelDetails_set_is_channel_ready(int64_t this_ptr, jboolean val) {
37821         LDKChannelDetails this_ptr_conv;
37822         this_ptr_conv.inner = untag_ptr(this_ptr);
37823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37825         this_ptr_conv.is_owned = false;
37826         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
37827 }
37828
37829 int64_t  CS_LDK_ChannelDetails_get_channel_shutdown_state(int64_t this_ptr) {
37830         LDKChannelDetails this_ptr_conv;
37831         this_ptr_conv.inner = untag_ptr(this_ptr);
37832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37834         this_ptr_conv.is_owned = false;
37835         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
37836         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
37837         int64_t ret_ref = tag_ptr(ret_copy, true);
37838         return ret_ref;
37839 }
37840
37841 void  CS_LDK_ChannelDetails_set_channel_shutdown_state(int64_t this_ptr, int64_t val) {
37842         LDKChannelDetails this_ptr_conv;
37843         this_ptr_conv.inner = untag_ptr(this_ptr);
37844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37846         this_ptr_conv.is_owned = false;
37847         void* val_ptr = untag_ptr(val);
37848         CHECK_ACCESS(val_ptr);
37849         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
37850         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
37851         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
37852 }
37853
37854 jboolean  CS_LDK_ChannelDetails_get_is_usable(int64_t this_ptr) {
37855         LDKChannelDetails this_ptr_conv;
37856         this_ptr_conv.inner = untag_ptr(this_ptr);
37857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37859         this_ptr_conv.is_owned = false;
37860         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
37861         return ret_conv;
37862 }
37863
37864 void  CS_LDK_ChannelDetails_set_is_usable(int64_t this_ptr, jboolean val) {
37865         LDKChannelDetails this_ptr_conv;
37866         this_ptr_conv.inner = untag_ptr(this_ptr);
37867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37869         this_ptr_conv.is_owned = false;
37870         ChannelDetails_set_is_usable(&this_ptr_conv, val);
37871 }
37872
37873 jboolean  CS_LDK_ChannelDetails_get_is_public(int64_t this_ptr) {
37874         LDKChannelDetails this_ptr_conv;
37875         this_ptr_conv.inner = untag_ptr(this_ptr);
37876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37878         this_ptr_conv.is_owned = false;
37879         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
37880         return ret_conv;
37881 }
37882
37883 void  CS_LDK_ChannelDetails_set_is_public(int64_t this_ptr, jboolean val) {
37884         LDKChannelDetails this_ptr_conv;
37885         this_ptr_conv.inner = untag_ptr(this_ptr);
37886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37888         this_ptr_conv.is_owned = false;
37889         ChannelDetails_set_is_public(&this_ptr_conv, val);
37890 }
37891
37892 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_minimum_msat(int64_t this_ptr) {
37893         LDKChannelDetails this_ptr_conv;
37894         this_ptr_conv.inner = untag_ptr(this_ptr);
37895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37897         this_ptr_conv.is_owned = false;
37898         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37899         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
37900         int64_t ret_ref = tag_ptr(ret_copy, true);
37901         return ret_ref;
37902 }
37903
37904 void  CS_LDK_ChannelDetails_set_inbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37905         LDKChannelDetails this_ptr_conv;
37906         this_ptr_conv.inner = untag_ptr(this_ptr);
37907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37909         this_ptr_conv.is_owned = false;
37910         void* val_ptr = untag_ptr(val);
37911         CHECK_ACCESS(val_ptr);
37912         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37913         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37914         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37915 }
37916
37917 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_maximum_msat(int64_t this_ptr) {
37918         LDKChannelDetails this_ptr_conv;
37919         this_ptr_conv.inner = untag_ptr(this_ptr);
37920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37922         this_ptr_conv.is_owned = false;
37923         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37924         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
37925         int64_t ret_ref = tag_ptr(ret_copy, true);
37926         return ret_ref;
37927 }
37928
37929 void  CS_LDK_ChannelDetails_set_inbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
37930         LDKChannelDetails this_ptr_conv;
37931         this_ptr_conv.inner = untag_ptr(this_ptr);
37932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37934         this_ptr_conv.is_owned = false;
37935         void* val_ptr = untag_ptr(val);
37936         CHECK_ACCESS(val_ptr);
37937         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37938         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37939         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37940 }
37941
37942 int64_t  CS_LDK_ChannelDetails_get_config(int64_t this_ptr) {
37943         LDKChannelDetails this_ptr_conv;
37944         this_ptr_conv.inner = untag_ptr(this_ptr);
37945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37947         this_ptr_conv.is_owned = false;
37948         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
37949         int64_t ret_ref = 0;
37950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37952         return ret_ref;
37953 }
37954
37955 void  CS_LDK_ChannelDetails_set_config(int64_t this_ptr, int64_t val) {
37956         LDKChannelDetails this_ptr_conv;
37957         this_ptr_conv.inner = untag_ptr(this_ptr);
37958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37960         this_ptr_conv.is_owned = false;
37961         LDKChannelConfig val_conv;
37962         val_conv.inner = untag_ptr(val);
37963         val_conv.is_owned = ptr_is_owned(val);
37964         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37965         val_conv = ChannelConfig_clone(&val_conv);
37966         ChannelDetails_set_config(&this_ptr_conv, val_conv);
37967 }
37968
37969 int64_t  CS_LDK_ChannelDetails_new(int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t confirmations_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, int64_t channel_shutdown_state_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
37970         LDKThirtyTwoBytes channel_id_arg_ref;
37971         CHECK(channel_id_arg->arr_len == 32);
37972         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37973         LDKChannelCounterparty counterparty_arg_conv;
37974         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
37975         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
37976         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
37977         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
37978         LDKOutPoint funding_txo_arg_conv;
37979         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
37980         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
37981         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
37982         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
37983         LDKChannelTypeFeatures channel_type_arg_conv;
37984         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37985         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37986         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37987         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37988         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
37989         CHECK_ACCESS(short_channel_id_arg_ptr);
37990         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
37991         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
37992         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
37993         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
37994         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
37995         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
37996         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
37997         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
37998         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
37999         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
38000         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
38001         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
38002         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
38003         LDKU128 user_channel_id_arg_ref;
38004         CHECK(user_channel_id_arg->arr_len == 16);
38005         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
38006         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
38007         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
38008         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
38009         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
38010         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
38011         CHECK_ACCESS(confirmations_required_arg_ptr);
38012         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
38013         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
38014         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
38015         CHECK_ACCESS(confirmations_arg_ptr);
38016         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
38017         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
38018         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
38019         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
38020         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
38021         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
38022         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
38023         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
38024         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
38025         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
38026         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
38027         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
38028         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
38029         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
38030         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
38031         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
38032         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
38033         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
38034         LDKChannelConfig config_arg_conv;
38035         config_arg_conv.inner = untag_ptr(config_arg);
38036         config_arg_conv.is_owned = ptr_is_owned(config_arg);
38037         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
38038         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
38039         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
38040         int64_t ret_ref = 0;
38041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38043         return ret_ref;
38044 }
38045
38046 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
38047         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
38048         int64_t ret_ref = 0;
38049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38051         return ret_ref;
38052 }
38053 int64_t  CS_LDK_ChannelDetails_clone_ptr(int64_t arg) {
38054         LDKChannelDetails arg_conv;
38055         arg_conv.inner = untag_ptr(arg);
38056         arg_conv.is_owned = ptr_is_owned(arg);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38058         arg_conv.is_owned = false;
38059         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
38060         return ret_conv;
38061 }
38062
38063 int64_t  CS_LDK_ChannelDetails_clone(int64_t orig) {
38064         LDKChannelDetails orig_conv;
38065         orig_conv.inner = untag_ptr(orig);
38066         orig_conv.is_owned = ptr_is_owned(orig);
38067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38068         orig_conv.is_owned = false;
38069         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
38070         int64_t ret_ref = 0;
38071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38073         return ret_ref;
38074 }
38075
38076 int64_t  CS_LDK_ChannelDetails_get_inbound_payment_scid(int64_t this_arg) {
38077         LDKChannelDetails this_arg_conv;
38078         this_arg_conv.inner = untag_ptr(this_arg);
38079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38081         this_arg_conv.is_owned = false;
38082         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38083         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
38084         int64_t ret_ref = tag_ptr(ret_copy, true);
38085         return ret_ref;
38086 }
38087
38088 int64_t  CS_LDK_ChannelDetails_get_outbound_payment_scid(int64_t this_arg) {
38089         LDKChannelDetails this_arg_conv;
38090         this_arg_conv.inner = untag_ptr(this_arg);
38091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38093         this_arg_conv.is_owned = false;
38094         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38095         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
38096         int64_t ret_ref = tag_ptr(ret_copy, true);
38097         return ret_ref;
38098 }
38099
38100 int32_t  CS_LDK_ChannelShutdownState_clone(int64_t orig) {
38101         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
38102         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_clone(orig_conv));
38103         return ret_conv;
38104 }
38105
38106 int32_t  CS_LDK_ChannelShutdownState_not_shutting_down() {
38107         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_not_shutting_down());
38108         return ret_conv;
38109 }
38110
38111 int32_t  CS_LDK_ChannelShutdownState_shutdown_initiated() {
38112         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_initiated());
38113         return ret_conv;
38114 }
38115
38116 int32_t  CS_LDK_ChannelShutdownState_resolving_htlcs() {
38117         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_resolving_htlcs());
38118         return ret_conv;
38119 }
38120
38121 int32_t  CS_LDK_ChannelShutdownState_negotiating_closing_fee() {
38122         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_negotiating_closing_fee());
38123         return ret_conv;
38124 }
38125
38126 int32_t  CS_LDK_ChannelShutdownState_shutdown_complete() {
38127         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_complete());
38128         return ret_conv;
38129 }
38130
38131 jboolean  CS_LDK_ChannelShutdownState_eq(int64_t a, int64_t b) {
38132         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
38133         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
38134         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
38135         return ret_conv;
38136 }
38137
38138 void  CS_LDK_RecentPaymentDetails_free(int64_t this_ptr) {
38139         if (!ptr_is_owned(this_ptr)) return;
38140         void* this_ptr_ptr = untag_ptr(this_ptr);
38141         CHECK_ACCESS(this_ptr_ptr);
38142         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
38143         FREE(untag_ptr(this_ptr));
38144         RecentPaymentDetails_free(this_ptr_conv);
38145 }
38146
38147 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
38148         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38149         *ret_copy = RecentPaymentDetails_clone(arg);
38150         int64_t ret_ref = tag_ptr(ret_copy, true);
38151         return ret_ref;
38152 }
38153 int64_t  CS_LDK_RecentPaymentDetails_clone_ptr(int64_t arg) {
38154         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
38155         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
38156         return ret_conv;
38157 }
38158
38159 int64_t  CS_LDK_RecentPaymentDetails_clone(int64_t orig) {
38160         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
38161         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38162         *ret_copy = RecentPaymentDetails_clone(orig_conv);
38163         int64_t ret_ref = tag_ptr(ret_copy, true);
38164         return ret_ref;
38165 }
38166
38167 int64_t  CS_LDK_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
38168         LDKThirtyTwoBytes payment_id_ref;
38169         CHECK(payment_id->arr_len == 32);
38170         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38171         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38172         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
38173         int64_t ret_ref = tag_ptr(ret_copy, true);
38174         return ret_ref;
38175 }
38176
38177 int64_t  CS_LDK_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
38178         LDKThirtyTwoBytes payment_id_ref;
38179         CHECK(payment_id->arr_len == 32);
38180         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38181         LDKThirtyTwoBytes payment_hash_ref;
38182         CHECK(payment_hash->arr_len == 32);
38183         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38184         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38185         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
38186         int64_t ret_ref = tag_ptr(ret_copy, true);
38187         return ret_ref;
38188 }
38189
38190 int64_t  CS_LDK_RecentPaymentDetails_fulfilled(int8_tArray payment_id, int64_t payment_hash) {
38191         LDKThirtyTwoBytes payment_id_ref;
38192         CHECK(payment_id->arr_len == 32);
38193         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38194         void* payment_hash_ptr = untag_ptr(payment_hash);
38195         CHECK_ACCESS(payment_hash_ptr);
38196         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
38197         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
38198         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38199         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
38200         int64_t ret_ref = tag_ptr(ret_copy, true);
38201         return ret_ref;
38202 }
38203
38204 int64_t  CS_LDK_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
38205         LDKThirtyTwoBytes payment_id_ref;
38206         CHECK(payment_id->arr_len == 32);
38207         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38208         LDKThirtyTwoBytes payment_hash_ref;
38209         CHECK(payment_hash->arr_len == 32);
38210         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38211         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38212         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
38213         int64_t ret_ref = tag_ptr(ret_copy, true);
38214         return ret_ref;
38215 }
38216
38217 void  CS_LDK_PhantomRouteHints_free(int64_t this_obj) {
38218         LDKPhantomRouteHints this_obj_conv;
38219         this_obj_conv.inner = untag_ptr(this_obj);
38220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38222         PhantomRouteHints_free(this_obj_conv);
38223 }
38224
38225 int64_tArray  CS_LDK_PhantomRouteHints_get_channels(int64_t this_ptr) {
38226         LDKPhantomRouteHints this_ptr_conv;
38227         this_ptr_conv.inner = untag_ptr(this_ptr);
38228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38230         this_ptr_conv.is_owned = false;
38231         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
38232         int64_tArray ret_arr = NULL;
38233         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38234         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38235         for (size_t q = 0; q < ret_var.datalen; q++) {
38236                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38237                 int64_t ret_conv_16_ref = 0;
38238                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38239                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38240                 ret_arr_ptr[q] = ret_conv_16_ref;
38241         }
38242         
38243         FREE(ret_var.data);
38244         return ret_arr;
38245 }
38246
38247 void  CS_LDK_PhantomRouteHints_set_channels(int64_t this_ptr, int64_tArray val) {
38248         LDKPhantomRouteHints this_ptr_conv;
38249         this_ptr_conv.inner = untag_ptr(this_ptr);
38250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38252         this_ptr_conv.is_owned = false;
38253         LDKCVec_ChannelDetailsZ val_constr;
38254         val_constr.datalen = val->arr_len;
38255         if (val_constr.datalen > 0)
38256                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38257         else
38258                 val_constr.data = NULL;
38259         int64_t* val_vals = val->elems;
38260         for (size_t q = 0; q < val_constr.datalen; q++) {
38261                 int64_t val_conv_16 = val_vals[q];
38262                 LDKChannelDetails val_conv_16_conv;
38263                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
38264                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
38265                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
38266                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
38267                 val_constr.data[q] = val_conv_16_conv;
38268         }
38269         FREE(val);
38270         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
38271 }
38272
38273 int64_t  CS_LDK_PhantomRouteHints_get_phantom_scid(int64_t this_ptr) {
38274         LDKPhantomRouteHints this_ptr_conv;
38275         this_ptr_conv.inner = untag_ptr(this_ptr);
38276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38278         this_ptr_conv.is_owned = false;
38279         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
38280         return ret_conv;
38281 }
38282
38283 void  CS_LDK_PhantomRouteHints_set_phantom_scid(int64_t this_ptr, int64_t val) {
38284         LDKPhantomRouteHints this_ptr_conv;
38285         this_ptr_conv.inner = untag_ptr(this_ptr);
38286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38288         this_ptr_conv.is_owned = false;
38289         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
38290 }
38291
38292 int8_tArray  CS_LDK_PhantomRouteHints_get_real_node_pubkey(int64_t this_ptr) {
38293         LDKPhantomRouteHints this_ptr_conv;
38294         this_ptr_conv.inner = untag_ptr(this_ptr);
38295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38297         this_ptr_conv.is_owned = false;
38298         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38299         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
38300         return ret_arr;
38301 }
38302
38303 void  CS_LDK_PhantomRouteHints_set_real_node_pubkey(int64_t this_ptr, int8_tArray val) {
38304         LDKPhantomRouteHints this_ptr_conv;
38305         this_ptr_conv.inner = untag_ptr(this_ptr);
38306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38308         this_ptr_conv.is_owned = false;
38309         LDKPublicKey val_ref;
38310         CHECK(val->arr_len == 33);
38311         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38312         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
38313 }
38314
38315 int64_t  CS_LDK_PhantomRouteHints_new(int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
38316         LDKCVec_ChannelDetailsZ channels_arg_constr;
38317         channels_arg_constr.datalen = channels_arg->arr_len;
38318         if (channels_arg_constr.datalen > 0)
38319                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38320         else
38321                 channels_arg_constr.data = NULL;
38322         int64_t* channels_arg_vals = channels_arg->elems;
38323         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
38324                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
38325                 LDKChannelDetails channels_arg_conv_16_conv;
38326                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
38327                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
38328                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
38329                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
38330                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
38331         }
38332         FREE(channels_arg);
38333         LDKPublicKey real_node_pubkey_arg_ref;
38334         CHECK(real_node_pubkey_arg->arr_len == 33);
38335         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
38336         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
38337         int64_t ret_ref = 0;
38338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38340         return ret_ref;
38341 }
38342
38343 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
38344         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
38345         int64_t ret_ref = 0;
38346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38348         return ret_ref;
38349 }
38350 int64_t  CS_LDK_PhantomRouteHints_clone_ptr(int64_t arg) {
38351         LDKPhantomRouteHints arg_conv;
38352         arg_conv.inner = untag_ptr(arg);
38353         arg_conv.is_owned = ptr_is_owned(arg);
38354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38355         arg_conv.is_owned = false;
38356         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
38357         return ret_conv;
38358 }
38359
38360 int64_t  CS_LDK_PhantomRouteHints_clone(int64_t orig) {
38361         LDKPhantomRouteHints orig_conv;
38362         orig_conv.inner = untag_ptr(orig);
38363         orig_conv.is_owned = ptr_is_owned(orig);
38364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38365         orig_conv.is_owned = false;
38366         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
38367         int64_t ret_ref = 0;
38368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38370         return ret_ref;
38371 }
38372
38373 int64_t  CS_LDK_ChannelManager_new(int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t config, int64_t params, int32_t current_timestamp) {
38374         void* fee_est_ptr = untag_ptr(fee_est);
38375         CHECK_ACCESS(fee_est_ptr);
38376         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
38377         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
38378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38379                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
38380         }
38381         void* chain_monitor_ptr = untag_ptr(chain_monitor);
38382         CHECK_ACCESS(chain_monitor_ptr);
38383         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
38384         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
38385                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38386                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
38387         }
38388         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
38389         CHECK_ACCESS(tx_broadcaster_ptr);
38390         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
38391         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38392                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38393                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
38394         }
38395         void* router_ptr = untag_ptr(router);
38396         CHECK_ACCESS(router_ptr);
38397         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
38398         if (router_conv.free == LDKRouter_JCalls_free) {
38399                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38400                 LDKRouter_JCalls_cloned(&router_conv);
38401         }
38402         void* logger_ptr = untag_ptr(logger);
38403         CHECK_ACCESS(logger_ptr);
38404         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38405         if (logger_conv.free == LDKLogger_JCalls_free) {
38406                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38407                 LDKLogger_JCalls_cloned(&logger_conv);
38408         }
38409         void* entropy_source_ptr = untag_ptr(entropy_source);
38410         CHECK_ACCESS(entropy_source_ptr);
38411         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
38412         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
38413                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38414                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
38415         }
38416         void* node_signer_ptr = untag_ptr(node_signer);
38417         CHECK_ACCESS(node_signer_ptr);
38418         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
38419         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
38420                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38421                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
38422         }
38423         void* signer_provider_ptr = untag_ptr(signer_provider);
38424         CHECK_ACCESS(signer_provider_ptr);
38425         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
38426         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
38427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38428                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
38429         }
38430         LDKUserConfig config_conv;
38431         config_conv.inner = untag_ptr(config);
38432         config_conv.is_owned = ptr_is_owned(config);
38433         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38434         config_conv = UserConfig_clone(&config_conv);
38435         LDKChainParameters params_conv;
38436         params_conv.inner = untag_ptr(params);
38437         params_conv.is_owned = ptr_is_owned(params);
38438         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38439         params_conv = ChainParameters_clone(&params_conv);
38440         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_conv, current_timestamp);
38441         int64_t ret_ref = 0;
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38444         return ret_ref;
38445 }
38446
38447 int64_t  CS_LDK_ChannelManager_get_current_default_configuration(int64_t this_arg) {
38448         LDKChannelManager this_arg_conv;
38449         this_arg_conv.inner = untag_ptr(this_arg);
38450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38452         this_arg_conv.is_owned = false;
38453         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
38454         int64_t ret_ref = 0;
38455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38457         return ret_ref;
38458 }
38459
38460 int64_t  CS_LDK_ChannelManager_create_channel(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 temporary_channel_id, int64_t override_config) {
38461         LDKChannelManager this_arg_conv;
38462         this_arg_conv.inner = untag_ptr(this_arg);
38463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38465         this_arg_conv.is_owned = false;
38466         LDKPublicKey their_network_key_ref;
38467         CHECK(their_network_key->arr_len == 33);
38468         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
38469         LDKU128 user_channel_id_ref;
38470         CHECK(user_channel_id->arr_len == 16);
38471         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38472         void* temporary_channel_id_ptr = untag_ptr(temporary_channel_id);
38473         CHECK_ACCESS(temporary_channel_id_ptr);
38474         LDKCOption_ThirtyTwoBytesZ temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(temporary_channel_id_ptr);
38475         temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(temporary_channel_id));
38476         LDKUserConfig override_config_conv;
38477         override_config_conv.inner = untag_ptr(override_config);
38478         override_config_conv.is_owned = ptr_is_owned(override_config);
38479         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
38480         override_config_conv = UserConfig_clone(&override_config_conv);
38481         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
38482         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, temporary_channel_id_conv, override_config_conv);
38483         return tag_ptr(ret_conv, true);
38484 }
38485
38486 int64_tArray  CS_LDK_ChannelManager_list_channels(int64_t this_arg) {
38487         LDKChannelManager this_arg_conv;
38488         this_arg_conv.inner = untag_ptr(this_arg);
38489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38491         this_arg_conv.is_owned = false;
38492         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
38493         int64_tArray ret_arr = NULL;
38494         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38495         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38496         for (size_t q = 0; q < ret_var.datalen; q++) {
38497                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38498                 int64_t ret_conv_16_ref = 0;
38499                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38500                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38501                 ret_arr_ptr[q] = ret_conv_16_ref;
38502         }
38503         
38504         FREE(ret_var.data);
38505         return ret_arr;
38506 }
38507
38508 int64_tArray  CS_LDK_ChannelManager_list_usable_channels(int64_t this_arg) {
38509         LDKChannelManager this_arg_conv;
38510         this_arg_conv.inner = untag_ptr(this_arg);
38511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38513         this_arg_conv.is_owned = false;
38514         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
38515         int64_tArray ret_arr = NULL;
38516         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38517         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38518         for (size_t q = 0; q < ret_var.datalen; q++) {
38519                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38520                 int64_t ret_conv_16_ref = 0;
38521                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38522                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38523                 ret_arr_ptr[q] = ret_conv_16_ref;
38524         }
38525         
38526         FREE(ret_var.data);
38527         return ret_arr;
38528 }
38529
38530 int64_tArray  CS_LDK_ChannelManager_list_channels_with_counterparty(int64_t this_arg, int8_tArray counterparty_node_id) {
38531         LDKChannelManager this_arg_conv;
38532         this_arg_conv.inner = untag_ptr(this_arg);
38533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38535         this_arg_conv.is_owned = false;
38536         LDKPublicKey counterparty_node_id_ref;
38537         CHECK(counterparty_node_id->arr_len == 33);
38538         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38539         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
38540         int64_tArray ret_arr = NULL;
38541         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38542         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38543         for (size_t q = 0; q < ret_var.datalen; q++) {
38544                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38545                 int64_t ret_conv_16_ref = 0;
38546                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38547                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38548                 ret_arr_ptr[q] = ret_conv_16_ref;
38549         }
38550         
38551         FREE(ret_var.data);
38552         return ret_arr;
38553 }
38554
38555 int64_tArray  CS_LDK_ChannelManager_list_recent_payments(int64_t this_arg) {
38556         LDKChannelManager this_arg_conv;
38557         this_arg_conv.inner = untag_ptr(this_arg);
38558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38560         this_arg_conv.is_owned = false;
38561         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
38562         int64_tArray ret_arr = NULL;
38563         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38564         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38565         for (size_t w = 0; w < ret_var.datalen; w++) {
38566                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38567                 *ret_conv_22_copy = ret_var.data[w];
38568                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
38569                 ret_arr_ptr[w] = ret_conv_22_ref;
38570         }
38571         
38572         FREE(ret_var.data);
38573         return ret_arr;
38574 }
38575
38576 int64_t  CS_LDK_ChannelManager_close_channel(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38577         LDKChannelManager this_arg_conv;
38578         this_arg_conv.inner = untag_ptr(this_arg);
38579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38581         this_arg_conv.is_owned = false;
38582         uint8_t channel_id_arr[32];
38583         CHECK(channel_id->arr_len == 32);
38584         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38585         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38586         LDKPublicKey counterparty_node_id_ref;
38587         CHECK(counterparty_node_id->arr_len == 33);
38588         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38589         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38590         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38591         return tag_ptr(ret_conv, true);
38592 }
38593
38594 int64_t  CS_LDK_ChannelManager_close_channel_with_feerate_and_script(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
38595         LDKChannelManager this_arg_conv;
38596         this_arg_conv.inner = untag_ptr(this_arg);
38597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38599         this_arg_conv.is_owned = false;
38600         uint8_t channel_id_arr[32];
38601         CHECK(channel_id->arr_len == 32);
38602         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38603         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38604         LDKPublicKey counterparty_node_id_ref;
38605         CHECK(counterparty_node_id->arr_len == 33);
38606         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38607         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
38608         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
38609         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
38610         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
38611         LDKShutdownScript shutdown_script_conv;
38612         shutdown_script_conv.inner = untag_ptr(shutdown_script);
38613         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
38614         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
38615         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
38616         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38617         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
38618         return tag_ptr(ret_conv, true);
38619 }
38620
38621 int64_t  CS_LDK_ChannelManager_force_close_broadcasting_latest_txn(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38622         LDKChannelManager this_arg_conv;
38623         this_arg_conv.inner = untag_ptr(this_arg);
38624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38626         this_arg_conv.is_owned = false;
38627         uint8_t channel_id_arr[32];
38628         CHECK(channel_id->arr_len == 32);
38629         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38630         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38631         LDKPublicKey counterparty_node_id_ref;
38632         CHECK(counterparty_node_id->arr_len == 33);
38633         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38634         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38635         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38636         return tag_ptr(ret_conv, true);
38637 }
38638
38639 int64_t  CS_LDK_ChannelManager_force_close_without_broadcasting_txn(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38640         LDKChannelManager this_arg_conv;
38641         this_arg_conv.inner = untag_ptr(this_arg);
38642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38644         this_arg_conv.is_owned = false;
38645         uint8_t channel_id_arr[32];
38646         CHECK(channel_id->arr_len == 32);
38647         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38648         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38649         LDKPublicKey counterparty_node_id_ref;
38650         CHECK(counterparty_node_id->arr_len == 33);
38651         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38652         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38653         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38654         return tag_ptr(ret_conv, true);
38655 }
38656
38657 void  CS_LDK_ChannelManager_force_close_all_channels_broadcasting_latest_txn(int64_t this_arg) {
38658         LDKChannelManager this_arg_conv;
38659         this_arg_conv.inner = untag_ptr(this_arg);
38660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38662         this_arg_conv.is_owned = false;
38663         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
38664 }
38665
38666 void  CS_LDK_ChannelManager_force_close_all_channels_without_broadcasting_txn(int64_t this_arg) {
38667         LDKChannelManager this_arg_conv;
38668         this_arg_conv.inner = untag_ptr(this_arg);
38669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38671         this_arg_conv.is_owned = false;
38672         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
38673 }
38674
38675 int64_t  CS_LDK_ChannelManager_send_payment_with_route(int64_t this_arg, int64_t route, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id) {
38676         LDKChannelManager this_arg_conv;
38677         this_arg_conv.inner = untag_ptr(this_arg);
38678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38680         this_arg_conv.is_owned = false;
38681         LDKRoute route_conv;
38682         route_conv.inner = untag_ptr(route);
38683         route_conv.is_owned = ptr_is_owned(route);
38684         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38685         route_conv.is_owned = false;
38686         LDKThirtyTwoBytes payment_hash_ref;
38687         CHECK(payment_hash->arr_len == 32);
38688         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38689         LDKRecipientOnionFields recipient_onion_conv;
38690         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38691         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38692         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38693         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38694         LDKThirtyTwoBytes payment_id_ref;
38695         CHECK(payment_id->arr_len == 32);
38696         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38697         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
38698         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
38699         return tag_ptr(ret_conv, true);
38700 }
38701
38702 int64_t  CS_LDK_ChannelManager_send_payment(int64_t this_arg, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
38703         LDKChannelManager this_arg_conv;
38704         this_arg_conv.inner = untag_ptr(this_arg);
38705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38707         this_arg_conv.is_owned = false;
38708         LDKThirtyTwoBytes payment_hash_ref;
38709         CHECK(payment_hash->arr_len == 32);
38710         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38711         LDKRecipientOnionFields recipient_onion_conv;
38712         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38713         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38714         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38715         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38716         LDKThirtyTwoBytes payment_id_ref;
38717         CHECK(payment_id->arr_len == 32);
38718         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38719         LDKRouteParameters route_params_conv;
38720         route_params_conv.inner = untag_ptr(route_params);
38721         route_params_conv.is_owned = ptr_is_owned(route_params);
38722         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38723         route_params_conv = RouteParameters_clone(&route_params_conv);
38724         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38725         CHECK_ACCESS(retry_strategy_ptr);
38726         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38727         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38728         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
38729         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38730         return tag_ptr(ret_conv, true);
38731 }
38732
38733 void  CS_LDK_ChannelManager_abandon_payment(int64_t this_arg, int8_tArray payment_id) {
38734         LDKChannelManager this_arg_conv;
38735         this_arg_conv.inner = untag_ptr(this_arg);
38736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38738         this_arg_conv.is_owned = false;
38739         LDKThirtyTwoBytes payment_id_ref;
38740         CHECK(payment_id->arr_len == 32);
38741         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38742         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
38743 }
38744
38745 int64_t  CS_LDK_ChannelManager_send_spontaneous_payment(int64_t this_arg, int64_t route, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id) {
38746         LDKChannelManager this_arg_conv;
38747         this_arg_conv.inner = untag_ptr(this_arg);
38748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38750         this_arg_conv.is_owned = false;
38751         LDKRoute route_conv;
38752         route_conv.inner = untag_ptr(route);
38753         route_conv.is_owned = ptr_is_owned(route);
38754         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38755         route_conv.is_owned = false;
38756         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38757         CHECK_ACCESS(payment_preimage_ptr);
38758         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38759         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38760         LDKRecipientOnionFields recipient_onion_conv;
38761         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38762         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38763         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38764         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38765         LDKThirtyTwoBytes payment_id_ref;
38766         CHECK(payment_id->arr_len == 32);
38767         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38768         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
38769         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
38770         return tag_ptr(ret_conv, true);
38771 }
38772
38773 int64_t  CS_LDK_ChannelManager_send_spontaneous_payment_with_retry(int64_t this_arg, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
38774         LDKChannelManager this_arg_conv;
38775         this_arg_conv.inner = untag_ptr(this_arg);
38776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38778         this_arg_conv.is_owned = false;
38779         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38780         CHECK_ACCESS(payment_preimage_ptr);
38781         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38782         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38783         LDKRecipientOnionFields recipient_onion_conv;
38784         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38785         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38786         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38787         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38788         LDKThirtyTwoBytes payment_id_ref;
38789         CHECK(payment_id->arr_len == 32);
38790         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38791         LDKRouteParameters route_params_conv;
38792         route_params_conv.inner = untag_ptr(route_params);
38793         route_params_conv.is_owned = ptr_is_owned(route_params);
38794         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38795         route_params_conv = RouteParameters_clone(&route_params_conv);
38796         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38797         CHECK_ACCESS(retry_strategy_ptr);
38798         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38799         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38800         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
38801         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38802         return tag_ptr(ret_conv, true);
38803 }
38804
38805 int64_t  CS_LDK_ChannelManager_send_probe(int64_t this_arg, int64_t path) {
38806         LDKChannelManager this_arg_conv;
38807         this_arg_conv.inner = untag_ptr(this_arg);
38808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38810         this_arg_conv.is_owned = false;
38811         LDKPath path_conv;
38812         path_conv.inner = untag_ptr(path);
38813         path_conv.is_owned = ptr_is_owned(path);
38814         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
38815         path_conv = Path_clone(&path_conv);
38816         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
38817         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
38818         return tag_ptr(ret_conv, true);
38819 }
38820
38821 int64_t  CS_LDK_ChannelManager_send_spontaneous_preflight_probes(int64_t this_arg, int8_tArray node_id, int64_t amount_msat, int32_t final_cltv_expiry_delta, int64_t liquidity_limit_multiplier) {
38822         LDKChannelManager this_arg_conv;
38823         this_arg_conv.inner = untag_ptr(this_arg);
38824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38826         this_arg_conv.is_owned = false;
38827         LDKPublicKey node_id_ref;
38828         CHECK(node_id->arr_len == 33);
38829         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
38830         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38831         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38832         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38833         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38834         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38835         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
38836         return tag_ptr(ret_conv, true);
38837 }
38838
38839 int64_t  CS_LDK_ChannelManager_send_preflight_probes(int64_t this_arg, int64_t route_params, int64_t liquidity_limit_multiplier) {
38840         LDKChannelManager this_arg_conv;
38841         this_arg_conv.inner = untag_ptr(this_arg);
38842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38844         this_arg_conv.is_owned = false;
38845         LDKRouteParameters route_params_conv;
38846         route_params_conv.inner = untag_ptr(route_params);
38847         route_params_conv.is_owned = ptr_is_owned(route_params);
38848         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38849         route_params_conv = RouteParameters_clone(&route_params_conv);
38850         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38851         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38852         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38853         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38854         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38855         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
38856         return tag_ptr(ret_conv, true);
38857 }
38858
38859 int64_t  CS_LDK_ChannelManager_funding_transaction_generated(int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
38860         LDKChannelManager this_arg_conv;
38861         this_arg_conv.inner = untag_ptr(this_arg);
38862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38864         this_arg_conv.is_owned = false;
38865         uint8_t temporary_channel_id_arr[32];
38866         CHECK(temporary_channel_id->arr_len == 32);
38867         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38868         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38869         LDKPublicKey counterparty_node_id_ref;
38870         CHECK(counterparty_node_id->arr_len == 33);
38871         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38872         LDKTransaction funding_transaction_ref;
38873         funding_transaction_ref.datalen = funding_transaction->arr_len;
38874         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38875         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38876         funding_transaction_ref.data_is_owned = true;
38877         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38878         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
38879         return tag_ptr(ret_conv, true);
38880 }
38881
38882 int64_t  CS_LDK_ChannelManager_batch_funding_transaction_generated(int64_t this_arg, int64_tArray temporary_channels, int8_tArray funding_transaction) {
38883         LDKChannelManager this_arg_conv;
38884         this_arg_conv.inner = untag_ptr(this_arg);
38885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38887         this_arg_conv.is_owned = false;
38888         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
38889         temporary_channels_constr.datalen = temporary_channels->arr_len;
38890         if (temporary_channels_constr.datalen > 0)
38891                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
38892         else
38893                 temporary_channels_constr.data = NULL;
38894         int64_t* temporary_channels_vals = temporary_channels->elems;
38895         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
38896                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
38897                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
38898                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
38899                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
38900                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
38901                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
38902         }
38903         FREE(temporary_channels);
38904         LDKTransaction funding_transaction_ref;
38905         funding_transaction_ref.datalen = funding_transaction->arr_len;
38906         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38907         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38908         funding_transaction_ref.data_is_owned = true;
38909         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38910         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
38911         return tag_ptr(ret_conv, true);
38912 }
38913
38914 int64_t  CS_LDK_ChannelManager_update_partial_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, ptrArray channel_ids, int64_t config_update) {
38915         LDKChannelManager this_arg_conv;
38916         this_arg_conv.inner = untag_ptr(this_arg);
38917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38919         this_arg_conv.is_owned = false;
38920         LDKPublicKey counterparty_node_id_ref;
38921         CHECK(counterparty_node_id->arr_len == 33);
38922         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38923         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38924         channel_ids_constr.datalen = channel_ids->arr_len;
38925         if (channel_ids_constr.datalen > 0)
38926                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38927         else
38928                 channel_ids_constr.data = NULL;
38929         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38930         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38931                 int8_tArray channel_ids_conv_8 = channel_ids_vals[i];
38932                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38933                 CHECK(channel_ids_conv_8->arr_len == 32);
38934                 memcpy(channel_ids_conv_8_ref.data, channel_ids_conv_8->elems, 32); FREE(channel_ids_conv_8);
38935                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38936         }
38937         FREE(channel_ids);
38938         LDKChannelConfigUpdate config_update_conv;
38939         config_update_conv.inner = untag_ptr(config_update);
38940         config_update_conv.is_owned = ptr_is_owned(config_update);
38941         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
38942         config_update_conv.is_owned = false;
38943         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38944         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
38945         return tag_ptr(ret_conv, true);
38946 }
38947
38948 int64_t  CS_LDK_ChannelManager_update_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, ptrArray channel_ids, int64_t config) {
38949         LDKChannelManager this_arg_conv;
38950         this_arg_conv.inner = untag_ptr(this_arg);
38951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38953         this_arg_conv.is_owned = false;
38954         LDKPublicKey counterparty_node_id_ref;
38955         CHECK(counterparty_node_id->arr_len == 33);
38956         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38957         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38958         channel_ids_constr.datalen = channel_ids->arr_len;
38959         if (channel_ids_constr.datalen > 0)
38960                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38961         else
38962                 channel_ids_constr.data = NULL;
38963         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38964         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38965                 int8_tArray channel_ids_conv_8 = channel_ids_vals[i];
38966                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38967                 CHECK(channel_ids_conv_8->arr_len == 32);
38968                 memcpy(channel_ids_conv_8_ref.data, channel_ids_conv_8->elems, 32); FREE(channel_ids_conv_8);
38969                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38970         }
38971         FREE(channel_ids);
38972         LDKChannelConfig config_conv;
38973         config_conv.inner = untag_ptr(config);
38974         config_conv.is_owned = ptr_is_owned(config);
38975         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38976         config_conv.is_owned = false;
38977         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38978         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
38979         return tag_ptr(ret_conv, true);
38980 }
38981
38982 int64_t  CS_LDK_ChannelManager_forward_intercepted_htlc(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) {
38983         LDKChannelManager this_arg_conv;
38984         this_arg_conv.inner = untag_ptr(this_arg);
38985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38987         this_arg_conv.is_owned = false;
38988         LDKThirtyTwoBytes intercept_id_ref;
38989         CHECK(intercept_id->arr_len == 32);
38990         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
38991         uint8_t next_hop_channel_id_arr[32];
38992         CHECK(next_hop_channel_id->arr_len == 32);
38993         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
38994         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
38995         LDKPublicKey next_node_id_ref;
38996         CHECK(next_node_id->arr_len == 33);
38997         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
38998         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38999         *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);
39000         return tag_ptr(ret_conv, true);
39001 }
39002
39003 int64_t  CS_LDK_ChannelManager_fail_intercepted_htlc(int64_t this_arg, int8_tArray intercept_id) {
39004         LDKChannelManager this_arg_conv;
39005         this_arg_conv.inner = untag_ptr(this_arg);
39006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39008         this_arg_conv.is_owned = false;
39009         LDKThirtyTwoBytes intercept_id_ref;
39010         CHECK(intercept_id->arr_len == 32);
39011         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
39012         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39013         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
39014         return tag_ptr(ret_conv, true);
39015 }
39016
39017 void  CS_LDK_ChannelManager_process_pending_htlc_forwards(int64_t this_arg) {
39018         LDKChannelManager this_arg_conv;
39019         this_arg_conv.inner = untag_ptr(this_arg);
39020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39022         this_arg_conv.is_owned = false;
39023         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
39024 }
39025
39026 void  CS_LDK_ChannelManager_timer_tick_occurred(int64_t this_arg) {
39027         LDKChannelManager this_arg_conv;
39028         this_arg_conv.inner = untag_ptr(this_arg);
39029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39031         this_arg_conv.is_owned = false;
39032         ChannelManager_timer_tick_occurred(&this_arg_conv);
39033 }
39034
39035 void  CS_LDK_ChannelManager_fail_htlc_backwards(int64_t this_arg, int8_tArray payment_hash) {
39036         LDKChannelManager this_arg_conv;
39037         this_arg_conv.inner = untag_ptr(this_arg);
39038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39040         this_arg_conv.is_owned = false;
39041         uint8_t payment_hash_arr[32];
39042         CHECK(payment_hash->arr_len == 32);
39043         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
39044         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
39045         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
39046 }
39047
39048 void  CS_LDK_ChannelManager_fail_htlc_backwards_with_reason(int64_t this_arg, int8_tArray payment_hash, int64_t failure_code) {
39049         LDKChannelManager this_arg_conv;
39050         this_arg_conv.inner = untag_ptr(this_arg);
39051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39053         this_arg_conv.is_owned = false;
39054         uint8_t payment_hash_arr[32];
39055         CHECK(payment_hash->arr_len == 32);
39056         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
39057         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
39058         void* failure_code_ptr = untag_ptr(failure_code);
39059         CHECK_ACCESS(failure_code_ptr);
39060         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
39061         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
39062         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
39063 }
39064
39065 void  CS_LDK_ChannelManager_claim_funds(int64_t this_arg, int8_tArray payment_preimage) {
39066         LDKChannelManager this_arg_conv;
39067         this_arg_conv.inner = untag_ptr(this_arg);
39068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39070         this_arg_conv.is_owned = false;
39071         LDKThirtyTwoBytes payment_preimage_ref;
39072         CHECK(payment_preimage->arr_len == 32);
39073         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
39074         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
39075 }
39076
39077 void  CS_LDK_ChannelManager_claim_funds_with_known_custom_tlvs(int64_t this_arg, int8_tArray payment_preimage) {
39078         LDKChannelManager this_arg_conv;
39079         this_arg_conv.inner = untag_ptr(this_arg);
39080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39082         this_arg_conv.is_owned = false;
39083         LDKThirtyTwoBytes payment_preimage_ref;
39084         CHECK(payment_preimage->arr_len == 32);
39085         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
39086         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
39087 }
39088
39089 int8_tArray  CS_LDK_ChannelManager_get_our_node_id(int64_t this_arg) {
39090         LDKChannelManager this_arg_conv;
39091         this_arg_conv.inner = untag_ptr(this_arg);
39092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39094         this_arg_conv.is_owned = false;
39095         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39096         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
39097         return ret_arr;
39098 }
39099
39100 int64_t  CS_LDK_ChannelManager_accept_inbound_channel(int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
39101         LDKChannelManager this_arg_conv;
39102         this_arg_conv.inner = untag_ptr(this_arg);
39103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39105         this_arg_conv.is_owned = false;
39106         uint8_t temporary_channel_id_arr[32];
39107         CHECK(temporary_channel_id->arr_len == 32);
39108         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
39109         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
39110         LDKPublicKey counterparty_node_id_ref;
39111         CHECK(counterparty_node_id->arr_len == 33);
39112         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
39113         LDKU128 user_channel_id_ref;
39114         CHECK(user_channel_id->arr_len == 16);
39115         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
39116         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39117         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
39118         return tag_ptr(ret_conv, true);
39119 }
39120
39121 int64_t  CS_LDK_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
39122         LDKChannelManager this_arg_conv;
39123         this_arg_conv.inner = untag_ptr(this_arg);
39124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39126         this_arg_conv.is_owned = false;
39127         uint8_t temporary_channel_id_arr[32];
39128         CHECK(temporary_channel_id->arr_len == 32);
39129         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
39130         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
39131         LDKPublicKey counterparty_node_id_ref;
39132         CHECK(counterparty_node_id->arr_len == 33);
39133         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
39134         LDKU128 user_channel_id_ref;
39135         CHECK(user_channel_id->arr_len == 16);
39136         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
39137         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39138         *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);
39139         return tag_ptr(ret_conv, true);
39140 }
39141
39142 int64_t  CS_LDK_ChannelManager_pay_for_offer(int64_t this_arg, int64_t offer, int64_t quantity, int64_t amount_msats, int64_t payer_note, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
39143         LDKChannelManager this_arg_conv;
39144         this_arg_conv.inner = untag_ptr(this_arg);
39145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39147         this_arg_conv.is_owned = false;
39148         LDKOffer offer_conv;
39149         offer_conv.inner = untag_ptr(offer);
39150         offer_conv.is_owned = ptr_is_owned(offer);
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
39152         offer_conv.is_owned = false;
39153         void* quantity_ptr = untag_ptr(quantity);
39154         CHECK_ACCESS(quantity_ptr);
39155         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
39156         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
39157         void* amount_msats_ptr = untag_ptr(amount_msats);
39158         CHECK_ACCESS(amount_msats_ptr);
39159         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
39160         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
39161         void* payer_note_ptr = untag_ptr(payer_note);
39162         CHECK_ACCESS(payer_note_ptr);
39163         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
39164         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
39165         LDKThirtyTwoBytes payment_id_ref;
39166         CHECK(payment_id->arr_len == 32);
39167         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
39168         void* retry_strategy_ptr = untag_ptr(retry_strategy);
39169         CHECK_ACCESS(retry_strategy_ptr);
39170         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
39171         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
39172         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
39173         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
39174         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
39175         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
39176         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
39177         *ret_conv = ChannelManager_pay_for_offer(&this_arg_conv, &offer_conv, quantity_conv, amount_msats_conv, payer_note_conv, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
39178         return tag_ptr(ret_conv, true);
39179 }
39180
39181 int64_t  CS_LDK_ChannelManager_request_refund_payment(int64_t this_arg, int64_t refund) {
39182         LDKChannelManager this_arg_conv;
39183         this_arg_conv.inner = untag_ptr(this_arg);
39184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39186         this_arg_conv.is_owned = false;
39187         LDKRefund refund_conv;
39188         refund_conv.inner = untag_ptr(refund);
39189         refund_conv.is_owned = ptr_is_owned(refund);
39190         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
39191         refund_conv.is_owned = false;
39192         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
39193         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
39194         return tag_ptr(ret_conv, true);
39195 }
39196
39197 int64_t  CS_LDK_ChannelManager_create_inbound_payment(int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
39198         LDKChannelManager this_arg_conv;
39199         this_arg_conv.inner = untag_ptr(this_arg);
39200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39202         this_arg_conv.is_owned = false;
39203         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39204         CHECK_ACCESS(min_value_msat_ptr);
39205         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39206         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39207         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
39208         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
39209         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
39210         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
39211         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
39212         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
39213         return tag_ptr(ret_conv, true);
39214 }
39215
39216 int64_t  CS_LDK_ChannelManager_create_inbound_payment_for_hash(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) {
39217         LDKChannelManager this_arg_conv;
39218         this_arg_conv.inner = untag_ptr(this_arg);
39219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39221         this_arg_conv.is_owned = false;
39222         LDKThirtyTwoBytes payment_hash_ref;
39223         CHECK(payment_hash->arr_len == 32);
39224         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39225         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39226         CHECK_ACCESS(min_value_msat_ptr);
39227         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39228         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39229         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
39230         CHECK_ACCESS(min_final_cltv_expiry_ptr);
39231         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
39232         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
39233         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
39234         *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);
39235         return tag_ptr(ret_conv, true);
39236 }
39237
39238 int64_t  CS_LDK_ChannelManager_get_payment_preimage(int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
39239         LDKChannelManager this_arg_conv;
39240         this_arg_conv.inner = untag_ptr(this_arg);
39241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39243         this_arg_conv.is_owned = false;
39244         LDKThirtyTwoBytes payment_hash_ref;
39245         CHECK(payment_hash->arr_len == 32);
39246         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39247         LDKThirtyTwoBytes payment_secret_ref;
39248         CHECK(payment_secret->arr_len == 32);
39249         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
39250         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
39251         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
39252         return tag_ptr(ret_conv, true);
39253 }
39254
39255 int64_t  CS_LDK_ChannelManager_get_phantom_scid(int64_t this_arg) {
39256         LDKChannelManager this_arg_conv;
39257         this_arg_conv.inner = untag_ptr(this_arg);
39258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39260         this_arg_conv.is_owned = false;
39261         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
39262         return ret_conv;
39263 }
39264
39265 int64_t  CS_LDK_ChannelManager_get_phantom_route_hints(int64_t this_arg) {
39266         LDKChannelManager this_arg_conv;
39267         this_arg_conv.inner = untag_ptr(this_arg);
39268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39270         this_arg_conv.is_owned = false;
39271         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
39272         int64_t ret_ref = 0;
39273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39275         return ret_ref;
39276 }
39277
39278 int64_t  CS_LDK_ChannelManager_get_intercept_scid(int64_t this_arg) {
39279         LDKChannelManager this_arg_conv;
39280         this_arg_conv.inner = untag_ptr(this_arg);
39281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39283         this_arg_conv.is_owned = false;
39284         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
39285         return ret_conv;
39286 }
39287
39288 int64_t  CS_LDK_ChannelManager_compute_inflight_htlcs(int64_t this_arg) {
39289         LDKChannelManager this_arg_conv;
39290         this_arg_conv.inner = untag_ptr(this_arg);
39291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39293         this_arg_conv.is_owned = false;
39294         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
39295         int64_t ret_ref = 0;
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39298         return ret_ref;
39299 }
39300
39301 int64_t  CS_LDK_ChannelManager_as_MessageSendEventsProvider(int64_t this_arg) {
39302         LDKChannelManager this_arg_conv;
39303         this_arg_conv.inner = untag_ptr(this_arg);
39304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39306         this_arg_conv.is_owned = false;
39307         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39308         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
39309         return tag_ptr(ret_ret, true);
39310 }
39311
39312 int64_t  CS_LDK_ChannelManager_as_EventsProvider(int64_t this_arg) {
39313         LDKChannelManager this_arg_conv;
39314         this_arg_conv.inner = untag_ptr(this_arg);
39315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39317         this_arg_conv.is_owned = false;
39318         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
39319         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
39320         return tag_ptr(ret_ret, true);
39321 }
39322
39323 int64_t  CS_LDK_ChannelManager_as_Listen(int64_t this_arg) {
39324         LDKChannelManager this_arg_conv;
39325         this_arg_conv.inner = untag_ptr(this_arg);
39326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39328         this_arg_conv.is_owned = false;
39329         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
39330         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
39331         return tag_ptr(ret_ret, true);
39332 }
39333
39334 int64_t  CS_LDK_ChannelManager_as_Confirm(int64_t this_arg) {
39335         LDKChannelManager this_arg_conv;
39336         this_arg_conv.inner = untag_ptr(this_arg);
39337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39339         this_arg_conv.is_owned = false;
39340         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
39341         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
39342         return tag_ptr(ret_ret, true);
39343 }
39344
39345 int64_t  CS_LDK_ChannelManager_get_event_or_persistence_needed_future(int64_t this_arg) {
39346         LDKChannelManager this_arg_conv;
39347         this_arg_conv.inner = untag_ptr(this_arg);
39348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39350         this_arg_conv.is_owned = false;
39351         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
39352         int64_t ret_ref = 0;
39353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39355         return ret_ref;
39356 }
39357
39358 jboolean  CS_LDK_ChannelManager_get_and_clear_needs_persistence(int64_t this_arg) {
39359         LDKChannelManager this_arg_conv;
39360         this_arg_conv.inner = untag_ptr(this_arg);
39361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39363         this_arg_conv.is_owned = false;
39364         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
39365         return ret_conv;
39366 }
39367
39368 int64_t  CS_LDK_ChannelManager_current_best_block(int64_t this_arg) {
39369         LDKChannelManager this_arg_conv;
39370         this_arg_conv.inner = untag_ptr(this_arg);
39371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39373         this_arg_conv.is_owned = false;
39374         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
39375         int64_t ret_ref = 0;
39376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39378         return ret_ref;
39379 }
39380
39381 int64_t  CS_LDK_ChannelManager_node_features(int64_t this_arg) {
39382         LDKChannelManager this_arg_conv;
39383         this_arg_conv.inner = untag_ptr(this_arg);
39384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39386         this_arg_conv.is_owned = false;
39387         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_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 int64_t  CS_LDK_ChannelManager_channel_features(int64_t this_arg) {
39395         LDKChannelManager this_arg_conv;
39396         this_arg_conv.inner = untag_ptr(this_arg);
39397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39399         this_arg_conv.is_owned = false;
39400         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
39401         int64_t ret_ref = 0;
39402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39404         return ret_ref;
39405 }
39406
39407 int64_t  CS_LDK_ChannelManager_channel_type_features(int64_t this_arg) {
39408         LDKChannelManager this_arg_conv;
39409         this_arg_conv.inner = untag_ptr(this_arg);
39410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39412         this_arg_conv.is_owned = false;
39413         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
39414         int64_t ret_ref = 0;
39415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39417         return ret_ref;
39418 }
39419
39420 int64_t  CS_LDK_ChannelManager_init_features(int64_t this_arg) {
39421         LDKChannelManager this_arg_conv;
39422         this_arg_conv.inner = untag_ptr(this_arg);
39423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39425         this_arg_conv.is_owned = false;
39426         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
39427         int64_t ret_ref = 0;
39428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39430         return ret_ref;
39431 }
39432
39433 int64_t  CS_LDK_ChannelManager_as_ChannelMessageHandler(int64_t this_arg) {
39434         LDKChannelManager this_arg_conv;
39435         this_arg_conv.inner = untag_ptr(this_arg);
39436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39438         this_arg_conv.is_owned = false;
39439         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
39440         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
39441         return tag_ptr(ret_ret, true);
39442 }
39443
39444 int64_t  CS_LDK_ChannelManager_as_OffersMessageHandler(int64_t this_arg) {
39445         LDKChannelManager this_arg_conv;
39446         this_arg_conv.inner = untag_ptr(this_arg);
39447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39449         this_arg_conv.is_owned = false;
39450         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
39451         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
39452         return tag_ptr(ret_ret, true);
39453 }
39454
39455 int64_t  CS_LDK_provided_init_features(int64_t config) {
39456         LDKUserConfig config_conv;
39457         config_conv.inner = untag_ptr(config);
39458         config_conv.is_owned = ptr_is_owned(config);
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
39460         config_conv.is_owned = false;
39461         LDKInitFeatures ret_var = provided_init_features(&config_conv);
39462         int64_t ret_ref = 0;
39463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39465         return ret_ref;
39466 }
39467
39468 int8_tArray  CS_LDK_CounterpartyForwardingInfo_write(int64_t obj) {
39469         LDKCounterpartyForwardingInfo obj_conv;
39470         obj_conv.inner = untag_ptr(obj);
39471         obj_conv.is_owned = ptr_is_owned(obj);
39472         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39473         obj_conv.is_owned = false;
39474         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
39475         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39476         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39477         CVec_u8Z_free(ret_var);
39478         return ret_arr;
39479 }
39480
39481 int64_t  CS_LDK_CounterpartyForwardingInfo_read(int8_tArray ser) {
39482         LDKu8slice ser_ref;
39483         ser_ref.datalen = ser->arr_len;
39484         ser_ref.data = ser->elems;
39485         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
39486         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
39487         FREE(ser);
39488         return tag_ptr(ret_conv, true);
39489 }
39490
39491 int8_tArray  CS_LDK_ChannelCounterparty_write(int64_t obj) {
39492         LDKChannelCounterparty obj_conv;
39493         obj_conv.inner = untag_ptr(obj);
39494         obj_conv.is_owned = ptr_is_owned(obj);
39495         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39496         obj_conv.is_owned = false;
39497         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
39498         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39499         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39500         CVec_u8Z_free(ret_var);
39501         return ret_arr;
39502 }
39503
39504 int64_t  CS_LDK_ChannelCounterparty_read(int8_tArray ser) {
39505         LDKu8slice ser_ref;
39506         ser_ref.datalen = ser->arr_len;
39507         ser_ref.data = ser->elems;
39508         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
39509         *ret_conv = ChannelCounterparty_read(ser_ref);
39510         FREE(ser);
39511         return tag_ptr(ret_conv, true);
39512 }
39513
39514 int8_tArray  CS_LDK_ChannelDetails_write(int64_t obj) {
39515         LDKChannelDetails obj_conv;
39516         obj_conv.inner = untag_ptr(obj);
39517         obj_conv.is_owned = ptr_is_owned(obj);
39518         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39519         obj_conv.is_owned = false;
39520         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
39521         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39522         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39523         CVec_u8Z_free(ret_var);
39524         return ret_arr;
39525 }
39526
39527 int64_t  CS_LDK_ChannelDetails_read(int8_tArray ser) {
39528         LDKu8slice ser_ref;
39529         ser_ref.datalen = ser->arr_len;
39530         ser_ref.data = ser->elems;
39531         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
39532         *ret_conv = ChannelDetails_read(ser_ref);
39533         FREE(ser);
39534         return tag_ptr(ret_conv, true);
39535 }
39536
39537 int8_tArray  CS_LDK_PhantomRouteHints_write(int64_t obj) {
39538         LDKPhantomRouteHints obj_conv;
39539         obj_conv.inner = untag_ptr(obj);
39540         obj_conv.is_owned = ptr_is_owned(obj);
39541         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39542         obj_conv.is_owned = false;
39543         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
39544         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39545         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39546         CVec_u8Z_free(ret_var);
39547         return ret_arr;
39548 }
39549
39550 int64_t  CS_LDK_PhantomRouteHints_read(int8_tArray ser) {
39551         LDKu8slice ser_ref;
39552         ser_ref.datalen = ser->arr_len;
39553         ser_ref.data = ser->elems;
39554         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
39555         *ret_conv = PhantomRouteHints_read(ser_ref);
39556         FREE(ser);
39557         return tag_ptr(ret_conv, true);
39558 }
39559
39560 int8_tArray  CS_LDK_BlindedForward_write(int64_t obj) {
39561         LDKBlindedForward obj_conv;
39562         obj_conv.inner = untag_ptr(obj);
39563         obj_conv.is_owned = ptr_is_owned(obj);
39564         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39565         obj_conv.is_owned = false;
39566         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
39567         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39568         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39569         CVec_u8Z_free(ret_var);
39570         return ret_arr;
39571 }
39572
39573 int64_t  CS_LDK_BlindedForward_read(int8_tArray ser) {
39574         LDKu8slice ser_ref;
39575         ser_ref.datalen = ser->arr_len;
39576         ser_ref.data = ser->elems;
39577         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
39578         *ret_conv = BlindedForward_read(ser_ref);
39579         FREE(ser);
39580         return tag_ptr(ret_conv, true);
39581 }
39582
39583 int8_tArray  CS_LDK_PendingHTLCRouting_write(int64_t obj) {
39584         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
39585         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
39586         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39587         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39588         CVec_u8Z_free(ret_var);
39589         return ret_arr;
39590 }
39591
39592 int64_t  CS_LDK_PendingHTLCRouting_read(int8_tArray ser) {
39593         LDKu8slice ser_ref;
39594         ser_ref.datalen = ser->arr_len;
39595         ser_ref.data = ser->elems;
39596         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
39597         *ret_conv = PendingHTLCRouting_read(ser_ref);
39598         FREE(ser);
39599         return tag_ptr(ret_conv, true);
39600 }
39601
39602 int8_tArray  CS_LDK_PendingHTLCInfo_write(int64_t obj) {
39603         LDKPendingHTLCInfo obj_conv;
39604         obj_conv.inner = untag_ptr(obj);
39605         obj_conv.is_owned = ptr_is_owned(obj);
39606         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39607         obj_conv.is_owned = false;
39608         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
39609         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39610         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39611         CVec_u8Z_free(ret_var);
39612         return ret_arr;
39613 }
39614
39615 int64_t  CS_LDK_PendingHTLCInfo_read(int8_tArray ser) {
39616         LDKu8slice ser_ref;
39617         ser_ref.datalen = ser->arr_len;
39618         ser_ref.data = ser->elems;
39619         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
39620         *ret_conv = PendingHTLCInfo_read(ser_ref);
39621         FREE(ser);
39622         return tag_ptr(ret_conv, true);
39623 }
39624
39625 int8_tArray  CS_LDK_BlindedFailure_write(int64_t obj) {
39626         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
39627         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
39628         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39629         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39630         CVec_u8Z_free(ret_var);
39631         return ret_arr;
39632 }
39633
39634 int64_t  CS_LDK_BlindedFailure_read(int8_tArray ser) {
39635         LDKu8slice ser_ref;
39636         ser_ref.datalen = ser->arr_len;
39637         ser_ref.data = ser->elems;
39638         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
39639         *ret_conv = BlindedFailure_read(ser_ref);
39640         FREE(ser);
39641         return tag_ptr(ret_conv, true);
39642 }
39643
39644 int8_tArray  CS_LDK_ChannelManager_write(int64_t obj) {
39645         LDKChannelManager obj_conv;
39646         obj_conv.inner = untag_ptr(obj);
39647         obj_conv.is_owned = ptr_is_owned(obj);
39648         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39649         obj_conv.is_owned = false;
39650         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
39651         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39652         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39653         CVec_u8Z_free(ret_var);
39654         return ret_arr;
39655 }
39656
39657 int8_tArray  CS_LDK_ChannelShutdownState_write(int64_t obj) {
39658         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
39659         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
39660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39662         CVec_u8Z_free(ret_var);
39663         return ret_arr;
39664 }
39665
39666 int64_t  CS_LDK_ChannelShutdownState_read(int8_tArray ser) {
39667         LDKu8slice ser_ref;
39668         ser_ref.datalen = ser->arr_len;
39669         ser_ref.data = ser->elems;
39670         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
39671         *ret_conv = ChannelShutdownState_read(ser_ref);
39672         FREE(ser);
39673         return tag_ptr(ret_conv, true);
39674 }
39675
39676 void  CS_LDK_ChannelManagerReadArgs_free(int64_t this_obj) {
39677         LDKChannelManagerReadArgs this_obj_conv;
39678         this_obj_conv.inner = untag_ptr(this_obj);
39679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39681         ChannelManagerReadArgs_free(this_obj_conv);
39682 }
39683
39684 int64_t  CS_LDK_ChannelManagerReadArgs_get_entropy_source(int64_t this_ptr) {
39685         LDKChannelManagerReadArgs this_ptr_conv;
39686         this_ptr_conv.inner = untag_ptr(this_ptr);
39687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39689         this_ptr_conv.is_owned = false;
39690         // WARNING: This object doesn't live past this scope, needs clone!
39691         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
39692         return ret_ret;
39693 }
39694
39695 void  CS_LDK_ChannelManagerReadArgs_set_entropy_source(int64_t this_ptr, int64_t val) {
39696         LDKChannelManagerReadArgs this_ptr_conv;
39697         this_ptr_conv.inner = untag_ptr(this_ptr);
39698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39700         this_ptr_conv.is_owned = false;
39701         void* val_ptr = untag_ptr(val);
39702         CHECK_ACCESS(val_ptr);
39703         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
39704         if (val_conv.free == LDKEntropySource_JCalls_free) {
39705                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39706                 LDKEntropySource_JCalls_cloned(&val_conv);
39707         }
39708         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
39709 }
39710
39711 int64_t  CS_LDK_ChannelManagerReadArgs_get_node_signer(int64_t this_ptr) {
39712         LDKChannelManagerReadArgs this_ptr_conv;
39713         this_ptr_conv.inner = untag_ptr(this_ptr);
39714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39716         this_ptr_conv.is_owned = false;
39717         // WARNING: This object doesn't live past this scope, needs clone!
39718         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
39719         return ret_ret;
39720 }
39721
39722 void  CS_LDK_ChannelManagerReadArgs_set_node_signer(int64_t this_ptr, int64_t val) {
39723         LDKChannelManagerReadArgs this_ptr_conv;
39724         this_ptr_conv.inner = untag_ptr(this_ptr);
39725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39727         this_ptr_conv.is_owned = false;
39728         void* val_ptr = untag_ptr(val);
39729         CHECK_ACCESS(val_ptr);
39730         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
39731         if (val_conv.free == LDKNodeSigner_JCalls_free) {
39732                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39733                 LDKNodeSigner_JCalls_cloned(&val_conv);
39734         }
39735         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
39736 }
39737
39738 int64_t  CS_LDK_ChannelManagerReadArgs_get_signer_provider(int64_t this_ptr) {
39739         LDKChannelManagerReadArgs this_ptr_conv;
39740         this_ptr_conv.inner = untag_ptr(this_ptr);
39741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39743         this_ptr_conv.is_owned = false;
39744         // WARNING: This object doesn't live past this scope, needs clone!
39745         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
39746         return ret_ret;
39747 }
39748
39749 void  CS_LDK_ChannelManagerReadArgs_set_signer_provider(int64_t this_ptr, int64_t val) {
39750         LDKChannelManagerReadArgs this_ptr_conv;
39751         this_ptr_conv.inner = untag_ptr(this_ptr);
39752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39754         this_ptr_conv.is_owned = false;
39755         void* val_ptr = untag_ptr(val);
39756         CHECK_ACCESS(val_ptr);
39757         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
39758         if (val_conv.free == LDKSignerProvider_JCalls_free) {
39759                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39760                 LDKSignerProvider_JCalls_cloned(&val_conv);
39761         }
39762         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
39763 }
39764
39765 int64_t  CS_LDK_ChannelManagerReadArgs_get_fee_estimator(int64_t this_ptr) {
39766         LDKChannelManagerReadArgs this_ptr_conv;
39767         this_ptr_conv.inner = untag_ptr(this_ptr);
39768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39770         this_ptr_conv.is_owned = false;
39771         // WARNING: This object doesn't live past this scope, needs clone!
39772         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
39773         return ret_ret;
39774 }
39775
39776 void  CS_LDK_ChannelManagerReadArgs_set_fee_estimator(int64_t this_ptr, int64_t val) {
39777         LDKChannelManagerReadArgs this_ptr_conv;
39778         this_ptr_conv.inner = untag_ptr(this_ptr);
39779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39781         this_ptr_conv.is_owned = false;
39782         void* val_ptr = untag_ptr(val);
39783         CHECK_ACCESS(val_ptr);
39784         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
39785         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
39786                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39787                 LDKFeeEstimator_JCalls_cloned(&val_conv);
39788         }
39789         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
39790 }
39791
39792 int64_t  CS_LDK_ChannelManagerReadArgs_get_chain_monitor(int64_t this_ptr) {
39793         LDKChannelManagerReadArgs this_ptr_conv;
39794         this_ptr_conv.inner = untag_ptr(this_ptr);
39795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39797         this_ptr_conv.is_owned = false;
39798         // WARNING: This object doesn't live past this scope, needs clone!
39799         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
39800         return ret_ret;
39801 }
39802
39803 void  CS_LDK_ChannelManagerReadArgs_set_chain_monitor(int64_t this_ptr, int64_t val) {
39804         LDKChannelManagerReadArgs this_ptr_conv;
39805         this_ptr_conv.inner = untag_ptr(this_ptr);
39806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39808         this_ptr_conv.is_owned = false;
39809         void* val_ptr = untag_ptr(val);
39810         CHECK_ACCESS(val_ptr);
39811         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
39812         if (val_conv.free == LDKWatch_JCalls_free) {
39813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39814                 LDKWatch_JCalls_cloned(&val_conv);
39815         }
39816         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
39817 }
39818
39819 int64_t  CS_LDK_ChannelManagerReadArgs_get_tx_broadcaster(int64_t this_ptr) {
39820         LDKChannelManagerReadArgs this_ptr_conv;
39821         this_ptr_conv.inner = untag_ptr(this_ptr);
39822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39824         this_ptr_conv.is_owned = false;
39825         // WARNING: This object doesn't live past this scope, needs clone!
39826         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
39827         return ret_ret;
39828 }
39829
39830 void  CS_LDK_ChannelManagerReadArgs_set_tx_broadcaster(int64_t this_ptr, int64_t val) {
39831         LDKChannelManagerReadArgs this_ptr_conv;
39832         this_ptr_conv.inner = untag_ptr(this_ptr);
39833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39835         this_ptr_conv.is_owned = false;
39836         void* val_ptr = untag_ptr(val);
39837         CHECK_ACCESS(val_ptr);
39838         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
39839         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
39840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39841                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
39842         }
39843         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
39844 }
39845
39846 int64_t  CS_LDK_ChannelManagerReadArgs_get_router(int64_t this_ptr) {
39847         LDKChannelManagerReadArgs this_ptr_conv;
39848         this_ptr_conv.inner = untag_ptr(this_ptr);
39849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39851         this_ptr_conv.is_owned = false;
39852         // WARNING: This object doesn't live past this scope, needs clone!
39853         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
39854         return ret_ret;
39855 }
39856
39857 void  CS_LDK_ChannelManagerReadArgs_set_router(int64_t this_ptr, int64_t val) {
39858         LDKChannelManagerReadArgs this_ptr_conv;
39859         this_ptr_conv.inner = untag_ptr(this_ptr);
39860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39862         this_ptr_conv.is_owned = false;
39863         void* val_ptr = untag_ptr(val);
39864         CHECK_ACCESS(val_ptr);
39865         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
39866         if (val_conv.free == LDKRouter_JCalls_free) {
39867                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39868                 LDKRouter_JCalls_cloned(&val_conv);
39869         }
39870         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
39871 }
39872
39873 int64_t  CS_LDK_ChannelManagerReadArgs_get_logger(int64_t this_ptr) {
39874         LDKChannelManagerReadArgs this_ptr_conv;
39875         this_ptr_conv.inner = untag_ptr(this_ptr);
39876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39878         this_ptr_conv.is_owned = false;
39879         // WARNING: This object doesn't live past this scope, needs clone!
39880         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
39881         return ret_ret;
39882 }
39883
39884 void  CS_LDK_ChannelManagerReadArgs_set_logger(int64_t this_ptr, int64_t val) {
39885         LDKChannelManagerReadArgs this_ptr_conv;
39886         this_ptr_conv.inner = untag_ptr(this_ptr);
39887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39889         this_ptr_conv.is_owned = false;
39890         void* val_ptr = untag_ptr(val);
39891         CHECK_ACCESS(val_ptr);
39892         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
39893         if (val_conv.free == LDKLogger_JCalls_free) {
39894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39895                 LDKLogger_JCalls_cloned(&val_conv);
39896         }
39897         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
39898 }
39899
39900 int64_t  CS_LDK_ChannelManagerReadArgs_get_default_config(int64_t this_ptr) {
39901         LDKChannelManagerReadArgs this_ptr_conv;
39902         this_ptr_conv.inner = untag_ptr(this_ptr);
39903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39905         this_ptr_conv.is_owned = false;
39906         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
39907         int64_t ret_ref = 0;
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39910         return ret_ref;
39911 }
39912
39913 void  CS_LDK_ChannelManagerReadArgs_set_default_config(int64_t this_ptr, int64_t val) {
39914         LDKChannelManagerReadArgs this_ptr_conv;
39915         this_ptr_conv.inner = untag_ptr(this_ptr);
39916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39918         this_ptr_conv.is_owned = false;
39919         LDKUserConfig val_conv;
39920         val_conv.inner = untag_ptr(val);
39921         val_conv.is_owned = ptr_is_owned(val);
39922         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39923         val_conv = UserConfig_clone(&val_conv);
39924         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
39925 }
39926
39927 int64_t  CS_LDK_ChannelManagerReadArgs_new(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) {
39928         void* entropy_source_ptr = untag_ptr(entropy_source);
39929         CHECK_ACCESS(entropy_source_ptr);
39930         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
39931         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
39932                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39933                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
39934         }
39935         void* node_signer_ptr = untag_ptr(node_signer);
39936         CHECK_ACCESS(node_signer_ptr);
39937         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
39938         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
39939                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39940                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
39941         }
39942         void* signer_provider_ptr = untag_ptr(signer_provider);
39943         CHECK_ACCESS(signer_provider_ptr);
39944         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
39945         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
39946                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39947                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
39948         }
39949         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39950         CHECK_ACCESS(fee_estimator_ptr);
39951         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39952         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39953                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39954                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39955         }
39956         void* chain_monitor_ptr = untag_ptr(chain_monitor);
39957         CHECK_ACCESS(chain_monitor_ptr);
39958         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
39959         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
39960                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39961                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
39962         }
39963         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
39964         CHECK_ACCESS(tx_broadcaster_ptr);
39965         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
39966         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39967                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39968                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
39969         }
39970         void* router_ptr = untag_ptr(router);
39971         CHECK_ACCESS(router_ptr);
39972         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
39973         if (router_conv.free == LDKRouter_JCalls_free) {
39974                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39975                 LDKRouter_JCalls_cloned(&router_conv);
39976         }
39977         void* logger_ptr = untag_ptr(logger);
39978         CHECK_ACCESS(logger_ptr);
39979         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39980         if (logger_conv.free == LDKLogger_JCalls_free) {
39981                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39982                 LDKLogger_JCalls_cloned(&logger_conv);
39983         }
39984         LDKUserConfig default_config_conv;
39985         default_config_conv.inner = untag_ptr(default_config);
39986         default_config_conv.is_owned = ptr_is_owned(default_config);
39987         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
39988         default_config_conv = UserConfig_clone(&default_config_conv);
39989         LDKCVec_ChannelMonitorZ channel_monitors_constr;
39990         channel_monitors_constr.datalen = channel_monitors->arr_len;
39991         if (channel_monitors_constr.datalen > 0)
39992                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
39993         else
39994                 channel_monitors_constr.data = NULL;
39995         int64_t* channel_monitors_vals = channel_monitors->elems;
39996         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
39997                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
39998                 LDKChannelMonitor channel_monitors_conv_16_conv;
39999                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
40000                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
40001                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
40002                 channel_monitors_conv_16_conv.is_owned = false;
40003                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
40004         }
40005         FREE(channel_monitors);
40006         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);
40007         int64_t ret_ref = 0;
40008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40010         return ret_ref;
40011 }
40012
40013 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, int64_t arg) {
40014         LDKu8slice ser_ref;
40015         ser_ref.datalen = ser->arr_len;
40016         ser_ref.data = ser->elems;
40017         LDKChannelManagerReadArgs arg_conv;
40018         arg_conv.inner = untag_ptr(arg);
40019         arg_conv.is_owned = ptr_is_owned(arg);
40020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40021         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
40022         
40023         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
40024         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
40025         FREE(ser);
40026         return tag_ptr(ret_conv, true);
40027 }
40028
40029 void  CS_LDK_DelayedPaymentBasepoint_free(int64_t this_obj) {
40030         LDKDelayedPaymentBasepoint this_obj_conv;
40031         this_obj_conv.inner = untag_ptr(this_obj);
40032         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40034         DelayedPaymentBasepoint_free(this_obj_conv);
40035 }
40036
40037 int8_tArray  CS_LDK_DelayedPaymentBasepoint_get_a(int64_t this_ptr) {
40038         LDKDelayedPaymentBasepoint this_ptr_conv;
40039         this_ptr_conv.inner = untag_ptr(this_ptr);
40040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40042         this_ptr_conv.is_owned = false;
40043         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40044         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40045         return ret_arr;
40046 }
40047
40048 void  CS_LDK_DelayedPaymentBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
40049         LDKDelayedPaymentBasepoint this_ptr_conv;
40050         this_ptr_conv.inner = untag_ptr(this_ptr);
40051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40053         this_ptr_conv.is_owned = false;
40054         LDKPublicKey val_ref;
40055         CHECK(val->arr_len == 33);
40056         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40057         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
40058 }
40059
40060 int64_t  CS_LDK_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
40061         LDKPublicKey a_arg_ref;
40062         CHECK(a_arg->arr_len == 33);
40063         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40064         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
40065         int64_t ret_ref = 0;
40066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40068         return ret_ref;
40069 }
40070
40071 jboolean  CS_LDK_DelayedPaymentBasepoint_eq(int64_t a, int64_t b) {
40072         LDKDelayedPaymentBasepoint a_conv;
40073         a_conv.inner = untag_ptr(a);
40074         a_conv.is_owned = ptr_is_owned(a);
40075         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40076         a_conv.is_owned = false;
40077         LDKDelayedPaymentBasepoint b_conv;
40078         b_conv.inner = untag_ptr(b);
40079         b_conv.is_owned = ptr_is_owned(b);
40080         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40081         b_conv.is_owned = false;
40082         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
40083         return ret_conv;
40084 }
40085
40086 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
40087         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
40088         int64_t ret_ref = 0;
40089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40091         return ret_ref;
40092 }
40093 int64_t  CS_LDK_DelayedPaymentBasepoint_clone_ptr(int64_t arg) {
40094         LDKDelayedPaymentBasepoint arg_conv;
40095         arg_conv.inner = untag_ptr(arg);
40096         arg_conv.is_owned = ptr_is_owned(arg);
40097         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40098         arg_conv.is_owned = false;
40099         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
40100         return ret_conv;
40101 }
40102
40103 int64_t  CS_LDK_DelayedPaymentBasepoint_clone(int64_t orig) {
40104         LDKDelayedPaymentBasepoint orig_conv;
40105         orig_conv.inner = untag_ptr(orig);
40106         orig_conv.is_owned = ptr_is_owned(orig);
40107         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40108         orig_conv.is_owned = false;
40109         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
40110         int64_t ret_ref = 0;
40111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40113         return ret_ref;
40114 }
40115
40116 int64_t  CS_LDK_DelayedPaymentBasepoint_hash(int64_t o) {
40117         LDKDelayedPaymentBasepoint o_conv;
40118         o_conv.inner = untag_ptr(o);
40119         o_conv.is_owned = ptr_is_owned(o);
40120         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40121         o_conv.is_owned = false;
40122         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
40123         return ret_conv;
40124 }
40125
40126 int8_tArray  CS_LDK_DelayedPaymentBasepoint_to_public_key(int64_t this_arg) {
40127         LDKDelayedPaymentBasepoint this_arg_conv;
40128         this_arg_conv.inner = untag_ptr(this_arg);
40129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40131         this_arg_conv.is_owned = false;
40132         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40133         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40134         return ret_arr;
40135 }
40136
40137 int8_tArray  CS_LDK_DelayedPaymentBasepoint_write(int64_t obj) {
40138         LDKDelayedPaymentBasepoint obj_conv;
40139         obj_conv.inner = untag_ptr(obj);
40140         obj_conv.is_owned = ptr_is_owned(obj);
40141         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40142         obj_conv.is_owned = false;
40143         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
40144         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40145         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40146         CVec_u8Z_free(ret_var);
40147         return ret_arr;
40148 }
40149
40150 int64_t  CS_LDK_DelayedPaymentBasepoint_read(int8_tArray ser) {
40151         LDKu8slice ser_ref;
40152         ser_ref.datalen = ser->arr_len;
40153         ser_ref.data = ser->elems;
40154         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40155         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
40156         FREE(ser);
40157         return tag_ptr(ret_conv, true);
40158 }
40159
40160 void  CS_LDK_DelayedPaymentKey_free(int64_t this_obj) {
40161         LDKDelayedPaymentKey this_obj_conv;
40162         this_obj_conv.inner = untag_ptr(this_obj);
40163         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40165         DelayedPaymentKey_free(this_obj_conv);
40166 }
40167
40168 int8_tArray  CS_LDK_DelayedPaymentKey_get_a(int64_t this_ptr) {
40169         LDKDelayedPaymentKey this_ptr_conv;
40170         this_ptr_conv.inner = untag_ptr(this_ptr);
40171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40173         this_ptr_conv.is_owned = false;
40174         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40175         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
40176         return ret_arr;
40177 }
40178
40179 void  CS_LDK_DelayedPaymentKey_set_a(int64_t this_ptr, int8_tArray val) {
40180         LDKDelayedPaymentKey this_ptr_conv;
40181         this_ptr_conv.inner = untag_ptr(this_ptr);
40182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40184         this_ptr_conv.is_owned = false;
40185         LDKPublicKey val_ref;
40186         CHECK(val->arr_len == 33);
40187         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40188         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
40189 }
40190
40191 int64_t  CS_LDK_DelayedPaymentKey_new(int8_tArray a_arg) {
40192         LDKPublicKey a_arg_ref;
40193         CHECK(a_arg->arr_len == 33);
40194         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40195         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
40196         int64_t ret_ref = 0;
40197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40199         return ret_ref;
40200 }
40201
40202 jboolean  CS_LDK_DelayedPaymentKey_eq(int64_t a, int64_t b) {
40203         LDKDelayedPaymentKey a_conv;
40204         a_conv.inner = untag_ptr(a);
40205         a_conv.is_owned = ptr_is_owned(a);
40206         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40207         a_conv.is_owned = false;
40208         LDKDelayedPaymentKey b_conv;
40209         b_conv.inner = untag_ptr(b);
40210         b_conv.is_owned = ptr_is_owned(b);
40211         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40212         b_conv.is_owned = false;
40213         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
40214         return ret_conv;
40215 }
40216
40217 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
40218         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
40219         int64_t ret_ref = 0;
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40222         return ret_ref;
40223 }
40224 int64_t  CS_LDK_DelayedPaymentKey_clone_ptr(int64_t arg) {
40225         LDKDelayedPaymentKey arg_conv;
40226         arg_conv.inner = untag_ptr(arg);
40227         arg_conv.is_owned = ptr_is_owned(arg);
40228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40229         arg_conv.is_owned = false;
40230         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
40231         return ret_conv;
40232 }
40233
40234 int64_t  CS_LDK_DelayedPaymentKey_clone(int64_t orig) {
40235         LDKDelayedPaymentKey orig_conv;
40236         orig_conv.inner = untag_ptr(orig);
40237         orig_conv.is_owned = ptr_is_owned(orig);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40239         orig_conv.is_owned = false;
40240         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
40241         int64_t ret_ref = 0;
40242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40244         return ret_ref;
40245 }
40246
40247 int64_t  CS_LDK_DelayedPaymentKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40248         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
40249         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40250         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40251         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40252         countersignatory_basepoint_conv.is_owned = false;
40253         LDKPublicKey per_commitment_point_ref;
40254         CHECK(per_commitment_point->arr_len == 33);
40255         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40256         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40257         int64_t ret_ref = 0;
40258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40260         return ret_ref;
40261 }
40262
40263 int64_t  CS_LDK_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
40264         uint8_t sk_arr[32];
40265         CHECK(sk->arr_len == 32);
40266         memcpy(sk_arr, sk->elems, 32); FREE(sk);
40267         uint8_t (*sk_ref)[32] = &sk_arr;
40268         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
40269         int64_t ret_ref = 0;
40270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40272         return ret_ref;
40273 }
40274
40275 int8_tArray  CS_LDK_DelayedPaymentKey_to_public_key(int64_t this_arg) {
40276         LDKDelayedPaymentKey this_arg_conv;
40277         this_arg_conv.inner = untag_ptr(this_arg);
40278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40280         this_arg_conv.is_owned = false;
40281         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40282         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
40283         return ret_arr;
40284 }
40285
40286 int8_tArray  CS_LDK_DelayedPaymentKey_write(int64_t obj) {
40287         LDKDelayedPaymentKey obj_conv;
40288         obj_conv.inner = untag_ptr(obj);
40289         obj_conv.is_owned = ptr_is_owned(obj);
40290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40291         obj_conv.is_owned = false;
40292         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
40293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40295         CVec_u8Z_free(ret_var);
40296         return ret_arr;
40297 }
40298
40299 int64_t  CS_LDK_DelayedPaymentKey_read(int8_tArray ser) {
40300         LDKu8slice ser_ref;
40301         ser_ref.datalen = ser->arr_len;
40302         ser_ref.data = ser->elems;
40303         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40304         *ret_conv = DelayedPaymentKey_read(ser_ref);
40305         FREE(ser);
40306         return tag_ptr(ret_conv, true);
40307 }
40308
40309 void  CS_LDK_HtlcBasepoint_free(int64_t this_obj) {
40310         LDKHtlcBasepoint this_obj_conv;
40311         this_obj_conv.inner = untag_ptr(this_obj);
40312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40314         HtlcBasepoint_free(this_obj_conv);
40315 }
40316
40317 int8_tArray  CS_LDK_HtlcBasepoint_get_a(int64_t this_ptr) {
40318         LDKHtlcBasepoint this_ptr_conv;
40319         this_ptr_conv.inner = untag_ptr(this_ptr);
40320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40322         this_ptr_conv.is_owned = false;
40323         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40324         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40325         return ret_arr;
40326 }
40327
40328 void  CS_LDK_HtlcBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
40329         LDKHtlcBasepoint this_ptr_conv;
40330         this_ptr_conv.inner = untag_ptr(this_ptr);
40331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40333         this_ptr_conv.is_owned = false;
40334         LDKPublicKey val_ref;
40335         CHECK(val->arr_len == 33);
40336         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40337         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
40338 }
40339
40340 int64_t  CS_LDK_HtlcBasepoint_new(int8_tArray a_arg) {
40341         LDKPublicKey a_arg_ref;
40342         CHECK(a_arg->arr_len == 33);
40343         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40344         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
40345         int64_t ret_ref = 0;
40346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40348         return ret_ref;
40349 }
40350
40351 jboolean  CS_LDK_HtlcBasepoint_eq(int64_t a, int64_t b) {
40352         LDKHtlcBasepoint a_conv;
40353         a_conv.inner = untag_ptr(a);
40354         a_conv.is_owned = ptr_is_owned(a);
40355         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40356         a_conv.is_owned = false;
40357         LDKHtlcBasepoint b_conv;
40358         b_conv.inner = untag_ptr(b);
40359         b_conv.is_owned = ptr_is_owned(b);
40360         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40361         b_conv.is_owned = false;
40362         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
40363         return ret_conv;
40364 }
40365
40366 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
40367         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
40368         int64_t ret_ref = 0;
40369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40371         return ret_ref;
40372 }
40373 int64_t  CS_LDK_HtlcBasepoint_clone_ptr(int64_t arg) {
40374         LDKHtlcBasepoint arg_conv;
40375         arg_conv.inner = untag_ptr(arg);
40376         arg_conv.is_owned = ptr_is_owned(arg);
40377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40378         arg_conv.is_owned = false;
40379         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
40380         return ret_conv;
40381 }
40382
40383 int64_t  CS_LDK_HtlcBasepoint_clone(int64_t orig) {
40384         LDKHtlcBasepoint orig_conv;
40385         orig_conv.inner = untag_ptr(orig);
40386         orig_conv.is_owned = ptr_is_owned(orig);
40387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40388         orig_conv.is_owned = false;
40389         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
40390         int64_t ret_ref = 0;
40391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40393         return ret_ref;
40394 }
40395
40396 int64_t  CS_LDK_HtlcBasepoint_hash(int64_t o) {
40397         LDKHtlcBasepoint o_conv;
40398         o_conv.inner = untag_ptr(o);
40399         o_conv.is_owned = ptr_is_owned(o);
40400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40401         o_conv.is_owned = false;
40402         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
40403         return ret_conv;
40404 }
40405
40406 int8_tArray  CS_LDK_HtlcBasepoint_to_public_key(int64_t this_arg) {
40407         LDKHtlcBasepoint this_arg_conv;
40408         this_arg_conv.inner = untag_ptr(this_arg);
40409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40411         this_arg_conv.is_owned = false;
40412         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40413         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40414         return ret_arr;
40415 }
40416
40417 int8_tArray  CS_LDK_HtlcBasepoint_write(int64_t obj) {
40418         LDKHtlcBasepoint obj_conv;
40419         obj_conv.inner = untag_ptr(obj);
40420         obj_conv.is_owned = ptr_is_owned(obj);
40421         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40422         obj_conv.is_owned = false;
40423         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
40424         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40425         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40426         CVec_u8Z_free(ret_var);
40427         return ret_arr;
40428 }
40429
40430 int64_t  CS_LDK_HtlcBasepoint_read(int8_tArray ser) {
40431         LDKu8slice ser_ref;
40432         ser_ref.datalen = ser->arr_len;
40433         ser_ref.data = ser->elems;
40434         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40435         *ret_conv = HtlcBasepoint_read(ser_ref);
40436         FREE(ser);
40437         return tag_ptr(ret_conv, true);
40438 }
40439
40440 void  CS_LDK_HtlcKey_free(int64_t this_obj) {
40441         LDKHtlcKey this_obj_conv;
40442         this_obj_conv.inner = untag_ptr(this_obj);
40443         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40445         HtlcKey_free(this_obj_conv);
40446 }
40447
40448 int8_tArray  CS_LDK_HtlcKey_get_a(int64_t this_ptr) {
40449         LDKHtlcKey this_ptr_conv;
40450         this_ptr_conv.inner = untag_ptr(this_ptr);
40451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40453         this_ptr_conv.is_owned = false;
40454         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40455         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
40456         return ret_arr;
40457 }
40458
40459 void  CS_LDK_HtlcKey_set_a(int64_t this_ptr, int8_tArray val) {
40460         LDKHtlcKey this_ptr_conv;
40461         this_ptr_conv.inner = untag_ptr(this_ptr);
40462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40464         this_ptr_conv.is_owned = false;
40465         LDKPublicKey val_ref;
40466         CHECK(val->arr_len == 33);
40467         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40468         HtlcKey_set_a(&this_ptr_conv, val_ref);
40469 }
40470
40471 int64_t  CS_LDK_HtlcKey_new(int8_tArray a_arg) {
40472         LDKPublicKey a_arg_ref;
40473         CHECK(a_arg->arr_len == 33);
40474         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40475         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
40476         int64_t ret_ref = 0;
40477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40479         return ret_ref;
40480 }
40481
40482 jboolean  CS_LDK_HtlcKey_eq(int64_t a, int64_t b) {
40483         LDKHtlcKey a_conv;
40484         a_conv.inner = untag_ptr(a);
40485         a_conv.is_owned = ptr_is_owned(a);
40486         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40487         a_conv.is_owned = false;
40488         LDKHtlcKey b_conv;
40489         b_conv.inner = untag_ptr(b);
40490         b_conv.is_owned = ptr_is_owned(b);
40491         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40492         b_conv.is_owned = false;
40493         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
40494         return ret_conv;
40495 }
40496
40497 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
40498         LDKHtlcKey ret_var = HtlcKey_clone(arg);
40499         int64_t ret_ref = 0;
40500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40502         return ret_ref;
40503 }
40504 int64_t  CS_LDK_HtlcKey_clone_ptr(int64_t arg) {
40505         LDKHtlcKey arg_conv;
40506         arg_conv.inner = untag_ptr(arg);
40507         arg_conv.is_owned = ptr_is_owned(arg);
40508         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40509         arg_conv.is_owned = false;
40510         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
40511         return ret_conv;
40512 }
40513
40514 int64_t  CS_LDK_HtlcKey_clone(int64_t orig) {
40515         LDKHtlcKey orig_conv;
40516         orig_conv.inner = untag_ptr(orig);
40517         orig_conv.is_owned = ptr_is_owned(orig);
40518         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40519         orig_conv.is_owned = false;
40520         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
40521         int64_t ret_ref = 0;
40522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40524         return ret_ref;
40525 }
40526
40527 int64_t  CS_LDK_HtlcKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40528         LDKHtlcBasepoint countersignatory_basepoint_conv;
40529         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40530         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40531         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40532         countersignatory_basepoint_conv.is_owned = false;
40533         LDKPublicKey per_commitment_point_ref;
40534         CHECK(per_commitment_point->arr_len == 33);
40535         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40536         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40537         int64_t ret_ref = 0;
40538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40540         return ret_ref;
40541 }
40542
40543 int64_t  CS_LDK_HtlcKey_from_secret_key(int8_tArray sk) {
40544         uint8_t sk_arr[32];
40545         CHECK(sk->arr_len == 32);
40546         memcpy(sk_arr, sk->elems, 32); FREE(sk);
40547         uint8_t (*sk_ref)[32] = &sk_arr;
40548         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
40549         int64_t ret_ref = 0;
40550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40552         return ret_ref;
40553 }
40554
40555 int8_tArray  CS_LDK_HtlcKey_to_public_key(int64_t this_arg) {
40556         LDKHtlcKey this_arg_conv;
40557         this_arg_conv.inner = untag_ptr(this_arg);
40558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40560         this_arg_conv.is_owned = false;
40561         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40562         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
40563         return ret_arr;
40564 }
40565
40566 int8_tArray  CS_LDK_HtlcKey_write(int64_t obj) {
40567         LDKHtlcKey obj_conv;
40568         obj_conv.inner = untag_ptr(obj);
40569         obj_conv.is_owned = ptr_is_owned(obj);
40570         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40571         obj_conv.is_owned = false;
40572         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
40573         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40574         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40575         CVec_u8Z_free(ret_var);
40576         return ret_arr;
40577 }
40578
40579 int64_t  CS_LDK_HtlcKey_read(int8_tArray ser) {
40580         LDKu8slice ser_ref;
40581         ser_ref.datalen = ser->arr_len;
40582         ser_ref.data = ser->elems;
40583         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40584         *ret_conv = HtlcKey_read(ser_ref);
40585         FREE(ser);
40586         return tag_ptr(ret_conv, true);
40587 }
40588
40589 void  CS_LDK_RevocationBasepoint_free(int64_t this_obj) {
40590         LDKRevocationBasepoint this_obj_conv;
40591         this_obj_conv.inner = untag_ptr(this_obj);
40592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40594         RevocationBasepoint_free(this_obj_conv);
40595 }
40596
40597 int8_tArray  CS_LDK_RevocationBasepoint_get_a(int64_t this_ptr) {
40598         LDKRevocationBasepoint this_ptr_conv;
40599         this_ptr_conv.inner = untag_ptr(this_ptr);
40600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40602         this_ptr_conv.is_owned = false;
40603         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40604         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40605         return ret_arr;
40606 }
40607
40608 void  CS_LDK_RevocationBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
40609         LDKRevocationBasepoint this_ptr_conv;
40610         this_ptr_conv.inner = untag_ptr(this_ptr);
40611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40613         this_ptr_conv.is_owned = false;
40614         LDKPublicKey val_ref;
40615         CHECK(val->arr_len == 33);
40616         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40617         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
40618 }
40619
40620 int64_t  CS_LDK_RevocationBasepoint_new(int8_tArray a_arg) {
40621         LDKPublicKey a_arg_ref;
40622         CHECK(a_arg->arr_len == 33);
40623         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40624         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
40625         int64_t ret_ref = 0;
40626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40628         return ret_ref;
40629 }
40630
40631 jboolean  CS_LDK_RevocationBasepoint_eq(int64_t a, int64_t b) {
40632         LDKRevocationBasepoint a_conv;
40633         a_conv.inner = untag_ptr(a);
40634         a_conv.is_owned = ptr_is_owned(a);
40635         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40636         a_conv.is_owned = false;
40637         LDKRevocationBasepoint b_conv;
40638         b_conv.inner = untag_ptr(b);
40639         b_conv.is_owned = ptr_is_owned(b);
40640         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40641         b_conv.is_owned = false;
40642         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
40643         return ret_conv;
40644 }
40645
40646 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
40647         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
40648         int64_t ret_ref = 0;
40649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40651         return ret_ref;
40652 }
40653 int64_t  CS_LDK_RevocationBasepoint_clone_ptr(int64_t arg) {
40654         LDKRevocationBasepoint arg_conv;
40655         arg_conv.inner = untag_ptr(arg);
40656         arg_conv.is_owned = ptr_is_owned(arg);
40657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40658         arg_conv.is_owned = false;
40659         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
40660         return ret_conv;
40661 }
40662
40663 int64_t  CS_LDK_RevocationBasepoint_clone(int64_t orig) {
40664         LDKRevocationBasepoint orig_conv;
40665         orig_conv.inner = untag_ptr(orig);
40666         orig_conv.is_owned = ptr_is_owned(orig);
40667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40668         orig_conv.is_owned = false;
40669         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
40670         int64_t ret_ref = 0;
40671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40673         return ret_ref;
40674 }
40675
40676 int64_t  CS_LDK_RevocationBasepoint_hash(int64_t o) {
40677         LDKRevocationBasepoint o_conv;
40678         o_conv.inner = untag_ptr(o);
40679         o_conv.is_owned = ptr_is_owned(o);
40680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40681         o_conv.is_owned = false;
40682         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
40683         return ret_conv;
40684 }
40685
40686 int8_tArray  CS_LDK_RevocationBasepoint_to_public_key(int64_t this_arg) {
40687         LDKRevocationBasepoint this_arg_conv;
40688         this_arg_conv.inner = untag_ptr(this_arg);
40689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40691         this_arg_conv.is_owned = false;
40692         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40693         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40694         return ret_arr;
40695 }
40696
40697 int8_tArray  CS_LDK_RevocationBasepoint_write(int64_t obj) {
40698         LDKRevocationBasepoint obj_conv;
40699         obj_conv.inner = untag_ptr(obj);
40700         obj_conv.is_owned = ptr_is_owned(obj);
40701         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40702         obj_conv.is_owned = false;
40703         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
40704         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40705         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40706         CVec_u8Z_free(ret_var);
40707         return ret_arr;
40708 }
40709
40710 int64_t  CS_LDK_RevocationBasepoint_read(int8_tArray ser) {
40711         LDKu8slice ser_ref;
40712         ser_ref.datalen = ser->arr_len;
40713         ser_ref.data = ser->elems;
40714         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40715         *ret_conv = RevocationBasepoint_read(ser_ref);
40716         FREE(ser);
40717         return tag_ptr(ret_conv, true);
40718 }
40719
40720 void  CS_LDK_RevocationKey_free(int64_t this_obj) {
40721         LDKRevocationKey this_obj_conv;
40722         this_obj_conv.inner = untag_ptr(this_obj);
40723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40725         RevocationKey_free(this_obj_conv);
40726 }
40727
40728 int8_tArray  CS_LDK_RevocationKey_get_a(int64_t this_ptr) {
40729         LDKRevocationKey this_ptr_conv;
40730         this_ptr_conv.inner = untag_ptr(this_ptr);
40731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40733         this_ptr_conv.is_owned = false;
40734         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40735         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
40736         return ret_arr;
40737 }
40738
40739 void  CS_LDK_RevocationKey_set_a(int64_t this_ptr, int8_tArray val) {
40740         LDKRevocationKey this_ptr_conv;
40741         this_ptr_conv.inner = untag_ptr(this_ptr);
40742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40744         this_ptr_conv.is_owned = false;
40745         LDKPublicKey val_ref;
40746         CHECK(val->arr_len == 33);
40747         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40748         RevocationKey_set_a(&this_ptr_conv, val_ref);
40749 }
40750
40751 int64_t  CS_LDK_RevocationKey_new(int8_tArray a_arg) {
40752         LDKPublicKey a_arg_ref;
40753         CHECK(a_arg->arr_len == 33);
40754         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40755         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
40756         int64_t ret_ref = 0;
40757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40759         return ret_ref;
40760 }
40761
40762 jboolean  CS_LDK_RevocationKey_eq(int64_t a, int64_t b) {
40763         LDKRevocationKey a_conv;
40764         a_conv.inner = untag_ptr(a);
40765         a_conv.is_owned = ptr_is_owned(a);
40766         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40767         a_conv.is_owned = false;
40768         LDKRevocationKey b_conv;
40769         b_conv.inner = untag_ptr(b);
40770         b_conv.is_owned = ptr_is_owned(b);
40771         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40772         b_conv.is_owned = false;
40773         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
40774         return ret_conv;
40775 }
40776
40777 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
40778         LDKRevocationKey ret_var = RevocationKey_clone(arg);
40779         int64_t ret_ref = 0;
40780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40782         return ret_ref;
40783 }
40784 int64_t  CS_LDK_RevocationKey_clone_ptr(int64_t arg) {
40785         LDKRevocationKey arg_conv;
40786         arg_conv.inner = untag_ptr(arg);
40787         arg_conv.is_owned = ptr_is_owned(arg);
40788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40789         arg_conv.is_owned = false;
40790         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
40791         return ret_conv;
40792 }
40793
40794 int64_t  CS_LDK_RevocationKey_clone(int64_t orig) {
40795         LDKRevocationKey orig_conv;
40796         orig_conv.inner = untag_ptr(orig);
40797         orig_conv.is_owned = ptr_is_owned(orig);
40798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40799         orig_conv.is_owned = false;
40800         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
40801         int64_t ret_ref = 0;
40802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40804         return ret_ref;
40805 }
40806
40807 int64_t  CS_LDK_RevocationKey_hash(int64_t o) {
40808         LDKRevocationKey o_conv;
40809         o_conv.inner = untag_ptr(o);
40810         o_conv.is_owned = ptr_is_owned(o);
40811         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40812         o_conv.is_owned = false;
40813         int64_t ret_conv = RevocationKey_hash(&o_conv);
40814         return ret_conv;
40815 }
40816
40817 int64_t  CS_LDK_RevocationKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40818         LDKRevocationBasepoint countersignatory_basepoint_conv;
40819         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40820         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40821         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40822         countersignatory_basepoint_conv.is_owned = false;
40823         LDKPublicKey per_commitment_point_ref;
40824         CHECK(per_commitment_point->arr_len == 33);
40825         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40826         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40827         int64_t ret_ref = 0;
40828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40830         return ret_ref;
40831 }
40832
40833 int8_tArray  CS_LDK_RevocationKey_to_public_key(int64_t this_arg) {
40834         LDKRevocationKey this_arg_conv;
40835         this_arg_conv.inner = untag_ptr(this_arg);
40836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40838         this_arg_conv.is_owned = false;
40839         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40840         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
40841         return ret_arr;
40842 }
40843
40844 int8_tArray  CS_LDK_RevocationKey_write(int64_t obj) {
40845         LDKRevocationKey obj_conv;
40846         obj_conv.inner = untag_ptr(obj);
40847         obj_conv.is_owned = ptr_is_owned(obj);
40848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40849         obj_conv.is_owned = false;
40850         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
40851         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40852         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40853         CVec_u8Z_free(ret_var);
40854         return ret_arr;
40855 }
40856
40857 int64_t  CS_LDK_RevocationKey_read(int8_tArray ser) {
40858         LDKu8slice ser_ref;
40859         ser_ref.datalen = ser->arr_len;
40860         ser_ref.data = ser->elems;
40861         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40862         *ret_conv = RevocationKey_read(ser_ref);
40863         FREE(ser);
40864         return tag_ptr(ret_conv, true);
40865 }
40866
40867 void  CS_LDK_ExpandedKey_free(int64_t this_obj) {
40868         LDKExpandedKey this_obj_conv;
40869         this_obj_conv.inner = untag_ptr(this_obj);
40870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40872         ExpandedKey_free(this_obj_conv);
40873 }
40874
40875 int64_t  CS_LDK_ExpandedKey_new(int8_tArray key_material) {
40876         uint8_t key_material_arr[32];
40877         CHECK(key_material->arr_len == 32);
40878         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
40879         uint8_t (*key_material_ref)[32] = &key_material_arr;
40880         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
40881         int64_t ret_ref = 0;
40882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40884         return ret_ref;
40885 }
40886
40887 int64_t  CS_LDK_create(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) {
40888         LDKExpandedKey keys_conv;
40889         keys_conv.inner = untag_ptr(keys);
40890         keys_conv.is_owned = ptr_is_owned(keys);
40891         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40892         keys_conv.is_owned = false;
40893         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40894         CHECK_ACCESS(min_value_msat_ptr);
40895         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40896         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40897         void* entropy_source_ptr = untag_ptr(entropy_source);
40898         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40899         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40900         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40901         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40902         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40903         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40904         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
40905         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
40906         return tag_ptr(ret_conv, true);
40907 }
40908
40909 int64_t  CS_LDK_create_from_hash(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) {
40910         LDKExpandedKey keys_conv;
40911         keys_conv.inner = untag_ptr(keys);
40912         keys_conv.is_owned = ptr_is_owned(keys);
40913         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40914         keys_conv.is_owned = false;
40915         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40916         CHECK_ACCESS(min_value_msat_ptr);
40917         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40918         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40919         LDKThirtyTwoBytes payment_hash_ref;
40920         CHECK(payment_hash->arr_len == 32);
40921         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
40922         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40923         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40924         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40925         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40926         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
40927         *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);
40928         return tag_ptr(ret_conv, true);
40929 }
40930
40931 void  CS_LDK_DecodeError_free(int64_t this_ptr) {
40932         if (!ptr_is_owned(this_ptr)) return;
40933         void* this_ptr_ptr = untag_ptr(this_ptr);
40934         CHECK_ACCESS(this_ptr_ptr);
40935         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
40936         FREE(untag_ptr(this_ptr));
40937         DecodeError_free(this_ptr_conv);
40938 }
40939
40940 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
40941         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40942         *ret_copy = DecodeError_clone(arg);
40943         int64_t ret_ref = tag_ptr(ret_copy, true);
40944         return ret_ref;
40945 }
40946 int64_t  CS_LDK_DecodeError_clone_ptr(int64_t arg) {
40947         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
40948         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
40949         return ret_conv;
40950 }
40951
40952 int64_t  CS_LDK_DecodeError_clone(int64_t orig) {
40953         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
40954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40955         *ret_copy = DecodeError_clone(orig_conv);
40956         int64_t ret_ref = tag_ptr(ret_copy, true);
40957         return ret_ref;
40958 }
40959
40960 int64_t  CS_LDK_DecodeError_unknown_version() {
40961         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40962         *ret_copy = DecodeError_unknown_version();
40963         int64_t ret_ref = tag_ptr(ret_copy, true);
40964         return ret_ref;
40965 }
40966
40967 int64_t  CS_LDK_DecodeError_unknown_required_feature() {
40968         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40969         *ret_copy = DecodeError_unknown_required_feature();
40970         int64_t ret_ref = tag_ptr(ret_copy, true);
40971         return ret_ref;
40972 }
40973
40974 int64_t  CS_LDK_DecodeError_invalid_value() {
40975         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40976         *ret_copy = DecodeError_invalid_value();
40977         int64_t ret_ref = tag_ptr(ret_copy, true);
40978         return ret_ref;
40979 }
40980
40981 int64_t  CS_LDK_DecodeError_short_read() {
40982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40983         *ret_copy = DecodeError_short_read();
40984         int64_t ret_ref = tag_ptr(ret_copy, true);
40985         return ret_ref;
40986 }
40987
40988 int64_t  CS_LDK_DecodeError_bad_length_descriptor() {
40989         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40990         *ret_copy = DecodeError_bad_length_descriptor();
40991         int64_t ret_ref = tag_ptr(ret_copy, true);
40992         return ret_ref;
40993 }
40994
40995 int64_t  CS_LDK_DecodeError_io(int32_t a) {
40996         LDKIOError a_conv = LDKIOError_from_cs(a);
40997         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40998         *ret_copy = DecodeError_io(a_conv);
40999         int64_t ret_ref = tag_ptr(ret_copy, true);
41000         return ret_ref;
41001 }
41002
41003 int64_t  CS_LDK_DecodeError_unsupported_compression() {
41004         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41005         *ret_copy = DecodeError_unsupported_compression();
41006         int64_t ret_ref = tag_ptr(ret_copy, true);
41007         return ret_ref;
41008 }
41009
41010 int64_t  CS_LDK_DecodeError_hash(int64_t o) {
41011         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
41012         int64_t ret_conv = DecodeError_hash(o_conv);
41013         return ret_conv;
41014 }
41015
41016 jboolean  CS_LDK_DecodeError_eq(int64_t a, int64_t b) {
41017         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
41018         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
41019         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
41020         return ret_conv;
41021 }
41022
41023 void  CS_LDK_Init_free(int64_t this_obj) {
41024         LDKInit this_obj_conv;
41025         this_obj_conv.inner = untag_ptr(this_obj);
41026         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41028         Init_free(this_obj_conv);
41029 }
41030
41031 int64_t  CS_LDK_Init_get_features(int64_t this_ptr) {
41032         LDKInit this_ptr_conv;
41033         this_ptr_conv.inner = untag_ptr(this_ptr);
41034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41036         this_ptr_conv.is_owned = false;
41037         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
41038         int64_t ret_ref = 0;
41039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41041         return ret_ref;
41042 }
41043
41044 void  CS_LDK_Init_set_features(int64_t this_ptr, int64_t val) {
41045         LDKInit this_ptr_conv;
41046         this_ptr_conv.inner = untag_ptr(this_ptr);
41047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41049         this_ptr_conv.is_owned = false;
41050         LDKInitFeatures val_conv;
41051         val_conv.inner = untag_ptr(val);
41052         val_conv.is_owned = ptr_is_owned(val);
41053         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41054         val_conv = InitFeatures_clone(&val_conv);
41055         Init_set_features(&this_ptr_conv, val_conv);
41056 }
41057
41058 int64_t  CS_LDK_Init_get_networks(int64_t this_ptr) {
41059         LDKInit this_ptr_conv;
41060         this_ptr_conv.inner = untag_ptr(this_ptr);
41061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41063         this_ptr_conv.is_owned = false;
41064         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
41065         *ret_copy = Init_get_networks(&this_ptr_conv);
41066         int64_t ret_ref = tag_ptr(ret_copy, true);
41067         return ret_ref;
41068 }
41069
41070 void  CS_LDK_Init_set_networks(int64_t this_ptr, int64_t val) {
41071         LDKInit this_ptr_conv;
41072         this_ptr_conv.inner = untag_ptr(this_ptr);
41073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41075         this_ptr_conv.is_owned = false;
41076         void* val_ptr = untag_ptr(val);
41077         CHECK_ACCESS(val_ptr);
41078         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
41079         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
41080         Init_set_networks(&this_ptr_conv, val_conv);
41081 }
41082
41083 int64_t  CS_LDK_Init_get_remote_network_address(int64_t this_ptr) {
41084         LDKInit this_ptr_conv;
41085         this_ptr_conv.inner = untag_ptr(this_ptr);
41086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41088         this_ptr_conv.is_owned = false;
41089         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
41090         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
41091         int64_t ret_ref = tag_ptr(ret_copy, true);
41092         return ret_ref;
41093 }
41094
41095 void  CS_LDK_Init_set_remote_network_address(int64_t this_ptr, int64_t val) {
41096         LDKInit this_ptr_conv;
41097         this_ptr_conv.inner = untag_ptr(this_ptr);
41098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41100         this_ptr_conv.is_owned = false;
41101         void* val_ptr = untag_ptr(val);
41102         CHECK_ACCESS(val_ptr);
41103         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
41104         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
41105         Init_set_remote_network_address(&this_ptr_conv, val_conv);
41106 }
41107
41108 int64_t  CS_LDK_Init_new(int64_t features_arg, int64_t networks_arg, int64_t remote_network_address_arg) {
41109         LDKInitFeatures features_arg_conv;
41110         features_arg_conv.inner = untag_ptr(features_arg);
41111         features_arg_conv.is_owned = ptr_is_owned(features_arg);
41112         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41113         features_arg_conv = InitFeatures_clone(&features_arg_conv);
41114         void* networks_arg_ptr = untag_ptr(networks_arg);
41115         CHECK_ACCESS(networks_arg_ptr);
41116         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
41117         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
41118         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
41119         CHECK_ACCESS(remote_network_address_arg_ptr);
41120         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
41121         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
41122         int64_t ret_ref = 0;
41123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41125         return ret_ref;
41126 }
41127
41128 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
41129         LDKInit ret_var = Init_clone(arg);
41130         int64_t ret_ref = 0;
41131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41133         return ret_ref;
41134 }
41135 int64_t  CS_LDK_Init_clone_ptr(int64_t arg) {
41136         LDKInit arg_conv;
41137         arg_conv.inner = untag_ptr(arg);
41138         arg_conv.is_owned = ptr_is_owned(arg);
41139         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41140         arg_conv.is_owned = false;
41141         int64_t ret_conv = Init_clone_ptr(&arg_conv);
41142         return ret_conv;
41143 }
41144
41145 int64_t  CS_LDK_Init_clone(int64_t orig) {
41146         LDKInit orig_conv;
41147         orig_conv.inner = untag_ptr(orig);
41148         orig_conv.is_owned = ptr_is_owned(orig);
41149         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41150         orig_conv.is_owned = false;
41151         LDKInit ret_var = Init_clone(&orig_conv);
41152         int64_t ret_ref = 0;
41153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41155         return ret_ref;
41156 }
41157
41158 int64_t  CS_LDK_Init_hash(int64_t o) {
41159         LDKInit o_conv;
41160         o_conv.inner = untag_ptr(o);
41161         o_conv.is_owned = ptr_is_owned(o);
41162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41163         o_conv.is_owned = false;
41164         int64_t ret_conv = Init_hash(&o_conv);
41165         return ret_conv;
41166 }
41167
41168 jboolean  CS_LDK_Init_eq(int64_t a, int64_t b) {
41169         LDKInit a_conv;
41170         a_conv.inner = untag_ptr(a);
41171         a_conv.is_owned = ptr_is_owned(a);
41172         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41173         a_conv.is_owned = false;
41174         LDKInit b_conv;
41175         b_conv.inner = untag_ptr(b);
41176         b_conv.is_owned = ptr_is_owned(b);
41177         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41178         b_conv.is_owned = false;
41179         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
41180         return ret_conv;
41181 }
41182
41183 void  CS_LDK_ErrorMessage_free(int64_t this_obj) {
41184         LDKErrorMessage this_obj_conv;
41185         this_obj_conv.inner = untag_ptr(this_obj);
41186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41188         ErrorMessage_free(this_obj_conv);
41189 }
41190
41191 int8_tArray  CS_LDK_ErrorMessage_get_channel_id(int64_t this_ptr) {
41192         LDKErrorMessage this_ptr_conv;
41193         this_ptr_conv.inner = untag_ptr(this_ptr);
41194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41196         this_ptr_conv.is_owned = false;
41197         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41198         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
41199         return ret_arr;
41200 }
41201
41202 void  CS_LDK_ErrorMessage_set_channel_id(int64_t this_ptr, int8_tArray val) {
41203         LDKErrorMessage this_ptr_conv;
41204         this_ptr_conv.inner = untag_ptr(this_ptr);
41205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41207         this_ptr_conv.is_owned = false;
41208         LDKThirtyTwoBytes val_ref;
41209         CHECK(val->arr_len == 32);
41210         memcpy(val_ref.data, val->elems, 32); FREE(val);
41211         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
41212 }
41213
41214 jstring  CS_LDK_ErrorMessage_get_data(int64_t this_ptr) {
41215         LDKErrorMessage this_ptr_conv;
41216         this_ptr_conv.inner = untag_ptr(this_ptr);
41217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41219         this_ptr_conv.is_owned = false;
41220         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
41221         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
41222         Str_free(ret_str);
41223         return ret_conv;
41224 }
41225
41226 void  CS_LDK_ErrorMessage_set_data(int64_t this_ptr, jstring val) {
41227         LDKErrorMessage this_ptr_conv;
41228         this_ptr_conv.inner = untag_ptr(this_ptr);
41229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41231         this_ptr_conv.is_owned = false;
41232         LDKStr val_conv = str_ref_to_owned_c(val);
41233         ErrorMessage_set_data(&this_ptr_conv, val_conv);
41234 }
41235
41236 int64_t  CS_LDK_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
41237         LDKThirtyTwoBytes channel_id_arg_ref;
41238         CHECK(channel_id_arg->arr_len == 32);
41239         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41240         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
41241         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
41242         int64_t ret_ref = 0;
41243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41245         return ret_ref;
41246 }
41247
41248 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
41249         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
41250         int64_t ret_ref = 0;
41251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41253         return ret_ref;
41254 }
41255 int64_t  CS_LDK_ErrorMessage_clone_ptr(int64_t arg) {
41256         LDKErrorMessage arg_conv;
41257         arg_conv.inner = untag_ptr(arg);
41258         arg_conv.is_owned = ptr_is_owned(arg);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41260         arg_conv.is_owned = false;
41261         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
41262         return ret_conv;
41263 }
41264
41265 int64_t  CS_LDK_ErrorMessage_clone(int64_t orig) {
41266         LDKErrorMessage orig_conv;
41267         orig_conv.inner = untag_ptr(orig);
41268         orig_conv.is_owned = ptr_is_owned(orig);
41269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41270         orig_conv.is_owned = false;
41271         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
41272         int64_t ret_ref = 0;
41273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41275         return ret_ref;
41276 }
41277
41278 int64_t  CS_LDK_ErrorMessage_hash(int64_t o) {
41279         LDKErrorMessage o_conv;
41280         o_conv.inner = untag_ptr(o);
41281         o_conv.is_owned = ptr_is_owned(o);
41282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41283         o_conv.is_owned = false;
41284         int64_t ret_conv = ErrorMessage_hash(&o_conv);
41285         return ret_conv;
41286 }
41287
41288 jboolean  CS_LDK_ErrorMessage_eq(int64_t a, int64_t b) {
41289         LDKErrorMessage a_conv;
41290         a_conv.inner = untag_ptr(a);
41291         a_conv.is_owned = ptr_is_owned(a);
41292         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41293         a_conv.is_owned = false;
41294         LDKErrorMessage b_conv;
41295         b_conv.inner = untag_ptr(b);
41296         b_conv.is_owned = ptr_is_owned(b);
41297         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41298         b_conv.is_owned = false;
41299         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
41300         return ret_conv;
41301 }
41302
41303 void  CS_LDK_WarningMessage_free(int64_t this_obj) {
41304         LDKWarningMessage this_obj_conv;
41305         this_obj_conv.inner = untag_ptr(this_obj);
41306         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41308         WarningMessage_free(this_obj_conv);
41309 }
41310
41311 int8_tArray  CS_LDK_WarningMessage_get_channel_id(int64_t this_ptr) {
41312         LDKWarningMessage this_ptr_conv;
41313         this_ptr_conv.inner = untag_ptr(this_ptr);
41314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41316         this_ptr_conv.is_owned = false;
41317         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41318         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
41319         return ret_arr;
41320 }
41321
41322 void  CS_LDK_WarningMessage_set_channel_id(int64_t this_ptr, int8_tArray val) {
41323         LDKWarningMessage this_ptr_conv;
41324         this_ptr_conv.inner = untag_ptr(this_ptr);
41325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41327         this_ptr_conv.is_owned = false;
41328         LDKThirtyTwoBytes val_ref;
41329         CHECK(val->arr_len == 32);
41330         memcpy(val_ref.data, val->elems, 32); FREE(val);
41331         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
41332 }
41333
41334 jstring  CS_LDK_WarningMessage_get_data(int64_t this_ptr) {
41335         LDKWarningMessage this_ptr_conv;
41336         this_ptr_conv.inner = untag_ptr(this_ptr);
41337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41339         this_ptr_conv.is_owned = false;
41340         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
41341         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
41342         Str_free(ret_str);
41343         return ret_conv;
41344 }
41345
41346 void  CS_LDK_WarningMessage_set_data(int64_t this_ptr, jstring val) {
41347         LDKWarningMessage this_ptr_conv;
41348         this_ptr_conv.inner = untag_ptr(this_ptr);
41349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41351         this_ptr_conv.is_owned = false;
41352         LDKStr val_conv = str_ref_to_owned_c(val);
41353         WarningMessage_set_data(&this_ptr_conv, val_conv);
41354 }
41355
41356 int64_t  CS_LDK_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
41357         LDKThirtyTwoBytes channel_id_arg_ref;
41358         CHECK(channel_id_arg->arr_len == 32);
41359         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41360         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
41361         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
41362         int64_t ret_ref = 0;
41363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41365         return ret_ref;
41366 }
41367
41368 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
41369         LDKWarningMessage ret_var = WarningMessage_clone(arg);
41370         int64_t ret_ref = 0;
41371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41373         return ret_ref;
41374 }
41375 int64_t  CS_LDK_WarningMessage_clone_ptr(int64_t arg) {
41376         LDKWarningMessage arg_conv;
41377         arg_conv.inner = untag_ptr(arg);
41378         arg_conv.is_owned = ptr_is_owned(arg);
41379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41380         arg_conv.is_owned = false;
41381         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
41382         return ret_conv;
41383 }
41384
41385 int64_t  CS_LDK_WarningMessage_clone(int64_t orig) {
41386         LDKWarningMessage orig_conv;
41387         orig_conv.inner = untag_ptr(orig);
41388         orig_conv.is_owned = ptr_is_owned(orig);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41390         orig_conv.is_owned = false;
41391         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
41392         int64_t ret_ref = 0;
41393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41395         return ret_ref;
41396 }
41397
41398 int64_t  CS_LDK_WarningMessage_hash(int64_t o) {
41399         LDKWarningMessage o_conv;
41400         o_conv.inner = untag_ptr(o);
41401         o_conv.is_owned = ptr_is_owned(o);
41402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41403         o_conv.is_owned = false;
41404         int64_t ret_conv = WarningMessage_hash(&o_conv);
41405         return ret_conv;
41406 }
41407
41408 jboolean  CS_LDK_WarningMessage_eq(int64_t a, int64_t b) {
41409         LDKWarningMessage a_conv;
41410         a_conv.inner = untag_ptr(a);
41411         a_conv.is_owned = ptr_is_owned(a);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41413         a_conv.is_owned = false;
41414         LDKWarningMessage b_conv;
41415         b_conv.inner = untag_ptr(b);
41416         b_conv.is_owned = ptr_is_owned(b);
41417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41418         b_conv.is_owned = false;
41419         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
41420         return ret_conv;
41421 }
41422
41423 void  CS_LDK_Ping_free(int64_t this_obj) {
41424         LDKPing this_obj_conv;
41425         this_obj_conv.inner = untag_ptr(this_obj);
41426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41428         Ping_free(this_obj_conv);
41429 }
41430
41431 int16_t  CS_LDK_Ping_get_ponglen(int64_t this_ptr) {
41432         LDKPing this_ptr_conv;
41433         this_ptr_conv.inner = untag_ptr(this_ptr);
41434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41436         this_ptr_conv.is_owned = false;
41437         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
41438         return ret_conv;
41439 }
41440
41441 void  CS_LDK_Ping_set_ponglen(int64_t this_ptr, int16_t val) {
41442         LDKPing this_ptr_conv;
41443         this_ptr_conv.inner = untag_ptr(this_ptr);
41444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41446         this_ptr_conv.is_owned = false;
41447         Ping_set_ponglen(&this_ptr_conv, val);
41448 }
41449
41450 int16_t  CS_LDK_Ping_get_byteslen(int64_t this_ptr) {
41451         LDKPing this_ptr_conv;
41452         this_ptr_conv.inner = untag_ptr(this_ptr);
41453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41455         this_ptr_conv.is_owned = false;
41456         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
41457         return ret_conv;
41458 }
41459
41460 void  CS_LDK_Ping_set_byteslen(int64_t this_ptr, int16_t val) {
41461         LDKPing this_ptr_conv;
41462         this_ptr_conv.inner = untag_ptr(this_ptr);
41463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41465         this_ptr_conv.is_owned = false;
41466         Ping_set_byteslen(&this_ptr_conv, val);
41467 }
41468
41469 int64_t  CS_LDK_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
41470         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
41471         int64_t ret_ref = 0;
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41474         return ret_ref;
41475 }
41476
41477 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
41478         LDKPing ret_var = Ping_clone(arg);
41479         int64_t ret_ref = 0;
41480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41482         return ret_ref;
41483 }
41484 int64_t  CS_LDK_Ping_clone_ptr(int64_t arg) {
41485         LDKPing arg_conv;
41486         arg_conv.inner = untag_ptr(arg);
41487         arg_conv.is_owned = ptr_is_owned(arg);
41488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41489         arg_conv.is_owned = false;
41490         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
41491         return ret_conv;
41492 }
41493
41494 int64_t  CS_LDK_Ping_clone(int64_t orig) {
41495         LDKPing orig_conv;
41496         orig_conv.inner = untag_ptr(orig);
41497         orig_conv.is_owned = ptr_is_owned(orig);
41498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41499         orig_conv.is_owned = false;
41500         LDKPing ret_var = Ping_clone(&orig_conv);
41501         int64_t ret_ref = 0;
41502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41504         return ret_ref;
41505 }
41506
41507 int64_t  CS_LDK_Ping_hash(int64_t o) {
41508         LDKPing o_conv;
41509         o_conv.inner = untag_ptr(o);
41510         o_conv.is_owned = ptr_is_owned(o);
41511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41512         o_conv.is_owned = false;
41513         int64_t ret_conv = Ping_hash(&o_conv);
41514         return ret_conv;
41515 }
41516
41517 jboolean  CS_LDK_Ping_eq(int64_t a, int64_t b) {
41518         LDKPing a_conv;
41519         a_conv.inner = untag_ptr(a);
41520         a_conv.is_owned = ptr_is_owned(a);
41521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41522         a_conv.is_owned = false;
41523         LDKPing b_conv;
41524         b_conv.inner = untag_ptr(b);
41525         b_conv.is_owned = ptr_is_owned(b);
41526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41527         b_conv.is_owned = false;
41528         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
41529         return ret_conv;
41530 }
41531
41532 void  CS_LDK_Pong_free(int64_t this_obj) {
41533         LDKPong this_obj_conv;
41534         this_obj_conv.inner = untag_ptr(this_obj);
41535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41537         Pong_free(this_obj_conv);
41538 }
41539
41540 int16_t  CS_LDK_Pong_get_byteslen(int64_t this_ptr) {
41541         LDKPong this_ptr_conv;
41542         this_ptr_conv.inner = untag_ptr(this_ptr);
41543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41545         this_ptr_conv.is_owned = false;
41546         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
41547         return ret_conv;
41548 }
41549
41550 void  CS_LDK_Pong_set_byteslen(int64_t this_ptr, int16_t val) {
41551         LDKPong this_ptr_conv;
41552         this_ptr_conv.inner = untag_ptr(this_ptr);
41553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41555         this_ptr_conv.is_owned = false;
41556         Pong_set_byteslen(&this_ptr_conv, val);
41557 }
41558
41559 int64_t  CS_LDK_Pong_new(int16_t byteslen_arg) {
41560         LDKPong ret_var = Pong_new(byteslen_arg);
41561         int64_t ret_ref = 0;
41562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41564         return ret_ref;
41565 }
41566
41567 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
41568         LDKPong ret_var = Pong_clone(arg);
41569         int64_t ret_ref = 0;
41570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41572         return ret_ref;
41573 }
41574 int64_t  CS_LDK_Pong_clone_ptr(int64_t arg) {
41575         LDKPong arg_conv;
41576         arg_conv.inner = untag_ptr(arg);
41577         arg_conv.is_owned = ptr_is_owned(arg);
41578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41579         arg_conv.is_owned = false;
41580         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
41581         return ret_conv;
41582 }
41583
41584 int64_t  CS_LDK_Pong_clone(int64_t orig) {
41585         LDKPong orig_conv;
41586         orig_conv.inner = untag_ptr(orig);
41587         orig_conv.is_owned = ptr_is_owned(orig);
41588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41589         orig_conv.is_owned = false;
41590         LDKPong ret_var = Pong_clone(&orig_conv);
41591         int64_t ret_ref = 0;
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41594         return ret_ref;
41595 }
41596
41597 int64_t  CS_LDK_Pong_hash(int64_t o) {
41598         LDKPong o_conv;
41599         o_conv.inner = untag_ptr(o);
41600         o_conv.is_owned = ptr_is_owned(o);
41601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41602         o_conv.is_owned = false;
41603         int64_t ret_conv = Pong_hash(&o_conv);
41604         return ret_conv;
41605 }
41606
41607 jboolean  CS_LDK_Pong_eq(int64_t a, int64_t b) {
41608         LDKPong a_conv;
41609         a_conv.inner = untag_ptr(a);
41610         a_conv.is_owned = ptr_is_owned(a);
41611         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41612         a_conv.is_owned = false;
41613         LDKPong b_conv;
41614         b_conv.inner = untag_ptr(b);
41615         b_conv.is_owned = ptr_is_owned(b);
41616         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41617         b_conv.is_owned = false;
41618         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
41619         return ret_conv;
41620 }
41621
41622 void  CS_LDK_OpenChannel_free(int64_t this_obj) {
41623         LDKOpenChannel 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         OpenChannel_free(this_obj_conv);
41628 }
41629
41630 int8_tArray  CS_LDK_OpenChannel_get_chain_hash(int64_t this_ptr) {
41631         LDKOpenChannel this_ptr_conv;
41632         this_ptr_conv.inner = untag_ptr(this_ptr);
41633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41635         this_ptr_conv.is_owned = false;
41636         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41637         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
41638         return ret_arr;
41639 }
41640
41641 void  CS_LDK_OpenChannel_set_chain_hash(int64_t this_ptr, int8_tArray val) {
41642         LDKOpenChannel this_ptr_conv;
41643         this_ptr_conv.inner = untag_ptr(this_ptr);
41644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41646         this_ptr_conv.is_owned = false;
41647         LDKThirtyTwoBytes val_ref;
41648         CHECK(val->arr_len == 32);
41649         memcpy(val_ref.data, val->elems, 32); FREE(val);
41650         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
41651 }
41652
41653 int8_tArray  CS_LDK_OpenChannel_get_temporary_channel_id(int64_t this_ptr) {
41654         LDKOpenChannel this_ptr_conv;
41655         this_ptr_conv.inner = untag_ptr(this_ptr);
41656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41658         this_ptr_conv.is_owned = false;
41659         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41660         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
41661         return ret_arr;
41662 }
41663
41664 void  CS_LDK_OpenChannel_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
41665         LDKOpenChannel this_ptr_conv;
41666         this_ptr_conv.inner = untag_ptr(this_ptr);
41667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41669         this_ptr_conv.is_owned = false;
41670         LDKThirtyTwoBytes val_ref;
41671         CHECK(val->arr_len == 32);
41672         memcpy(val_ref.data, val->elems, 32); FREE(val);
41673         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
41674 }
41675
41676 int64_t  CS_LDK_OpenChannel_get_funding_satoshis(int64_t this_ptr) {
41677         LDKOpenChannel this_ptr_conv;
41678         this_ptr_conv.inner = untag_ptr(this_ptr);
41679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41681         this_ptr_conv.is_owned = false;
41682         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
41683         return ret_conv;
41684 }
41685
41686 void  CS_LDK_OpenChannel_set_funding_satoshis(int64_t this_ptr, int64_t val) {
41687         LDKOpenChannel this_ptr_conv;
41688         this_ptr_conv.inner = untag_ptr(this_ptr);
41689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41691         this_ptr_conv.is_owned = false;
41692         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
41693 }
41694
41695 int64_t  CS_LDK_OpenChannel_get_push_msat(int64_t this_ptr) {
41696         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
41702         return ret_conv;
41703 }
41704
41705 void  CS_LDK_OpenChannel_set_push_msat(int64_t this_ptr, int64_t val) {
41706         LDKOpenChannel this_ptr_conv;
41707         this_ptr_conv.inner = untag_ptr(this_ptr);
41708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41710         this_ptr_conv.is_owned = false;
41711         OpenChannel_set_push_msat(&this_ptr_conv, val);
41712 }
41713
41714 int64_t  CS_LDK_OpenChannel_get_dust_limit_satoshis(int64_t this_ptr) {
41715         LDKOpenChannel this_ptr_conv;
41716         this_ptr_conv.inner = untag_ptr(this_ptr);
41717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41719         this_ptr_conv.is_owned = false;
41720         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
41721         return ret_conv;
41722 }
41723
41724 void  CS_LDK_OpenChannel_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
41725         LDKOpenChannel this_ptr_conv;
41726         this_ptr_conv.inner = untag_ptr(this_ptr);
41727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41729         this_ptr_conv.is_owned = false;
41730         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
41731 }
41732
41733 int64_t  CS_LDK_OpenChannel_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
41734         LDKOpenChannel 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         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41740         return ret_conv;
41741 }
41742
41743 void  CS_LDK_OpenChannel_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
41744         LDKOpenChannel this_ptr_conv;
41745         this_ptr_conv.inner = untag_ptr(this_ptr);
41746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41748         this_ptr_conv.is_owned = false;
41749         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41750 }
41751
41752 int64_t  CS_LDK_OpenChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
41753         LDKOpenChannel this_ptr_conv;
41754         this_ptr_conv.inner = untag_ptr(this_ptr);
41755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41757         this_ptr_conv.is_owned = false;
41758         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
41759         return ret_conv;
41760 }
41761
41762 void  CS_LDK_OpenChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
41763         LDKOpenChannel this_ptr_conv;
41764         this_ptr_conv.inner = untag_ptr(this_ptr);
41765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41767         this_ptr_conv.is_owned = false;
41768         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
41769 }
41770
41771 int64_t  CS_LDK_OpenChannel_get_htlc_minimum_msat(int64_t this_ptr) {
41772         LDKOpenChannel this_ptr_conv;
41773         this_ptr_conv.inner = untag_ptr(this_ptr);
41774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41776         this_ptr_conv.is_owned = false;
41777         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
41778         return ret_conv;
41779 }
41780
41781 void  CS_LDK_OpenChannel_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
41782         LDKOpenChannel this_ptr_conv;
41783         this_ptr_conv.inner = untag_ptr(this_ptr);
41784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41786         this_ptr_conv.is_owned = false;
41787         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
41788 }
41789
41790 int32_t  CS_LDK_OpenChannel_get_feerate_per_kw(int64_t this_ptr) {
41791         LDKOpenChannel this_ptr_conv;
41792         this_ptr_conv.inner = untag_ptr(this_ptr);
41793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41795         this_ptr_conv.is_owned = false;
41796         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
41797         return ret_conv;
41798 }
41799
41800 void  CS_LDK_OpenChannel_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
41801         LDKOpenChannel this_ptr_conv;
41802         this_ptr_conv.inner = untag_ptr(this_ptr);
41803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41805         this_ptr_conv.is_owned = false;
41806         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
41807 }
41808
41809 int16_t  CS_LDK_OpenChannel_get_to_self_delay(int64_t this_ptr) {
41810         LDKOpenChannel this_ptr_conv;
41811         this_ptr_conv.inner = untag_ptr(this_ptr);
41812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41814         this_ptr_conv.is_owned = false;
41815         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
41816         return ret_conv;
41817 }
41818
41819 void  CS_LDK_OpenChannel_set_to_self_delay(int64_t this_ptr, int16_t val) {
41820         LDKOpenChannel this_ptr_conv;
41821         this_ptr_conv.inner = untag_ptr(this_ptr);
41822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41824         this_ptr_conv.is_owned = false;
41825         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
41826 }
41827
41828 int16_t  CS_LDK_OpenChannel_get_max_accepted_htlcs(int64_t this_ptr) {
41829         LDKOpenChannel this_ptr_conv;
41830         this_ptr_conv.inner = untag_ptr(this_ptr);
41831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41833         this_ptr_conv.is_owned = false;
41834         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
41835         return ret_conv;
41836 }
41837
41838 void  CS_LDK_OpenChannel_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
41839         LDKOpenChannel this_ptr_conv;
41840         this_ptr_conv.inner = untag_ptr(this_ptr);
41841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41843         this_ptr_conv.is_owned = false;
41844         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
41845 }
41846
41847 int8_tArray  CS_LDK_OpenChannel_get_funding_pubkey(int64_t this_ptr) {
41848         LDKOpenChannel this_ptr_conv;
41849         this_ptr_conv.inner = untag_ptr(this_ptr);
41850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41852         this_ptr_conv.is_owned = false;
41853         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41854         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
41855         return ret_arr;
41856 }
41857
41858 void  CS_LDK_OpenChannel_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
41859         LDKOpenChannel this_ptr_conv;
41860         this_ptr_conv.inner = untag_ptr(this_ptr);
41861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41863         this_ptr_conv.is_owned = false;
41864         LDKPublicKey val_ref;
41865         CHECK(val->arr_len == 33);
41866         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41867         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
41868 }
41869
41870 int8_tArray  CS_LDK_OpenChannel_get_revocation_basepoint(int64_t this_ptr) {
41871         LDKOpenChannel this_ptr_conv;
41872         this_ptr_conv.inner = untag_ptr(this_ptr);
41873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41875         this_ptr_conv.is_owned = false;
41876         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41877         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
41878         return ret_arr;
41879 }
41880
41881 void  CS_LDK_OpenChannel_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
41882         LDKOpenChannel this_ptr_conv;
41883         this_ptr_conv.inner = untag_ptr(this_ptr);
41884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41886         this_ptr_conv.is_owned = false;
41887         LDKPublicKey val_ref;
41888         CHECK(val->arr_len == 33);
41889         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41890         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
41891 }
41892
41893 int8_tArray  CS_LDK_OpenChannel_get_payment_point(int64_t this_ptr) {
41894         LDKOpenChannel this_ptr_conv;
41895         this_ptr_conv.inner = untag_ptr(this_ptr);
41896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41898         this_ptr_conv.is_owned = false;
41899         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41900         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
41901         return ret_arr;
41902 }
41903
41904 void  CS_LDK_OpenChannel_set_payment_point(int64_t this_ptr, int8_tArray val) {
41905         LDKOpenChannel this_ptr_conv;
41906         this_ptr_conv.inner = untag_ptr(this_ptr);
41907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41909         this_ptr_conv.is_owned = false;
41910         LDKPublicKey val_ref;
41911         CHECK(val->arr_len == 33);
41912         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41913         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
41914 }
41915
41916 int8_tArray  CS_LDK_OpenChannel_get_delayed_payment_basepoint(int64_t this_ptr) {
41917         LDKOpenChannel this_ptr_conv;
41918         this_ptr_conv.inner = untag_ptr(this_ptr);
41919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41921         this_ptr_conv.is_owned = false;
41922         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41923         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
41924         return ret_arr;
41925 }
41926
41927 void  CS_LDK_OpenChannel_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
41928         LDKOpenChannel this_ptr_conv;
41929         this_ptr_conv.inner = untag_ptr(this_ptr);
41930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41932         this_ptr_conv.is_owned = false;
41933         LDKPublicKey val_ref;
41934         CHECK(val->arr_len == 33);
41935         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41936         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41937 }
41938
41939 int8_tArray  CS_LDK_OpenChannel_get_htlc_basepoint(int64_t this_ptr) {
41940         LDKOpenChannel this_ptr_conv;
41941         this_ptr_conv.inner = untag_ptr(this_ptr);
41942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41944         this_ptr_conv.is_owned = false;
41945         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41946         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
41947         return ret_arr;
41948 }
41949
41950 void  CS_LDK_OpenChannel_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
41951         LDKOpenChannel this_ptr_conv;
41952         this_ptr_conv.inner = untag_ptr(this_ptr);
41953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41955         this_ptr_conv.is_owned = false;
41956         LDKPublicKey val_ref;
41957         CHECK(val->arr_len == 33);
41958         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41959         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
41960 }
41961
41962 int8_tArray  CS_LDK_OpenChannel_get_first_per_commitment_point(int64_t this_ptr) {
41963         LDKOpenChannel this_ptr_conv;
41964         this_ptr_conv.inner = untag_ptr(this_ptr);
41965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41967         this_ptr_conv.is_owned = false;
41968         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41969         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41970         return ret_arr;
41971 }
41972
41973 void  CS_LDK_OpenChannel_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
41974         LDKOpenChannel this_ptr_conv;
41975         this_ptr_conv.inner = untag_ptr(this_ptr);
41976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41978         this_ptr_conv.is_owned = false;
41979         LDKPublicKey val_ref;
41980         CHECK(val->arr_len == 33);
41981         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41982         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41983 }
41984
41985 int8_t  CS_LDK_OpenChannel_get_channel_flags(int64_t this_ptr) {
41986         LDKOpenChannel this_ptr_conv;
41987         this_ptr_conv.inner = untag_ptr(this_ptr);
41988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41990         this_ptr_conv.is_owned = false;
41991         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
41992         return ret_conv;
41993 }
41994
41995 void  CS_LDK_OpenChannel_set_channel_flags(int64_t this_ptr, int8_t val) {
41996         LDKOpenChannel this_ptr_conv;
41997         this_ptr_conv.inner = untag_ptr(this_ptr);
41998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42000         this_ptr_conv.is_owned = false;
42001         OpenChannel_set_channel_flags(&this_ptr_conv, val);
42002 }
42003
42004 int64_t  CS_LDK_OpenChannel_get_shutdown_scriptpubkey(int64_t this_ptr) {
42005         LDKOpenChannel this_ptr_conv;
42006         this_ptr_conv.inner = untag_ptr(this_ptr);
42007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42009         this_ptr_conv.is_owned = false;
42010         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42011         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
42012         int64_t ret_ref = tag_ptr(ret_copy, true);
42013         return ret_ref;
42014 }
42015
42016 void  CS_LDK_OpenChannel_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
42017         LDKOpenChannel this_ptr_conv;
42018         this_ptr_conv.inner = untag_ptr(this_ptr);
42019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42021         this_ptr_conv.is_owned = false;
42022         void* val_ptr = untag_ptr(val);
42023         CHECK_ACCESS(val_ptr);
42024         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42025         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42026         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42027 }
42028
42029 int64_t  CS_LDK_OpenChannel_get_channel_type(int64_t this_ptr) {
42030         LDKOpenChannel this_ptr_conv;
42031         this_ptr_conv.inner = untag_ptr(this_ptr);
42032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42034         this_ptr_conv.is_owned = false;
42035         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
42036         int64_t ret_ref = 0;
42037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42039         return ret_ref;
42040 }
42041
42042 void  CS_LDK_OpenChannel_set_channel_type(int64_t this_ptr, int64_t val) {
42043         LDKOpenChannel this_ptr_conv;
42044         this_ptr_conv.inner = untag_ptr(this_ptr);
42045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42047         this_ptr_conv.is_owned = false;
42048         LDKChannelTypeFeatures val_conv;
42049         val_conv.inner = untag_ptr(val);
42050         val_conv.is_owned = ptr_is_owned(val);
42051         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42052         val_conv = ChannelTypeFeatures_clone(&val_conv);
42053         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
42054 }
42055
42056 int64_t  CS_LDK_OpenChannel_new(int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
42057         LDKThirtyTwoBytes chain_hash_arg_ref;
42058         CHECK(chain_hash_arg->arr_len == 32);
42059         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42060         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42061         CHECK(temporary_channel_id_arg->arr_len == 32);
42062         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42063         LDKPublicKey funding_pubkey_arg_ref;
42064         CHECK(funding_pubkey_arg->arr_len == 33);
42065         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42066         LDKPublicKey revocation_basepoint_arg_ref;
42067         CHECK(revocation_basepoint_arg->arr_len == 33);
42068         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42069         LDKPublicKey payment_point_arg_ref;
42070         CHECK(payment_point_arg->arr_len == 33);
42071         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
42072         LDKPublicKey delayed_payment_basepoint_arg_ref;
42073         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42074         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42075         LDKPublicKey htlc_basepoint_arg_ref;
42076         CHECK(htlc_basepoint_arg->arr_len == 33);
42077         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42078         LDKPublicKey first_per_commitment_point_arg_ref;
42079         CHECK(first_per_commitment_point_arg->arr_len == 33);
42080         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42081         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42082         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42083         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42084         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42085         LDKChannelTypeFeatures channel_type_arg_conv;
42086         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42087         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42088         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42089         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42090         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
42091         int64_t ret_ref = 0;
42092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42094         return ret_ref;
42095 }
42096
42097 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
42098         LDKOpenChannel ret_var = OpenChannel_clone(arg);
42099         int64_t ret_ref = 0;
42100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42102         return ret_ref;
42103 }
42104 int64_t  CS_LDK_OpenChannel_clone_ptr(int64_t arg) {
42105         LDKOpenChannel arg_conv;
42106         arg_conv.inner = untag_ptr(arg);
42107         arg_conv.is_owned = ptr_is_owned(arg);
42108         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42109         arg_conv.is_owned = false;
42110         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
42111         return ret_conv;
42112 }
42113
42114 int64_t  CS_LDK_OpenChannel_clone(int64_t orig) {
42115         LDKOpenChannel orig_conv;
42116         orig_conv.inner = untag_ptr(orig);
42117         orig_conv.is_owned = ptr_is_owned(orig);
42118         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42119         orig_conv.is_owned = false;
42120         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
42121         int64_t ret_ref = 0;
42122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42124         return ret_ref;
42125 }
42126
42127 int64_t  CS_LDK_OpenChannel_hash(int64_t o) {
42128         LDKOpenChannel o_conv;
42129         o_conv.inner = untag_ptr(o);
42130         o_conv.is_owned = ptr_is_owned(o);
42131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42132         o_conv.is_owned = false;
42133         int64_t ret_conv = OpenChannel_hash(&o_conv);
42134         return ret_conv;
42135 }
42136
42137 jboolean  CS_LDK_OpenChannel_eq(int64_t a, int64_t b) {
42138         LDKOpenChannel a_conv;
42139         a_conv.inner = untag_ptr(a);
42140         a_conv.is_owned = ptr_is_owned(a);
42141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42142         a_conv.is_owned = false;
42143         LDKOpenChannel b_conv;
42144         b_conv.inner = untag_ptr(b);
42145         b_conv.is_owned = ptr_is_owned(b);
42146         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42147         b_conv.is_owned = false;
42148         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
42149         return ret_conv;
42150 }
42151
42152 void  CS_LDK_OpenChannelV2_free(int64_t this_obj) {
42153         LDKOpenChannelV2 this_obj_conv;
42154         this_obj_conv.inner = untag_ptr(this_obj);
42155         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42157         OpenChannelV2_free(this_obj_conv);
42158 }
42159
42160 int8_tArray  CS_LDK_OpenChannelV2_get_chain_hash(int64_t this_ptr) {
42161         LDKOpenChannelV2 this_ptr_conv;
42162         this_ptr_conv.inner = untag_ptr(this_ptr);
42163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42165         this_ptr_conv.is_owned = false;
42166         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42167         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
42168         return ret_arr;
42169 }
42170
42171 void  CS_LDK_OpenChannelV2_set_chain_hash(int64_t this_ptr, int8_tArray val) {
42172         LDKOpenChannelV2 this_ptr_conv;
42173         this_ptr_conv.inner = untag_ptr(this_ptr);
42174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42176         this_ptr_conv.is_owned = false;
42177         LDKThirtyTwoBytes val_ref;
42178         CHECK(val->arr_len == 32);
42179         memcpy(val_ref.data, val->elems, 32); FREE(val);
42180         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
42181 }
42182
42183 int8_tArray  CS_LDK_OpenChannelV2_get_temporary_channel_id(int64_t this_ptr) {
42184         LDKOpenChannelV2 this_ptr_conv;
42185         this_ptr_conv.inner = untag_ptr(this_ptr);
42186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42188         this_ptr_conv.is_owned = false;
42189         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42190         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
42191         return ret_arr;
42192 }
42193
42194 void  CS_LDK_OpenChannelV2_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
42195         LDKOpenChannelV2 this_ptr_conv;
42196         this_ptr_conv.inner = untag_ptr(this_ptr);
42197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42199         this_ptr_conv.is_owned = false;
42200         LDKThirtyTwoBytes val_ref;
42201         CHECK(val->arr_len == 32);
42202         memcpy(val_ref.data, val->elems, 32); FREE(val);
42203         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
42204 }
42205
42206 int32_t  CS_LDK_OpenChannelV2_get_funding_feerate_sat_per_1000_weight(int64_t this_ptr) {
42207         LDKOpenChannelV2 this_ptr_conv;
42208         this_ptr_conv.inner = untag_ptr(this_ptr);
42209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42211         this_ptr_conv.is_owned = false;
42212         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
42213         return ret_conv;
42214 }
42215
42216 void  CS_LDK_OpenChannelV2_set_funding_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
42217         LDKOpenChannelV2 this_ptr_conv;
42218         this_ptr_conv.inner = untag_ptr(this_ptr);
42219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42221         this_ptr_conv.is_owned = false;
42222         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42223 }
42224
42225 int32_t  CS_LDK_OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(int64_t this_ptr) {
42226         LDKOpenChannelV2 this_ptr_conv;
42227         this_ptr_conv.inner = untag_ptr(this_ptr);
42228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42230         this_ptr_conv.is_owned = false;
42231         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
42232         return ret_conv;
42233 }
42234
42235 void  CS_LDK_OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
42236         LDKOpenChannelV2 this_ptr_conv;
42237         this_ptr_conv.inner = untag_ptr(this_ptr);
42238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42240         this_ptr_conv.is_owned = false;
42241         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42242 }
42243
42244 int64_t  CS_LDK_OpenChannelV2_get_funding_satoshis(int64_t this_ptr) {
42245         LDKOpenChannelV2 this_ptr_conv;
42246         this_ptr_conv.inner = untag_ptr(this_ptr);
42247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42249         this_ptr_conv.is_owned = false;
42250         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
42251         return ret_conv;
42252 }
42253
42254 void  CS_LDK_OpenChannelV2_set_funding_satoshis(int64_t this_ptr, int64_t val) {
42255         LDKOpenChannelV2 this_ptr_conv;
42256         this_ptr_conv.inner = untag_ptr(this_ptr);
42257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42259         this_ptr_conv.is_owned = false;
42260         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
42261 }
42262
42263 int64_t  CS_LDK_OpenChannelV2_get_dust_limit_satoshis(int64_t this_ptr) {
42264         LDKOpenChannelV2 this_ptr_conv;
42265         this_ptr_conv.inner = untag_ptr(this_ptr);
42266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42268         this_ptr_conv.is_owned = false;
42269         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
42270         return ret_conv;
42271 }
42272
42273 void  CS_LDK_OpenChannelV2_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
42274         LDKOpenChannelV2 this_ptr_conv;
42275         this_ptr_conv.inner = untag_ptr(this_ptr);
42276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42278         this_ptr_conv.is_owned = false;
42279         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
42280 }
42281
42282 int64_t  CS_LDK_OpenChannelV2_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
42283         LDKOpenChannelV2 this_ptr_conv;
42284         this_ptr_conv.inner = untag_ptr(this_ptr);
42285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42287         this_ptr_conv.is_owned = false;
42288         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42289         return ret_conv;
42290 }
42291
42292 void  CS_LDK_OpenChannelV2_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
42293         LDKOpenChannelV2 this_ptr_conv;
42294         this_ptr_conv.inner = untag_ptr(this_ptr);
42295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42297         this_ptr_conv.is_owned = false;
42298         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42299 }
42300
42301 int64_t  CS_LDK_OpenChannelV2_get_htlc_minimum_msat(int64_t this_ptr) {
42302         LDKOpenChannelV2 this_ptr_conv;
42303         this_ptr_conv.inner = untag_ptr(this_ptr);
42304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42306         this_ptr_conv.is_owned = false;
42307         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
42308         return ret_conv;
42309 }
42310
42311 void  CS_LDK_OpenChannelV2_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
42312         LDKOpenChannelV2 this_ptr_conv;
42313         this_ptr_conv.inner = untag_ptr(this_ptr);
42314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42316         this_ptr_conv.is_owned = false;
42317         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
42318 }
42319
42320 int16_t  CS_LDK_OpenChannelV2_get_to_self_delay(int64_t this_ptr) {
42321         LDKOpenChannelV2 this_ptr_conv;
42322         this_ptr_conv.inner = untag_ptr(this_ptr);
42323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42325         this_ptr_conv.is_owned = false;
42326         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
42327         return ret_conv;
42328 }
42329
42330 void  CS_LDK_OpenChannelV2_set_to_self_delay(int64_t this_ptr, int16_t val) {
42331         LDKOpenChannelV2 this_ptr_conv;
42332         this_ptr_conv.inner = untag_ptr(this_ptr);
42333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42335         this_ptr_conv.is_owned = false;
42336         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
42337 }
42338
42339 int16_t  CS_LDK_OpenChannelV2_get_max_accepted_htlcs(int64_t this_ptr) {
42340         LDKOpenChannelV2 this_ptr_conv;
42341         this_ptr_conv.inner = untag_ptr(this_ptr);
42342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42344         this_ptr_conv.is_owned = false;
42345         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
42346         return ret_conv;
42347 }
42348
42349 void  CS_LDK_OpenChannelV2_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
42350         LDKOpenChannelV2 this_ptr_conv;
42351         this_ptr_conv.inner = untag_ptr(this_ptr);
42352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42354         this_ptr_conv.is_owned = false;
42355         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
42356 }
42357
42358 int32_t  CS_LDK_OpenChannelV2_get_locktime(int64_t this_ptr) {
42359         LDKOpenChannelV2 this_ptr_conv;
42360         this_ptr_conv.inner = untag_ptr(this_ptr);
42361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42363         this_ptr_conv.is_owned = false;
42364         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
42365         return ret_conv;
42366 }
42367
42368 void  CS_LDK_OpenChannelV2_set_locktime(int64_t this_ptr, int32_t val) {
42369         LDKOpenChannelV2 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         OpenChannelV2_set_locktime(&this_ptr_conv, val);
42375 }
42376
42377 int8_tArray  CS_LDK_OpenChannelV2_get_funding_pubkey(int64_t this_ptr) {
42378         LDKOpenChannelV2 this_ptr_conv;
42379         this_ptr_conv.inner = untag_ptr(this_ptr);
42380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42382         this_ptr_conv.is_owned = false;
42383         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42384         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42385         return ret_arr;
42386 }
42387
42388 void  CS_LDK_OpenChannelV2_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
42389         LDKOpenChannelV2 this_ptr_conv;
42390         this_ptr_conv.inner = untag_ptr(this_ptr);
42391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42393         this_ptr_conv.is_owned = false;
42394         LDKPublicKey val_ref;
42395         CHECK(val->arr_len == 33);
42396         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42397         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
42398 }
42399
42400 int8_tArray  CS_LDK_OpenChannelV2_get_revocation_basepoint(int64_t this_ptr) {
42401         LDKOpenChannelV2 this_ptr_conv;
42402         this_ptr_conv.inner = untag_ptr(this_ptr);
42403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42405         this_ptr_conv.is_owned = false;
42406         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42407         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42408         return ret_arr;
42409 }
42410
42411 void  CS_LDK_OpenChannelV2_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
42412         LDKOpenChannelV2 this_ptr_conv;
42413         this_ptr_conv.inner = untag_ptr(this_ptr);
42414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42416         this_ptr_conv.is_owned = false;
42417         LDKPublicKey val_ref;
42418         CHECK(val->arr_len == 33);
42419         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42420         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
42421 }
42422
42423 int8_tArray  CS_LDK_OpenChannelV2_get_payment_basepoint(int64_t this_ptr) {
42424         LDKOpenChannelV2 this_ptr_conv;
42425         this_ptr_conv.inner = untag_ptr(this_ptr);
42426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42428         this_ptr_conv.is_owned = false;
42429         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42430         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42431         return ret_arr;
42432 }
42433
42434 void  CS_LDK_OpenChannelV2_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
42435         LDKOpenChannelV2 this_ptr_conv;
42436         this_ptr_conv.inner = untag_ptr(this_ptr);
42437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42439         this_ptr_conv.is_owned = false;
42440         LDKPublicKey val_ref;
42441         CHECK(val->arr_len == 33);
42442         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42443         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
42444 }
42445
42446 int8_tArray  CS_LDK_OpenChannelV2_get_delayed_payment_basepoint(int64_t this_ptr) {
42447         LDKOpenChannelV2 this_ptr_conv;
42448         this_ptr_conv.inner = untag_ptr(this_ptr);
42449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42451         this_ptr_conv.is_owned = false;
42452         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42453         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42454         return ret_arr;
42455 }
42456
42457 void  CS_LDK_OpenChannelV2_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
42458         LDKOpenChannelV2 this_ptr_conv;
42459         this_ptr_conv.inner = untag_ptr(this_ptr);
42460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42462         this_ptr_conv.is_owned = false;
42463         LDKPublicKey val_ref;
42464         CHECK(val->arr_len == 33);
42465         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42466         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42467 }
42468
42469 int8_tArray  CS_LDK_OpenChannelV2_get_htlc_basepoint(int64_t this_ptr) {
42470         LDKOpenChannelV2 this_ptr_conv;
42471         this_ptr_conv.inner = untag_ptr(this_ptr);
42472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42474         this_ptr_conv.is_owned = false;
42475         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42476         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42477         return ret_arr;
42478 }
42479
42480 void  CS_LDK_OpenChannelV2_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
42481         LDKOpenChannelV2 this_ptr_conv;
42482         this_ptr_conv.inner = untag_ptr(this_ptr);
42483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42485         this_ptr_conv.is_owned = false;
42486         LDKPublicKey val_ref;
42487         CHECK(val->arr_len == 33);
42488         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42489         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
42490 }
42491
42492 int8_tArray  CS_LDK_OpenChannelV2_get_first_per_commitment_point(int64_t this_ptr) {
42493         LDKOpenChannelV2 this_ptr_conv;
42494         this_ptr_conv.inner = untag_ptr(this_ptr);
42495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42497         this_ptr_conv.is_owned = false;
42498         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42499         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42500         return ret_arr;
42501 }
42502
42503 void  CS_LDK_OpenChannelV2_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
42504         LDKOpenChannelV2 this_ptr_conv;
42505         this_ptr_conv.inner = untag_ptr(this_ptr);
42506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42508         this_ptr_conv.is_owned = false;
42509         LDKPublicKey val_ref;
42510         CHECK(val->arr_len == 33);
42511         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42512         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42513 }
42514
42515 int8_tArray  CS_LDK_OpenChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
42516         LDKOpenChannelV2 this_ptr_conv;
42517         this_ptr_conv.inner = untag_ptr(this_ptr);
42518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42520         this_ptr_conv.is_owned = false;
42521         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42522         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42523         return ret_arr;
42524 }
42525
42526 void  CS_LDK_OpenChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
42527         LDKOpenChannelV2 this_ptr_conv;
42528         this_ptr_conv.inner = untag_ptr(this_ptr);
42529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42531         this_ptr_conv.is_owned = false;
42532         LDKPublicKey val_ref;
42533         CHECK(val->arr_len == 33);
42534         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42535         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
42536 }
42537
42538 int8_t  CS_LDK_OpenChannelV2_get_channel_flags(int64_t this_ptr) {
42539         LDKOpenChannelV2 this_ptr_conv;
42540         this_ptr_conv.inner = untag_ptr(this_ptr);
42541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42543         this_ptr_conv.is_owned = false;
42544         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
42545         return ret_conv;
42546 }
42547
42548 void  CS_LDK_OpenChannelV2_set_channel_flags(int64_t this_ptr, int8_t val) {
42549         LDKOpenChannelV2 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         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
42555 }
42556
42557 int64_t  CS_LDK_OpenChannelV2_get_shutdown_scriptpubkey(int64_t this_ptr) {
42558         LDKOpenChannelV2 this_ptr_conv;
42559         this_ptr_conv.inner = untag_ptr(this_ptr);
42560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42562         this_ptr_conv.is_owned = false;
42563         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42564         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
42565         int64_t ret_ref = tag_ptr(ret_copy, true);
42566         return ret_ref;
42567 }
42568
42569 void  CS_LDK_OpenChannelV2_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
42570         LDKOpenChannelV2 this_ptr_conv;
42571         this_ptr_conv.inner = untag_ptr(this_ptr);
42572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42574         this_ptr_conv.is_owned = false;
42575         void* val_ptr = untag_ptr(val);
42576         CHECK_ACCESS(val_ptr);
42577         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42578         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42579         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42580 }
42581
42582 int64_t  CS_LDK_OpenChannelV2_get_channel_type(int64_t this_ptr) {
42583         LDKOpenChannelV2 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         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
42589         int64_t ret_ref = 0;
42590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42592         return ret_ref;
42593 }
42594
42595 void  CS_LDK_OpenChannelV2_set_channel_type(int64_t this_ptr, int64_t val) {
42596         LDKOpenChannelV2 this_ptr_conv;
42597         this_ptr_conv.inner = untag_ptr(this_ptr);
42598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42600         this_ptr_conv.is_owned = false;
42601         LDKChannelTypeFeatures val_conv;
42602         val_conv.inner = untag_ptr(val);
42603         val_conv.is_owned = ptr_is_owned(val);
42604         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42605         val_conv = ChannelTypeFeatures_clone(&val_conv);
42606         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
42607 }
42608
42609 int32_t  CS_LDK_OpenChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
42610         LDKOpenChannelV2 this_ptr_conv;
42611         this_ptr_conv.inner = untag_ptr(this_ptr);
42612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42614         this_ptr_conv.is_owned = false;
42615         int32_t ret_conv = LDKCOption_NoneZ_to_cs(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
42616         return ret_conv;
42617 }
42618
42619 void  CS_LDK_OpenChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
42620         LDKOpenChannelV2 this_ptr_conv;
42621         this_ptr_conv.inner = untag_ptr(this_ptr);
42622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42624         this_ptr_conv.is_owned = false;
42625         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
42626         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
42627 }
42628
42629 int64_t  CS_LDK_OpenChannelV2_new(int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, int32_t require_confirmed_inputs_arg) {
42630         LDKThirtyTwoBytes chain_hash_arg_ref;
42631         CHECK(chain_hash_arg->arr_len == 32);
42632         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42633         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42634         CHECK(temporary_channel_id_arg->arr_len == 32);
42635         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42636         LDKPublicKey funding_pubkey_arg_ref;
42637         CHECK(funding_pubkey_arg->arr_len == 33);
42638         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42639         LDKPublicKey revocation_basepoint_arg_ref;
42640         CHECK(revocation_basepoint_arg->arr_len == 33);
42641         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42642         LDKPublicKey payment_basepoint_arg_ref;
42643         CHECK(payment_basepoint_arg->arr_len == 33);
42644         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
42645         LDKPublicKey delayed_payment_basepoint_arg_ref;
42646         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42647         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42648         LDKPublicKey htlc_basepoint_arg_ref;
42649         CHECK(htlc_basepoint_arg->arr_len == 33);
42650         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42651         LDKPublicKey first_per_commitment_point_arg_ref;
42652         CHECK(first_per_commitment_point_arg->arr_len == 33);
42653         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42654         LDKPublicKey second_per_commitment_point_arg_ref;
42655         CHECK(second_per_commitment_point_arg->arr_len == 33);
42656         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
42657         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42658         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42659         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42660         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42661         LDKChannelTypeFeatures channel_type_arg_conv;
42662         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42663         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42664         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42665         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42666         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
42667         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
42668         int64_t ret_ref = 0;
42669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42671         return ret_ref;
42672 }
42673
42674 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
42675         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
42676         int64_t ret_ref = 0;
42677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42679         return ret_ref;
42680 }
42681 int64_t  CS_LDK_OpenChannelV2_clone_ptr(int64_t arg) {
42682         LDKOpenChannelV2 arg_conv;
42683         arg_conv.inner = untag_ptr(arg);
42684         arg_conv.is_owned = ptr_is_owned(arg);
42685         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42686         arg_conv.is_owned = false;
42687         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
42688         return ret_conv;
42689 }
42690
42691 int64_t  CS_LDK_OpenChannelV2_clone(int64_t orig) {
42692         LDKOpenChannelV2 orig_conv;
42693         orig_conv.inner = untag_ptr(orig);
42694         orig_conv.is_owned = ptr_is_owned(orig);
42695         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42696         orig_conv.is_owned = false;
42697         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
42698         int64_t ret_ref = 0;
42699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42701         return ret_ref;
42702 }
42703
42704 int64_t  CS_LDK_OpenChannelV2_hash(int64_t o) {
42705         LDKOpenChannelV2 o_conv;
42706         o_conv.inner = untag_ptr(o);
42707         o_conv.is_owned = ptr_is_owned(o);
42708         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42709         o_conv.is_owned = false;
42710         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
42711         return ret_conv;
42712 }
42713
42714 jboolean  CS_LDK_OpenChannelV2_eq(int64_t a, int64_t b) {
42715         LDKOpenChannelV2 a_conv;
42716         a_conv.inner = untag_ptr(a);
42717         a_conv.is_owned = ptr_is_owned(a);
42718         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42719         a_conv.is_owned = false;
42720         LDKOpenChannelV2 b_conv;
42721         b_conv.inner = untag_ptr(b);
42722         b_conv.is_owned = ptr_is_owned(b);
42723         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42724         b_conv.is_owned = false;
42725         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
42726         return ret_conv;
42727 }
42728
42729 void  CS_LDK_AcceptChannel_free(int64_t this_obj) {
42730         LDKAcceptChannel this_obj_conv;
42731         this_obj_conv.inner = untag_ptr(this_obj);
42732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42734         AcceptChannel_free(this_obj_conv);
42735 }
42736
42737 int8_tArray  CS_LDK_AcceptChannel_get_temporary_channel_id(int64_t this_ptr) {
42738         LDKAcceptChannel this_ptr_conv;
42739         this_ptr_conv.inner = untag_ptr(this_ptr);
42740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42742         this_ptr_conv.is_owned = false;
42743         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42744         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
42745         return ret_arr;
42746 }
42747
42748 void  CS_LDK_AcceptChannel_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
42749         LDKAcceptChannel this_ptr_conv;
42750         this_ptr_conv.inner = untag_ptr(this_ptr);
42751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42753         this_ptr_conv.is_owned = false;
42754         LDKThirtyTwoBytes val_ref;
42755         CHECK(val->arr_len == 32);
42756         memcpy(val_ref.data, val->elems, 32); FREE(val);
42757         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42758 }
42759
42760 int64_t  CS_LDK_AcceptChannel_get_dust_limit_satoshis(int64_t this_ptr) {
42761         LDKAcceptChannel this_ptr_conv;
42762         this_ptr_conv.inner = untag_ptr(this_ptr);
42763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42765         this_ptr_conv.is_owned = false;
42766         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
42767         return ret_conv;
42768 }
42769
42770 void  CS_LDK_AcceptChannel_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
42771         LDKAcceptChannel this_ptr_conv;
42772         this_ptr_conv.inner = untag_ptr(this_ptr);
42773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42775         this_ptr_conv.is_owned = false;
42776         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42777 }
42778
42779 int64_t  CS_LDK_AcceptChannel_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
42780         LDKAcceptChannel this_ptr_conv;
42781         this_ptr_conv.inner = untag_ptr(this_ptr);
42782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42784         this_ptr_conv.is_owned = false;
42785         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42786         return ret_conv;
42787 }
42788
42789 void  CS_LDK_AcceptChannel_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
42790         LDKAcceptChannel this_ptr_conv;
42791         this_ptr_conv.inner = untag_ptr(this_ptr);
42792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42794         this_ptr_conv.is_owned = false;
42795         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42796 }
42797
42798 int64_t  CS_LDK_AcceptChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
42799         LDKAcceptChannel this_ptr_conv;
42800         this_ptr_conv.inner = untag_ptr(this_ptr);
42801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42803         this_ptr_conv.is_owned = false;
42804         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
42805         return ret_conv;
42806 }
42807
42808 void  CS_LDK_AcceptChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
42809         LDKAcceptChannel this_ptr_conv;
42810         this_ptr_conv.inner = untag_ptr(this_ptr);
42811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42813         this_ptr_conv.is_owned = false;
42814         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
42815 }
42816
42817 int64_t  CS_LDK_AcceptChannel_get_htlc_minimum_msat(int64_t this_ptr) {
42818         LDKAcceptChannel this_ptr_conv;
42819         this_ptr_conv.inner = untag_ptr(this_ptr);
42820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42822         this_ptr_conv.is_owned = false;
42823         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
42824         return ret_conv;
42825 }
42826
42827 void  CS_LDK_AcceptChannel_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
42828         LDKAcceptChannel this_ptr_conv;
42829         this_ptr_conv.inner = untag_ptr(this_ptr);
42830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42832         this_ptr_conv.is_owned = false;
42833         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
42834 }
42835
42836 int32_t  CS_LDK_AcceptChannel_get_minimum_depth(int64_t this_ptr) {
42837         LDKAcceptChannel this_ptr_conv;
42838         this_ptr_conv.inner = untag_ptr(this_ptr);
42839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42841         this_ptr_conv.is_owned = false;
42842         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
42843         return ret_conv;
42844 }
42845
42846 void  CS_LDK_AcceptChannel_set_minimum_depth(int64_t this_ptr, int32_t val) {
42847         LDKAcceptChannel this_ptr_conv;
42848         this_ptr_conv.inner = untag_ptr(this_ptr);
42849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42851         this_ptr_conv.is_owned = false;
42852         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
42853 }
42854
42855 int16_t  CS_LDK_AcceptChannel_get_to_self_delay(int64_t this_ptr) {
42856         LDKAcceptChannel this_ptr_conv;
42857         this_ptr_conv.inner = untag_ptr(this_ptr);
42858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42860         this_ptr_conv.is_owned = false;
42861         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
42862         return ret_conv;
42863 }
42864
42865 void  CS_LDK_AcceptChannel_set_to_self_delay(int64_t this_ptr, int16_t val) {
42866         LDKAcceptChannel this_ptr_conv;
42867         this_ptr_conv.inner = untag_ptr(this_ptr);
42868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42870         this_ptr_conv.is_owned = false;
42871         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
42872 }
42873
42874 int16_t  CS_LDK_AcceptChannel_get_max_accepted_htlcs(int64_t this_ptr) {
42875         LDKAcceptChannel this_ptr_conv;
42876         this_ptr_conv.inner = untag_ptr(this_ptr);
42877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42879         this_ptr_conv.is_owned = false;
42880         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
42881         return ret_conv;
42882 }
42883
42884 void  CS_LDK_AcceptChannel_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
42885         LDKAcceptChannel this_ptr_conv;
42886         this_ptr_conv.inner = untag_ptr(this_ptr);
42887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42889         this_ptr_conv.is_owned = false;
42890         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
42891 }
42892
42893 int8_tArray  CS_LDK_AcceptChannel_get_funding_pubkey(int64_t this_ptr) {
42894         LDKAcceptChannel this_ptr_conv;
42895         this_ptr_conv.inner = untag_ptr(this_ptr);
42896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42898         this_ptr_conv.is_owned = false;
42899         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42900         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42901         return ret_arr;
42902 }
42903
42904 void  CS_LDK_AcceptChannel_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
42905         LDKAcceptChannel this_ptr_conv;
42906         this_ptr_conv.inner = untag_ptr(this_ptr);
42907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42909         this_ptr_conv.is_owned = false;
42910         LDKPublicKey val_ref;
42911         CHECK(val->arr_len == 33);
42912         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42913         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
42914 }
42915
42916 int8_tArray  CS_LDK_AcceptChannel_get_revocation_basepoint(int64_t this_ptr) {
42917         LDKAcceptChannel this_ptr_conv;
42918         this_ptr_conv.inner = untag_ptr(this_ptr);
42919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42921         this_ptr_conv.is_owned = false;
42922         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42923         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42924         return ret_arr;
42925 }
42926
42927 void  CS_LDK_AcceptChannel_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
42928         LDKAcceptChannel this_ptr_conv;
42929         this_ptr_conv.inner = untag_ptr(this_ptr);
42930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42932         this_ptr_conv.is_owned = false;
42933         LDKPublicKey val_ref;
42934         CHECK(val->arr_len == 33);
42935         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42936         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
42937 }
42938
42939 int8_tArray  CS_LDK_AcceptChannel_get_payment_point(int64_t this_ptr) {
42940         LDKAcceptChannel this_ptr_conv;
42941         this_ptr_conv.inner = untag_ptr(this_ptr);
42942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42944         this_ptr_conv.is_owned = false;
42945         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42946         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
42947         return ret_arr;
42948 }
42949
42950 void  CS_LDK_AcceptChannel_set_payment_point(int64_t this_ptr, int8_tArray val) {
42951         LDKAcceptChannel this_ptr_conv;
42952         this_ptr_conv.inner = untag_ptr(this_ptr);
42953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42955         this_ptr_conv.is_owned = false;
42956         LDKPublicKey val_ref;
42957         CHECK(val->arr_len == 33);
42958         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42959         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
42960 }
42961
42962 int8_tArray  CS_LDK_AcceptChannel_get_delayed_payment_basepoint(int64_t this_ptr) {
42963         LDKAcceptChannel this_ptr_conv;
42964         this_ptr_conv.inner = untag_ptr(this_ptr);
42965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42967         this_ptr_conv.is_owned = false;
42968         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42969         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42970         return ret_arr;
42971 }
42972
42973 void  CS_LDK_AcceptChannel_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
42974         LDKAcceptChannel this_ptr_conv;
42975         this_ptr_conv.inner = untag_ptr(this_ptr);
42976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42978         this_ptr_conv.is_owned = false;
42979         LDKPublicKey val_ref;
42980         CHECK(val->arr_len == 33);
42981         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42982         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42983 }
42984
42985 int8_tArray  CS_LDK_AcceptChannel_get_htlc_basepoint(int64_t this_ptr) {
42986         LDKAcceptChannel this_ptr_conv;
42987         this_ptr_conv.inner = untag_ptr(this_ptr);
42988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42990         this_ptr_conv.is_owned = false;
42991         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42992         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42993         return ret_arr;
42994 }
42995
42996 void  CS_LDK_AcceptChannel_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
42997         LDKAcceptChannel this_ptr_conv;
42998         this_ptr_conv.inner = untag_ptr(this_ptr);
42999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43001         this_ptr_conv.is_owned = false;
43002         LDKPublicKey val_ref;
43003         CHECK(val->arr_len == 33);
43004         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43005         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
43006 }
43007
43008 int8_tArray  CS_LDK_AcceptChannel_get_first_per_commitment_point(int64_t this_ptr) {
43009         LDKAcceptChannel this_ptr_conv;
43010         this_ptr_conv.inner = untag_ptr(this_ptr);
43011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43013         this_ptr_conv.is_owned = false;
43014         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43015         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43016         return ret_arr;
43017 }
43018
43019 void  CS_LDK_AcceptChannel_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
43020         LDKAcceptChannel this_ptr_conv;
43021         this_ptr_conv.inner = untag_ptr(this_ptr);
43022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43024         this_ptr_conv.is_owned = false;
43025         LDKPublicKey val_ref;
43026         CHECK(val->arr_len == 33);
43027         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43028         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43029 }
43030
43031 int64_t  CS_LDK_AcceptChannel_get_shutdown_scriptpubkey(int64_t this_ptr) {
43032         LDKAcceptChannel this_ptr_conv;
43033         this_ptr_conv.inner = untag_ptr(this_ptr);
43034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43036         this_ptr_conv.is_owned = false;
43037         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43038         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
43039         int64_t ret_ref = tag_ptr(ret_copy, true);
43040         return ret_ref;
43041 }
43042
43043 void  CS_LDK_AcceptChannel_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
43044         LDKAcceptChannel this_ptr_conv;
43045         this_ptr_conv.inner = untag_ptr(this_ptr);
43046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43048         this_ptr_conv.is_owned = false;
43049         void* val_ptr = untag_ptr(val);
43050         CHECK_ACCESS(val_ptr);
43051         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43052         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43053         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43054 }
43055
43056 int64_t  CS_LDK_AcceptChannel_get_channel_type(int64_t this_ptr) {
43057         LDKAcceptChannel this_ptr_conv;
43058         this_ptr_conv.inner = untag_ptr(this_ptr);
43059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43061         this_ptr_conv.is_owned = false;
43062         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
43063         int64_t ret_ref = 0;
43064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43066         return ret_ref;
43067 }
43068
43069 void  CS_LDK_AcceptChannel_set_channel_type(int64_t this_ptr, int64_t val) {
43070         LDKAcceptChannel this_ptr_conv;
43071         this_ptr_conv.inner = untag_ptr(this_ptr);
43072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43074         this_ptr_conv.is_owned = false;
43075         LDKChannelTypeFeatures val_conv;
43076         val_conv.inner = untag_ptr(val);
43077         val_conv.is_owned = ptr_is_owned(val);
43078         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43079         val_conv = ChannelTypeFeatures_clone(&val_conv);
43080         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
43081 }
43082
43083 int64_t  CS_LDK_AcceptChannel_new(int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
43084         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43085         CHECK(temporary_channel_id_arg->arr_len == 32);
43086         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43087         LDKPublicKey funding_pubkey_arg_ref;
43088         CHECK(funding_pubkey_arg->arr_len == 33);
43089         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43090         LDKPublicKey revocation_basepoint_arg_ref;
43091         CHECK(revocation_basepoint_arg->arr_len == 33);
43092         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
43093         LDKPublicKey payment_point_arg_ref;
43094         CHECK(payment_point_arg->arr_len == 33);
43095         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
43096         LDKPublicKey delayed_payment_basepoint_arg_ref;
43097         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
43098         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
43099         LDKPublicKey htlc_basepoint_arg_ref;
43100         CHECK(htlc_basepoint_arg->arr_len == 33);
43101         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
43102         LDKPublicKey first_per_commitment_point_arg_ref;
43103         CHECK(first_per_commitment_point_arg->arr_len == 33);
43104         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
43105         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43106         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43107         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43108         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43109         LDKChannelTypeFeatures channel_type_arg_conv;
43110         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43111         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43112         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43113         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43114         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
43115         int64_t ret_ref = 0;
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43118         return ret_ref;
43119 }
43120
43121 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
43122         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
43123         int64_t ret_ref = 0;
43124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43126         return ret_ref;
43127 }
43128 int64_t  CS_LDK_AcceptChannel_clone_ptr(int64_t arg) {
43129         LDKAcceptChannel arg_conv;
43130         arg_conv.inner = untag_ptr(arg);
43131         arg_conv.is_owned = ptr_is_owned(arg);
43132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43133         arg_conv.is_owned = false;
43134         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
43135         return ret_conv;
43136 }
43137
43138 int64_t  CS_LDK_AcceptChannel_clone(int64_t orig) {
43139         LDKAcceptChannel orig_conv;
43140         orig_conv.inner = untag_ptr(orig);
43141         orig_conv.is_owned = ptr_is_owned(orig);
43142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43143         orig_conv.is_owned = false;
43144         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
43145         int64_t ret_ref = 0;
43146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43148         return ret_ref;
43149 }
43150
43151 int64_t  CS_LDK_AcceptChannel_hash(int64_t o) {
43152         LDKAcceptChannel o_conv;
43153         o_conv.inner = untag_ptr(o);
43154         o_conv.is_owned = ptr_is_owned(o);
43155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43156         o_conv.is_owned = false;
43157         int64_t ret_conv = AcceptChannel_hash(&o_conv);
43158         return ret_conv;
43159 }
43160
43161 jboolean  CS_LDK_AcceptChannel_eq(int64_t a, int64_t b) {
43162         LDKAcceptChannel a_conv;
43163         a_conv.inner = untag_ptr(a);
43164         a_conv.is_owned = ptr_is_owned(a);
43165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43166         a_conv.is_owned = false;
43167         LDKAcceptChannel b_conv;
43168         b_conv.inner = untag_ptr(b);
43169         b_conv.is_owned = ptr_is_owned(b);
43170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43171         b_conv.is_owned = false;
43172         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
43173         return ret_conv;
43174 }
43175
43176 void  CS_LDK_AcceptChannelV2_free(int64_t this_obj) {
43177         LDKAcceptChannelV2 this_obj_conv;
43178         this_obj_conv.inner = untag_ptr(this_obj);
43179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43181         AcceptChannelV2_free(this_obj_conv);
43182 }
43183
43184 int8_tArray  CS_LDK_AcceptChannelV2_get_temporary_channel_id(int64_t this_ptr) {
43185         LDKAcceptChannelV2 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43191         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
43192         return ret_arr;
43193 }
43194
43195 void  CS_LDK_AcceptChannelV2_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
43196         LDKAcceptChannelV2 this_ptr_conv;
43197         this_ptr_conv.inner = untag_ptr(this_ptr);
43198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43200         this_ptr_conv.is_owned = false;
43201         LDKThirtyTwoBytes val_ref;
43202         CHECK(val->arr_len == 32);
43203         memcpy(val_ref.data, val->elems, 32); FREE(val);
43204         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
43205 }
43206
43207 int64_t  CS_LDK_AcceptChannelV2_get_funding_satoshis(int64_t this_ptr) {
43208         LDKAcceptChannelV2 this_ptr_conv;
43209         this_ptr_conv.inner = untag_ptr(this_ptr);
43210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43212         this_ptr_conv.is_owned = false;
43213         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
43214         return ret_conv;
43215 }
43216
43217 void  CS_LDK_AcceptChannelV2_set_funding_satoshis(int64_t this_ptr, int64_t val) {
43218         LDKAcceptChannelV2 this_ptr_conv;
43219         this_ptr_conv.inner = untag_ptr(this_ptr);
43220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43222         this_ptr_conv.is_owned = false;
43223         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
43224 }
43225
43226 int64_t  CS_LDK_AcceptChannelV2_get_dust_limit_satoshis(int64_t this_ptr) {
43227         LDKAcceptChannelV2 this_ptr_conv;
43228         this_ptr_conv.inner = untag_ptr(this_ptr);
43229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43231         this_ptr_conv.is_owned = false;
43232         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
43233         return ret_conv;
43234 }
43235
43236 void  CS_LDK_AcceptChannelV2_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
43237         LDKAcceptChannelV2 this_ptr_conv;
43238         this_ptr_conv.inner = untag_ptr(this_ptr);
43239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43241         this_ptr_conv.is_owned = false;
43242         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
43243 }
43244
43245 int64_t  CS_LDK_AcceptChannelV2_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
43246         LDKAcceptChannelV2 this_ptr_conv;
43247         this_ptr_conv.inner = untag_ptr(this_ptr);
43248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43250         this_ptr_conv.is_owned = false;
43251         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43252         return ret_conv;
43253 }
43254
43255 void  CS_LDK_AcceptChannelV2_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
43256         LDKAcceptChannelV2 this_ptr_conv;
43257         this_ptr_conv.inner = untag_ptr(this_ptr);
43258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43260         this_ptr_conv.is_owned = false;
43261         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43262 }
43263
43264 int64_t  CS_LDK_AcceptChannelV2_get_htlc_minimum_msat(int64_t this_ptr) {
43265         LDKAcceptChannelV2 this_ptr_conv;
43266         this_ptr_conv.inner = untag_ptr(this_ptr);
43267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43269         this_ptr_conv.is_owned = false;
43270         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
43271         return ret_conv;
43272 }
43273
43274 void  CS_LDK_AcceptChannelV2_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
43275         LDKAcceptChannelV2 this_ptr_conv;
43276         this_ptr_conv.inner = untag_ptr(this_ptr);
43277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43279         this_ptr_conv.is_owned = false;
43280         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
43281 }
43282
43283 int32_t  CS_LDK_AcceptChannelV2_get_minimum_depth(int64_t this_ptr) {
43284         LDKAcceptChannelV2 this_ptr_conv;
43285         this_ptr_conv.inner = untag_ptr(this_ptr);
43286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43288         this_ptr_conv.is_owned = false;
43289         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
43290         return ret_conv;
43291 }
43292
43293 void  CS_LDK_AcceptChannelV2_set_minimum_depth(int64_t this_ptr, int32_t val) {
43294         LDKAcceptChannelV2 this_ptr_conv;
43295         this_ptr_conv.inner = untag_ptr(this_ptr);
43296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43298         this_ptr_conv.is_owned = false;
43299         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
43300 }
43301
43302 int16_t  CS_LDK_AcceptChannelV2_get_to_self_delay(int64_t this_ptr) {
43303         LDKAcceptChannelV2 this_ptr_conv;
43304         this_ptr_conv.inner = untag_ptr(this_ptr);
43305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43307         this_ptr_conv.is_owned = false;
43308         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
43309         return ret_conv;
43310 }
43311
43312 void  CS_LDK_AcceptChannelV2_set_to_self_delay(int64_t this_ptr, int16_t val) {
43313         LDKAcceptChannelV2 this_ptr_conv;
43314         this_ptr_conv.inner = untag_ptr(this_ptr);
43315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43317         this_ptr_conv.is_owned = false;
43318         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
43319 }
43320
43321 int16_t  CS_LDK_AcceptChannelV2_get_max_accepted_htlcs(int64_t this_ptr) {
43322         LDKAcceptChannelV2 this_ptr_conv;
43323         this_ptr_conv.inner = untag_ptr(this_ptr);
43324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43326         this_ptr_conv.is_owned = false;
43327         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
43328         return ret_conv;
43329 }
43330
43331 void  CS_LDK_AcceptChannelV2_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
43332         LDKAcceptChannelV2 this_ptr_conv;
43333         this_ptr_conv.inner = untag_ptr(this_ptr);
43334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43336         this_ptr_conv.is_owned = false;
43337         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
43338 }
43339
43340 int8_tArray  CS_LDK_AcceptChannelV2_get_funding_pubkey(int64_t this_ptr) {
43341         LDKAcceptChannelV2 this_ptr_conv;
43342         this_ptr_conv.inner = untag_ptr(this_ptr);
43343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43345         this_ptr_conv.is_owned = false;
43346         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43347         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
43348         return ret_arr;
43349 }
43350
43351 void  CS_LDK_AcceptChannelV2_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
43352         LDKAcceptChannelV2 this_ptr_conv;
43353         this_ptr_conv.inner = untag_ptr(this_ptr);
43354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43356         this_ptr_conv.is_owned = false;
43357         LDKPublicKey val_ref;
43358         CHECK(val->arr_len == 33);
43359         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43360         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
43361 }
43362
43363 int8_tArray  CS_LDK_AcceptChannelV2_get_revocation_basepoint(int64_t this_ptr) {
43364         LDKAcceptChannelV2 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43370         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
43371         return ret_arr;
43372 }
43373
43374 void  CS_LDK_AcceptChannelV2_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
43375         LDKAcceptChannelV2 this_ptr_conv;
43376         this_ptr_conv.inner = untag_ptr(this_ptr);
43377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43379         this_ptr_conv.is_owned = false;
43380         LDKPublicKey val_ref;
43381         CHECK(val->arr_len == 33);
43382         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43383         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43384 }
43385
43386 int8_tArray  CS_LDK_AcceptChannelV2_get_payment_basepoint(int64_t this_ptr) {
43387         LDKAcceptChannelV2 this_ptr_conv;
43388         this_ptr_conv.inner = untag_ptr(this_ptr);
43389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43391         this_ptr_conv.is_owned = false;
43392         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43393         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43394         return ret_arr;
43395 }
43396
43397 void  CS_LDK_AcceptChannelV2_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
43398         LDKAcceptChannelV2 this_ptr_conv;
43399         this_ptr_conv.inner = untag_ptr(this_ptr);
43400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43402         this_ptr_conv.is_owned = false;
43403         LDKPublicKey val_ref;
43404         CHECK(val->arr_len == 33);
43405         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43406         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43407 }
43408
43409 int8_tArray  CS_LDK_AcceptChannelV2_get_delayed_payment_basepoint(int64_t this_ptr) {
43410         LDKAcceptChannelV2 this_ptr_conv;
43411         this_ptr_conv.inner = untag_ptr(this_ptr);
43412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43414         this_ptr_conv.is_owned = false;
43415         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43416         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43417         return ret_arr;
43418 }
43419
43420 void  CS_LDK_AcceptChannelV2_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
43421         LDKAcceptChannelV2 this_ptr_conv;
43422         this_ptr_conv.inner = untag_ptr(this_ptr);
43423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43425         this_ptr_conv.is_owned = false;
43426         LDKPublicKey val_ref;
43427         CHECK(val->arr_len == 33);
43428         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43429         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43430 }
43431
43432 int8_tArray  CS_LDK_AcceptChannelV2_get_htlc_basepoint(int64_t this_ptr) {
43433         LDKAcceptChannelV2 this_ptr_conv;
43434         this_ptr_conv.inner = untag_ptr(this_ptr);
43435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43437         this_ptr_conv.is_owned = false;
43438         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43439         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
43440         return ret_arr;
43441 }
43442
43443 void  CS_LDK_AcceptChannelV2_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
43444         LDKAcceptChannelV2 this_ptr_conv;
43445         this_ptr_conv.inner = untag_ptr(this_ptr);
43446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43448         this_ptr_conv.is_owned = false;
43449         LDKPublicKey val_ref;
43450         CHECK(val->arr_len == 33);
43451         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43452         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43453 }
43454
43455 int8_tArray  CS_LDK_AcceptChannelV2_get_first_per_commitment_point(int64_t this_ptr) {
43456         LDKAcceptChannelV2 this_ptr_conv;
43457         this_ptr_conv.inner = untag_ptr(this_ptr);
43458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43460         this_ptr_conv.is_owned = false;
43461         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43462         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43463         return ret_arr;
43464 }
43465
43466 void  CS_LDK_AcceptChannelV2_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
43467         LDKAcceptChannelV2 this_ptr_conv;
43468         this_ptr_conv.inner = untag_ptr(this_ptr);
43469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43471         this_ptr_conv.is_owned = false;
43472         LDKPublicKey val_ref;
43473         CHECK(val->arr_len == 33);
43474         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43475         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43476 }
43477
43478 int8_tArray  CS_LDK_AcceptChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
43479         LDKAcceptChannelV2 this_ptr_conv;
43480         this_ptr_conv.inner = untag_ptr(this_ptr);
43481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43483         this_ptr_conv.is_owned = false;
43484         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43485         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43486         return ret_arr;
43487 }
43488
43489 void  CS_LDK_AcceptChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
43490         LDKAcceptChannelV2 this_ptr_conv;
43491         this_ptr_conv.inner = untag_ptr(this_ptr);
43492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43494         this_ptr_conv.is_owned = false;
43495         LDKPublicKey val_ref;
43496         CHECK(val->arr_len == 33);
43497         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43498         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43499 }
43500
43501 int64_t  CS_LDK_AcceptChannelV2_get_shutdown_scriptpubkey(int64_t this_ptr) {
43502         LDKAcceptChannelV2 this_ptr_conv;
43503         this_ptr_conv.inner = untag_ptr(this_ptr);
43504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43506         this_ptr_conv.is_owned = false;
43507         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43508         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43509         int64_t ret_ref = tag_ptr(ret_copy, true);
43510         return ret_ref;
43511 }
43512
43513 void  CS_LDK_AcceptChannelV2_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
43514         LDKAcceptChannelV2 this_ptr_conv;
43515         this_ptr_conv.inner = untag_ptr(this_ptr);
43516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43518         this_ptr_conv.is_owned = false;
43519         void* val_ptr = untag_ptr(val);
43520         CHECK_ACCESS(val_ptr);
43521         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43522         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43523         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43524 }
43525
43526 int64_t  CS_LDK_AcceptChannelV2_get_channel_type(int64_t this_ptr) {
43527         LDKAcceptChannelV2 this_ptr_conv;
43528         this_ptr_conv.inner = untag_ptr(this_ptr);
43529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43531         this_ptr_conv.is_owned = false;
43532         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
43533         int64_t ret_ref = 0;
43534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43536         return ret_ref;
43537 }
43538
43539 void  CS_LDK_AcceptChannelV2_set_channel_type(int64_t this_ptr, int64_t val) {
43540         LDKAcceptChannelV2 this_ptr_conv;
43541         this_ptr_conv.inner = untag_ptr(this_ptr);
43542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43544         this_ptr_conv.is_owned = false;
43545         LDKChannelTypeFeatures val_conv;
43546         val_conv.inner = untag_ptr(val);
43547         val_conv.is_owned = ptr_is_owned(val);
43548         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43549         val_conv = ChannelTypeFeatures_clone(&val_conv);
43550         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43551 }
43552
43553 int32_t  CS_LDK_AcceptChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
43554         LDKAcceptChannelV2 this_ptr_conv;
43555         this_ptr_conv.inner = untag_ptr(this_ptr);
43556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43558         this_ptr_conv.is_owned = false;
43559         int32_t ret_conv = LDKCOption_NoneZ_to_cs(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43560         return ret_conv;
43561 }
43562
43563 void  CS_LDK_AcceptChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
43564         LDKAcceptChannelV2 this_ptr_conv;
43565         this_ptr_conv.inner = untag_ptr(this_ptr);
43566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43568         this_ptr_conv.is_owned = false;
43569         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
43570         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43571 }
43572
43573 int64_t  CS_LDK_AcceptChannelV2_new(int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, int32_t require_confirmed_inputs_arg) {
43574         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43575         CHECK(temporary_channel_id_arg->arr_len == 32);
43576         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43577         LDKPublicKey funding_pubkey_arg_ref;
43578         CHECK(funding_pubkey_arg->arr_len == 33);
43579         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43580         LDKPublicKey revocation_basepoint_arg_ref;
43581         CHECK(revocation_basepoint_arg->arr_len == 33);
43582         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
43583         LDKPublicKey payment_basepoint_arg_ref;
43584         CHECK(payment_basepoint_arg->arr_len == 33);
43585         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
43586         LDKPublicKey delayed_payment_basepoint_arg_ref;
43587         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
43588         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
43589         LDKPublicKey htlc_basepoint_arg_ref;
43590         CHECK(htlc_basepoint_arg->arr_len == 33);
43591         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
43592         LDKPublicKey first_per_commitment_point_arg_ref;
43593         CHECK(first_per_commitment_point_arg->arr_len == 33);
43594         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
43595         LDKPublicKey second_per_commitment_point_arg_ref;
43596         CHECK(second_per_commitment_point_arg->arr_len == 33);
43597         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
43598         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43599         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43600         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43601         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43602         LDKChannelTypeFeatures channel_type_arg_conv;
43603         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43604         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43605         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43606         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43607         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
43608         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
43609         int64_t ret_ref = 0;
43610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43612         return ret_ref;
43613 }
43614
43615 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
43616         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
43617         int64_t ret_ref = 0;
43618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43620         return ret_ref;
43621 }
43622 int64_t  CS_LDK_AcceptChannelV2_clone_ptr(int64_t arg) {
43623         LDKAcceptChannelV2 arg_conv;
43624         arg_conv.inner = untag_ptr(arg);
43625         arg_conv.is_owned = ptr_is_owned(arg);
43626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43627         arg_conv.is_owned = false;
43628         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
43629         return ret_conv;
43630 }
43631
43632 int64_t  CS_LDK_AcceptChannelV2_clone(int64_t orig) {
43633         LDKAcceptChannelV2 orig_conv;
43634         orig_conv.inner = untag_ptr(orig);
43635         orig_conv.is_owned = ptr_is_owned(orig);
43636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43637         orig_conv.is_owned = false;
43638         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
43639         int64_t ret_ref = 0;
43640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43642         return ret_ref;
43643 }
43644
43645 int64_t  CS_LDK_AcceptChannelV2_hash(int64_t o) {
43646         LDKAcceptChannelV2 o_conv;
43647         o_conv.inner = untag_ptr(o);
43648         o_conv.is_owned = ptr_is_owned(o);
43649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43650         o_conv.is_owned = false;
43651         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
43652         return ret_conv;
43653 }
43654
43655 jboolean  CS_LDK_AcceptChannelV2_eq(int64_t a, int64_t b) {
43656         LDKAcceptChannelV2 a_conv;
43657         a_conv.inner = untag_ptr(a);
43658         a_conv.is_owned = ptr_is_owned(a);
43659         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43660         a_conv.is_owned = false;
43661         LDKAcceptChannelV2 b_conv;
43662         b_conv.inner = untag_ptr(b);
43663         b_conv.is_owned = ptr_is_owned(b);
43664         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43665         b_conv.is_owned = false;
43666         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
43667         return ret_conv;
43668 }
43669
43670 void  CS_LDK_FundingCreated_free(int64_t this_obj) {
43671         LDKFundingCreated this_obj_conv;
43672         this_obj_conv.inner = untag_ptr(this_obj);
43673         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43675         FundingCreated_free(this_obj_conv);
43676 }
43677
43678 int8_tArray  CS_LDK_FundingCreated_get_temporary_channel_id(int64_t this_ptr) {
43679         LDKFundingCreated this_ptr_conv;
43680         this_ptr_conv.inner = untag_ptr(this_ptr);
43681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43683         this_ptr_conv.is_owned = false;
43684         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43685         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
43686         return ret_arr;
43687 }
43688
43689 void  CS_LDK_FundingCreated_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
43690         LDKFundingCreated this_ptr_conv;
43691         this_ptr_conv.inner = untag_ptr(this_ptr);
43692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43694         this_ptr_conv.is_owned = false;
43695         LDKThirtyTwoBytes val_ref;
43696         CHECK(val->arr_len == 32);
43697         memcpy(val_ref.data, val->elems, 32); FREE(val);
43698         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
43699 }
43700
43701 int8_tArray  CS_LDK_FundingCreated_get_funding_txid(int64_t this_ptr) {
43702         LDKFundingCreated this_ptr_conv;
43703         this_ptr_conv.inner = untag_ptr(this_ptr);
43704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43706         this_ptr_conv.is_owned = false;
43707         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43708         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
43709         return ret_arr;
43710 }
43711
43712 void  CS_LDK_FundingCreated_set_funding_txid(int64_t this_ptr, int8_tArray val) {
43713         LDKFundingCreated this_ptr_conv;
43714         this_ptr_conv.inner = untag_ptr(this_ptr);
43715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43717         this_ptr_conv.is_owned = false;
43718         LDKThirtyTwoBytes val_ref;
43719         CHECK(val->arr_len == 32);
43720         memcpy(val_ref.data, val->elems, 32); FREE(val);
43721         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
43722 }
43723
43724 int16_t  CS_LDK_FundingCreated_get_funding_output_index(int64_t this_ptr) {
43725         LDKFundingCreated this_ptr_conv;
43726         this_ptr_conv.inner = untag_ptr(this_ptr);
43727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43729         this_ptr_conv.is_owned = false;
43730         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
43731         return ret_conv;
43732 }
43733
43734 void  CS_LDK_FundingCreated_set_funding_output_index(int64_t this_ptr, int16_t val) {
43735         LDKFundingCreated this_ptr_conv;
43736         this_ptr_conv.inner = untag_ptr(this_ptr);
43737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43739         this_ptr_conv.is_owned = false;
43740         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
43741 }
43742
43743 int8_tArray  CS_LDK_FundingCreated_get_signature(int64_t this_ptr) {
43744         LDKFundingCreated this_ptr_conv;
43745         this_ptr_conv.inner = untag_ptr(this_ptr);
43746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43748         this_ptr_conv.is_owned = false;
43749         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43750         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
43751         return ret_arr;
43752 }
43753
43754 void  CS_LDK_FundingCreated_set_signature(int64_t this_ptr, int8_tArray val) {
43755         LDKFundingCreated this_ptr_conv;
43756         this_ptr_conv.inner = untag_ptr(this_ptr);
43757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43759         this_ptr_conv.is_owned = false;
43760         LDKECDSASignature val_ref;
43761         CHECK(val->arr_len == 64);
43762         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43763         FundingCreated_set_signature(&this_ptr_conv, val_ref);
43764 }
43765
43766 int64_t  CS_LDK_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
43767         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43768         CHECK(temporary_channel_id_arg->arr_len == 32);
43769         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43770         LDKThirtyTwoBytes funding_txid_arg_ref;
43771         CHECK(funding_txid_arg->arr_len == 32);
43772         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
43773         LDKECDSASignature signature_arg_ref;
43774         CHECK(signature_arg->arr_len == 64);
43775         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43776         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
43777         int64_t ret_ref = 0;
43778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43780         return ret_ref;
43781 }
43782
43783 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
43784         LDKFundingCreated ret_var = FundingCreated_clone(arg);
43785         int64_t ret_ref = 0;
43786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43788         return ret_ref;
43789 }
43790 int64_t  CS_LDK_FundingCreated_clone_ptr(int64_t arg) {
43791         LDKFundingCreated arg_conv;
43792         arg_conv.inner = untag_ptr(arg);
43793         arg_conv.is_owned = ptr_is_owned(arg);
43794         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43795         arg_conv.is_owned = false;
43796         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
43797         return ret_conv;
43798 }
43799
43800 int64_t  CS_LDK_FundingCreated_clone(int64_t orig) {
43801         LDKFundingCreated orig_conv;
43802         orig_conv.inner = untag_ptr(orig);
43803         orig_conv.is_owned = ptr_is_owned(orig);
43804         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43805         orig_conv.is_owned = false;
43806         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
43807         int64_t ret_ref = 0;
43808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43810         return ret_ref;
43811 }
43812
43813 int64_t  CS_LDK_FundingCreated_hash(int64_t o) {
43814         LDKFundingCreated o_conv;
43815         o_conv.inner = untag_ptr(o);
43816         o_conv.is_owned = ptr_is_owned(o);
43817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43818         o_conv.is_owned = false;
43819         int64_t ret_conv = FundingCreated_hash(&o_conv);
43820         return ret_conv;
43821 }
43822
43823 jboolean  CS_LDK_FundingCreated_eq(int64_t a, int64_t b) {
43824         LDKFundingCreated a_conv;
43825         a_conv.inner = untag_ptr(a);
43826         a_conv.is_owned = ptr_is_owned(a);
43827         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43828         a_conv.is_owned = false;
43829         LDKFundingCreated b_conv;
43830         b_conv.inner = untag_ptr(b);
43831         b_conv.is_owned = ptr_is_owned(b);
43832         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43833         b_conv.is_owned = false;
43834         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
43835         return ret_conv;
43836 }
43837
43838 void  CS_LDK_FundingSigned_free(int64_t this_obj) {
43839         LDKFundingSigned this_obj_conv;
43840         this_obj_conv.inner = untag_ptr(this_obj);
43841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43843         FundingSigned_free(this_obj_conv);
43844 }
43845
43846 int8_tArray  CS_LDK_FundingSigned_get_channel_id(int64_t this_ptr) {
43847         LDKFundingSigned this_ptr_conv;
43848         this_ptr_conv.inner = untag_ptr(this_ptr);
43849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43851         this_ptr_conv.is_owned = false;
43852         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43853         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
43854         return ret_arr;
43855 }
43856
43857 void  CS_LDK_FundingSigned_set_channel_id(int64_t this_ptr, int8_tArray val) {
43858         LDKFundingSigned this_ptr_conv;
43859         this_ptr_conv.inner = untag_ptr(this_ptr);
43860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43862         this_ptr_conv.is_owned = false;
43863         LDKThirtyTwoBytes val_ref;
43864         CHECK(val->arr_len == 32);
43865         memcpy(val_ref.data, val->elems, 32); FREE(val);
43866         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
43867 }
43868
43869 int8_tArray  CS_LDK_FundingSigned_get_signature(int64_t this_ptr) {
43870         LDKFundingSigned this_ptr_conv;
43871         this_ptr_conv.inner = untag_ptr(this_ptr);
43872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43874         this_ptr_conv.is_owned = false;
43875         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43876         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
43877         return ret_arr;
43878 }
43879
43880 void  CS_LDK_FundingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
43881         LDKFundingSigned this_ptr_conv;
43882         this_ptr_conv.inner = untag_ptr(this_ptr);
43883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43885         this_ptr_conv.is_owned = false;
43886         LDKECDSASignature val_ref;
43887         CHECK(val->arr_len == 64);
43888         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43889         FundingSigned_set_signature(&this_ptr_conv, val_ref);
43890 }
43891
43892 int64_t  CS_LDK_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
43893         LDKThirtyTwoBytes channel_id_arg_ref;
43894         CHECK(channel_id_arg->arr_len == 32);
43895         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43896         LDKECDSASignature signature_arg_ref;
43897         CHECK(signature_arg->arr_len == 64);
43898         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43899         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
43900         int64_t ret_ref = 0;
43901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43903         return ret_ref;
43904 }
43905
43906 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
43907         LDKFundingSigned ret_var = FundingSigned_clone(arg);
43908         int64_t ret_ref = 0;
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43911         return ret_ref;
43912 }
43913 int64_t  CS_LDK_FundingSigned_clone_ptr(int64_t arg) {
43914         LDKFundingSigned arg_conv;
43915         arg_conv.inner = untag_ptr(arg);
43916         arg_conv.is_owned = ptr_is_owned(arg);
43917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43918         arg_conv.is_owned = false;
43919         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
43920         return ret_conv;
43921 }
43922
43923 int64_t  CS_LDK_FundingSigned_clone(int64_t orig) {
43924         LDKFundingSigned orig_conv;
43925         orig_conv.inner = untag_ptr(orig);
43926         orig_conv.is_owned = ptr_is_owned(orig);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43928         orig_conv.is_owned = false;
43929         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
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
43936 int64_t  CS_LDK_FundingSigned_hash(int64_t o) {
43937         LDKFundingSigned o_conv;
43938         o_conv.inner = untag_ptr(o);
43939         o_conv.is_owned = ptr_is_owned(o);
43940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43941         o_conv.is_owned = false;
43942         int64_t ret_conv = FundingSigned_hash(&o_conv);
43943         return ret_conv;
43944 }
43945
43946 jboolean  CS_LDK_FundingSigned_eq(int64_t a, int64_t b) {
43947         LDKFundingSigned a_conv;
43948         a_conv.inner = untag_ptr(a);
43949         a_conv.is_owned = ptr_is_owned(a);
43950         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43951         a_conv.is_owned = false;
43952         LDKFundingSigned b_conv;
43953         b_conv.inner = untag_ptr(b);
43954         b_conv.is_owned = ptr_is_owned(b);
43955         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43956         b_conv.is_owned = false;
43957         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
43958         return ret_conv;
43959 }
43960
43961 void  CS_LDK_ChannelReady_free(int64_t this_obj) {
43962         LDKChannelReady this_obj_conv;
43963         this_obj_conv.inner = untag_ptr(this_obj);
43964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43966         ChannelReady_free(this_obj_conv);
43967 }
43968
43969 int8_tArray  CS_LDK_ChannelReady_get_channel_id(int64_t this_ptr) {
43970         LDKChannelReady this_ptr_conv;
43971         this_ptr_conv.inner = untag_ptr(this_ptr);
43972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43974         this_ptr_conv.is_owned = false;
43975         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43976         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
43977         return ret_arr;
43978 }
43979
43980 void  CS_LDK_ChannelReady_set_channel_id(int64_t this_ptr, int8_tArray val) {
43981         LDKChannelReady this_ptr_conv;
43982         this_ptr_conv.inner = untag_ptr(this_ptr);
43983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43985         this_ptr_conv.is_owned = false;
43986         LDKThirtyTwoBytes val_ref;
43987         CHECK(val->arr_len == 32);
43988         memcpy(val_ref.data, val->elems, 32); FREE(val);
43989         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
43990 }
43991
43992 int8_tArray  CS_LDK_ChannelReady_get_next_per_commitment_point(int64_t this_ptr) {
43993         LDKChannelReady this_ptr_conv;
43994         this_ptr_conv.inner = untag_ptr(this_ptr);
43995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43997         this_ptr_conv.is_owned = false;
43998         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43999         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
44000         return ret_arr;
44001 }
44002
44003 void  CS_LDK_ChannelReady_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
44004         LDKChannelReady this_ptr_conv;
44005         this_ptr_conv.inner = untag_ptr(this_ptr);
44006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44008         this_ptr_conv.is_owned = false;
44009         LDKPublicKey val_ref;
44010         CHECK(val->arr_len == 33);
44011         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44012         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
44013 }
44014
44015 int64_t  CS_LDK_ChannelReady_get_short_channel_id_alias(int64_t this_ptr) {
44016         LDKChannelReady this_ptr_conv;
44017         this_ptr_conv.inner = untag_ptr(this_ptr);
44018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44020         this_ptr_conv.is_owned = false;
44021         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44022         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
44023         int64_t ret_ref = tag_ptr(ret_copy, true);
44024         return ret_ref;
44025 }
44026
44027 void  CS_LDK_ChannelReady_set_short_channel_id_alias(int64_t this_ptr, int64_t val) {
44028         LDKChannelReady this_ptr_conv;
44029         this_ptr_conv.inner = untag_ptr(this_ptr);
44030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44032         this_ptr_conv.is_owned = false;
44033         void* val_ptr = untag_ptr(val);
44034         CHECK_ACCESS(val_ptr);
44035         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44036         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44037         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
44038 }
44039
44040 int64_t  CS_LDK_ChannelReady_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
44041         LDKThirtyTwoBytes channel_id_arg_ref;
44042         CHECK(channel_id_arg->arr_len == 32);
44043         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44044         LDKPublicKey next_per_commitment_point_arg_ref;
44045         CHECK(next_per_commitment_point_arg->arr_len == 33);
44046         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
44047         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
44048         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
44049         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
44050         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
44051         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
44052         int64_t ret_ref = 0;
44053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44055         return ret_ref;
44056 }
44057
44058 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
44059         LDKChannelReady ret_var = ChannelReady_clone(arg);
44060         int64_t ret_ref = 0;
44061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44063         return ret_ref;
44064 }
44065 int64_t  CS_LDK_ChannelReady_clone_ptr(int64_t arg) {
44066         LDKChannelReady arg_conv;
44067         arg_conv.inner = untag_ptr(arg);
44068         arg_conv.is_owned = ptr_is_owned(arg);
44069         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44070         arg_conv.is_owned = false;
44071         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
44072         return ret_conv;
44073 }
44074
44075 int64_t  CS_LDK_ChannelReady_clone(int64_t orig) {
44076         LDKChannelReady orig_conv;
44077         orig_conv.inner = untag_ptr(orig);
44078         orig_conv.is_owned = ptr_is_owned(orig);
44079         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44080         orig_conv.is_owned = false;
44081         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
44082         int64_t ret_ref = 0;
44083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44085         return ret_ref;
44086 }
44087
44088 int64_t  CS_LDK_ChannelReady_hash(int64_t o) {
44089         LDKChannelReady o_conv;
44090         o_conv.inner = untag_ptr(o);
44091         o_conv.is_owned = ptr_is_owned(o);
44092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44093         o_conv.is_owned = false;
44094         int64_t ret_conv = ChannelReady_hash(&o_conv);
44095         return ret_conv;
44096 }
44097
44098 jboolean  CS_LDK_ChannelReady_eq(int64_t a, int64_t b) {
44099         LDKChannelReady a_conv;
44100         a_conv.inner = untag_ptr(a);
44101         a_conv.is_owned = ptr_is_owned(a);
44102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44103         a_conv.is_owned = false;
44104         LDKChannelReady b_conv;
44105         b_conv.inner = untag_ptr(b);
44106         b_conv.is_owned = ptr_is_owned(b);
44107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44108         b_conv.is_owned = false;
44109         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
44110         return ret_conv;
44111 }
44112
44113 void  CS_LDK_Stfu_free(int64_t this_obj) {
44114         LDKStfu this_obj_conv;
44115         this_obj_conv.inner = untag_ptr(this_obj);
44116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44118         Stfu_free(this_obj_conv);
44119 }
44120
44121 int8_tArray  CS_LDK_Stfu_get_channel_id(int64_t this_ptr) {
44122         LDKStfu this_ptr_conv;
44123         this_ptr_conv.inner = untag_ptr(this_ptr);
44124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44126         this_ptr_conv.is_owned = false;
44127         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44128         memcpy(ret_arr->elems, *Stfu_get_channel_id(&this_ptr_conv), 32);
44129         return ret_arr;
44130 }
44131
44132 void  CS_LDK_Stfu_set_channel_id(int64_t this_ptr, int8_tArray val) {
44133         LDKStfu this_ptr_conv;
44134         this_ptr_conv.inner = untag_ptr(this_ptr);
44135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44137         this_ptr_conv.is_owned = false;
44138         LDKThirtyTwoBytes val_ref;
44139         CHECK(val->arr_len == 32);
44140         memcpy(val_ref.data, val->elems, 32); FREE(val);
44141         Stfu_set_channel_id(&this_ptr_conv, val_ref);
44142 }
44143
44144 int8_t  CS_LDK_Stfu_get_initiator(int64_t this_ptr) {
44145         LDKStfu this_ptr_conv;
44146         this_ptr_conv.inner = untag_ptr(this_ptr);
44147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44149         this_ptr_conv.is_owned = false;
44150         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
44151         return ret_conv;
44152 }
44153
44154 void  CS_LDK_Stfu_set_initiator(int64_t this_ptr, int8_t val) {
44155         LDKStfu this_ptr_conv;
44156         this_ptr_conv.inner = untag_ptr(this_ptr);
44157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44159         this_ptr_conv.is_owned = false;
44160         Stfu_set_initiator(&this_ptr_conv, val);
44161 }
44162
44163 int64_t  CS_LDK_Stfu_new(int8_tArray channel_id_arg, int8_t initiator_arg) {
44164         LDKThirtyTwoBytes channel_id_arg_ref;
44165         CHECK(channel_id_arg->arr_len == 32);
44166         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44167         LDKStfu ret_var = Stfu_new(channel_id_arg_ref, initiator_arg);
44168         int64_t ret_ref = 0;
44169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44171         return ret_ref;
44172 }
44173
44174 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
44175         LDKStfu ret_var = Stfu_clone(arg);
44176         int64_t ret_ref = 0;
44177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44179         return ret_ref;
44180 }
44181 int64_t  CS_LDK_Stfu_clone_ptr(int64_t arg) {
44182         LDKStfu arg_conv;
44183         arg_conv.inner = untag_ptr(arg);
44184         arg_conv.is_owned = ptr_is_owned(arg);
44185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44186         arg_conv.is_owned = false;
44187         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
44188         return ret_conv;
44189 }
44190
44191 int64_t  CS_LDK_Stfu_clone(int64_t orig) {
44192         LDKStfu orig_conv;
44193         orig_conv.inner = untag_ptr(orig);
44194         orig_conv.is_owned = ptr_is_owned(orig);
44195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44196         orig_conv.is_owned = false;
44197         LDKStfu ret_var = Stfu_clone(&orig_conv);
44198         int64_t ret_ref = 0;
44199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44201         return ret_ref;
44202 }
44203
44204 jboolean  CS_LDK_Stfu_eq(int64_t a, int64_t b) {
44205         LDKStfu a_conv;
44206         a_conv.inner = untag_ptr(a);
44207         a_conv.is_owned = ptr_is_owned(a);
44208         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44209         a_conv.is_owned = false;
44210         LDKStfu b_conv;
44211         b_conv.inner = untag_ptr(b);
44212         b_conv.is_owned = ptr_is_owned(b);
44213         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44214         b_conv.is_owned = false;
44215         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
44216         return ret_conv;
44217 }
44218
44219 void  CS_LDK_Splice_free(int64_t this_obj) {
44220         LDKSplice this_obj_conv;
44221         this_obj_conv.inner = untag_ptr(this_obj);
44222         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44224         Splice_free(this_obj_conv);
44225 }
44226
44227 int8_tArray  CS_LDK_Splice_get_channel_id(int64_t this_ptr) {
44228         LDKSplice this_ptr_conv;
44229         this_ptr_conv.inner = untag_ptr(this_ptr);
44230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44232         this_ptr_conv.is_owned = false;
44233         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44234         memcpy(ret_arr->elems, *Splice_get_channel_id(&this_ptr_conv), 32);
44235         return ret_arr;
44236 }
44237
44238 void  CS_LDK_Splice_set_channel_id(int64_t this_ptr, int8_tArray val) {
44239         LDKSplice this_ptr_conv;
44240         this_ptr_conv.inner = untag_ptr(this_ptr);
44241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44243         this_ptr_conv.is_owned = false;
44244         LDKThirtyTwoBytes val_ref;
44245         CHECK(val->arr_len == 32);
44246         memcpy(val_ref.data, val->elems, 32); FREE(val);
44247         Splice_set_channel_id(&this_ptr_conv, val_ref);
44248 }
44249
44250 int8_tArray  CS_LDK_Splice_get_chain_hash(int64_t this_ptr) {
44251         LDKSplice this_ptr_conv;
44252         this_ptr_conv.inner = untag_ptr(this_ptr);
44253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44255         this_ptr_conv.is_owned = false;
44256         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44257         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
44258         return ret_arr;
44259 }
44260
44261 void  CS_LDK_Splice_set_chain_hash(int64_t this_ptr, int8_tArray val) {
44262         LDKSplice this_ptr_conv;
44263         this_ptr_conv.inner = untag_ptr(this_ptr);
44264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44266         this_ptr_conv.is_owned = false;
44267         LDKThirtyTwoBytes val_ref;
44268         CHECK(val->arr_len == 32);
44269         memcpy(val_ref.data, val->elems, 32); FREE(val);
44270         Splice_set_chain_hash(&this_ptr_conv, val_ref);
44271 }
44272
44273 int64_t  CS_LDK_Splice_get_relative_satoshis(int64_t this_ptr) {
44274         LDKSplice this_ptr_conv;
44275         this_ptr_conv.inner = untag_ptr(this_ptr);
44276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44278         this_ptr_conv.is_owned = false;
44279         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
44280         return ret_conv;
44281 }
44282
44283 void  CS_LDK_Splice_set_relative_satoshis(int64_t this_ptr, int64_t val) {
44284         LDKSplice this_ptr_conv;
44285         this_ptr_conv.inner = untag_ptr(this_ptr);
44286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44288         this_ptr_conv.is_owned = false;
44289         Splice_set_relative_satoshis(&this_ptr_conv, val);
44290 }
44291
44292 int32_t  CS_LDK_Splice_get_funding_feerate_perkw(int64_t this_ptr) {
44293         LDKSplice this_ptr_conv;
44294         this_ptr_conv.inner = untag_ptr(this_ptr);
44295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44297         this_ptr_conv.is_owned = false;
44298         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
44299         return ret_conv;
44300 }
44301
44302 void  CS_LDK_Splice_set_funding_feerate_perkw(int64_t this_ptr, int32_t val) {
44303         LDKSplice this_ptr_conv;
44304         this_ptr_conv.inner = untag_ptr(this_ptr);
44305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44307         this_ptr_conv.is_owned = false;
44308         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
44309 }
44310
44311 int32_t  CS_LDK_Splice_get_locktime(int64_t this_ptr) {
44312         LDKSplice this_ptr_conv;
44313         this_ptr_conv.inner = untag_ptr(this_ptr);
44314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44316         this_ptr_conv.is_owned = false;
44317         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
44318         return ret_conv;
44319 }
44320
44321 void  CS_LDK_Splice_set_locktime(int64_t this_ptr, int32_t val) {
44322         LDKSplice this_ptr_conv;
44323         this_ptr_conv.inner = untag_ptr(this_ptr);
44324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44326         this_ptr_conv.is_owned = false;
44327         Splice_set_locktime(&this_ptr_conv, val);
44328 }
44329
44330 int8_tArray  CS_LDK_Splice_get_funding_pubkey(int64_t this_ptr) {
44331         LDKSplice this_ptr_conv;
44332         this_ptr_conv.inner = untag_ptr(this_ptr);
44333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44335         this_ptr_conv.is_owned = false;
44336         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44337         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44338         return ret_arr;
44339 }
44340
44341 void  CS_LDK_Splice_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
44342         LDKSplice this_ptr_conv;
44343         this_ptr_conv.inner = untag_ptr(this_ptr);
44344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44346         this_ptr_conv.is_owned = false;
44347         LDKPublicKey val_ref;
44348         CHECK(val->arr_len == 33);
44349         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44350         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
44351 }
44352
44353 int64_t  CS_LDK_Splice_new(int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
44354         LDKThirtyTwoBytes channel_id_arg_ref;
44355         CHECK(channel_id_arg->arr_len == 32);
44356         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44357         LDKThirtyTwoBytes chain_hash_arg_ref;
44358         CHECK(chain_hash_arg->arr_len == 32);
44359         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44360         LDKPublicKey funding_pubkey_arg_ref;
44361         CHECK(funding_pubkey_arg->arr_len == 33);
44362         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
44363         LDKSplice ret_var = Splice_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
44364         int64_t ret_ref = 0;
44365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44367         return ret_ref;
44368 }
44369
44370 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
44371         LDKSplice ret_var = Splice_clone(arg);
44372         int64_t ret_ref = 0;
44373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44375         return ret_ref;
44376 }
44377 int64_t  CS_LDK_Splice_clone_ptr(int64_t arg) {
44378         LDKSplice arg_conv;
44379         arg_conv.inner = untag_ptr(arg);
44380         arg_conv.is_owned = ptr_is_owned(arg);
44381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44382         arg_conv.is_owned = false;
44383         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
44384         return ret_conv;
44385 }
44386
44387 int64_t  CS_LDK_Splice_clone(int64_t orig) {
44388         LDKSplice orig_conv;
44389         orig_conv.inner = untag_ptr(orig);
44390         orig_conv.is_owned = ptr_is_owned(orig);
44391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44392         orig_conv.is_owned = false;
44393         LDKSplice ret_var = Splice_clone(&orig_conv);
44394         int64_t ret_ref = 0;
44395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44397         return ret_ref;
44398 }
44399
44400 jboolean  CS_LDK_Splice_eq(int64_t a, int64_t b) {
44401         LDKSplice a_conv;
44402         a_conv.inner = untag_ptr(a);
44403         a_conv.is_owned = ptr_is_owned(a);
44404         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44405         a_conv.is_owned = false;
44406         LDKSplice b_conv;
44407         b_conv.inner = untag_ptr(b);
44408         b_conv.is_owned = ptr_is_owned(b);
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44410         b_conv.is_owned = false;
44411         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
44412         return ret_conv;
44413 }
44414
44415 void  CS_LDK_SpliceAck_free(int64_t this_obj) {
44416         LDKSpliceAck this_obj_conv;
44417         this_obj_conv.inner = untag_ptr(this_obj);
44418         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44420         SpliceAck_free(this_obj_conv);
44421 }
44422
44423 int8_tArray  CS_LDK_SpliceAck_get_channel_id(int64_t this_ptr) {
44424         LDKSpliceAck this_ptr_conv;
44425         this_ptr_conv.inner = untag_ptr(this_ptr);
44426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44428         this_ptr_conv.is_owned = false;
44429         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44430         memcpy(ret_arr->elems, *SpliceAck_get_channel_id(&this_ptr_conv), 32);
44431         return ret_arr;
44432 }
44433
44434 void  CS_LDK_SpliceAck_set_channel_id(int64_t this_ptr, int8_tArray val) {
44435         LDKSpliceAck this_ptr_conv;
44436         this_ptr_conv.inner = untag_ptr(this_ptr);
44437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44439         this_ptr_conv.is_owned = false;
44440         LDKThirtyTwoBytes val_ref;
44441         CHECK(val->arr_len == 32);
44442         memcpy(val_ref.data, val->elems, 32); FREE(val);
44443         SpliceAck_set_channel_id(&this_ptr_conv, val_ref);
44444 }
44445
44446 int8_tArray  CS_LDK_SpliceAck_get_chain_hash(int64_t this_ptr) {
44447         LDKSpliceAck this_ptr_conv;
44448         this_ptr_conv.inner = untag_ptr(this_ptr);
44449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44451         this_ptr_conv.is_owned = false;
44452         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44453         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
44454         return ret_arr;
44455 }
44456
44457 void  CS_LDK_SpliceAck_set_chain_hash(int64_t this_ptr, int8_tArray val) {
44458         LDKSpliceAck this_ptr_conv;
44459         this_ptr_conv.inner = untag_ptr(this_ptr);
44460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44462         this_ptr_conv.is_owned = false;
44463         LDKThirtyTwoBytes val_ref;
44464         CHECK(val->arr_len == 32);
44465         memcpy(val_ref.data, val->elems, 32); FREE(val);
44466         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
44467 }
44468
44469 int64_t  CS_LDK_SpliceAck_get_relative_satoshis(int64_t this_ptr) {
44470         LDKSpliceAck this_ptr_conv;
44471         this_ptr_conv.inner = untag_ptr(this_ptr);
44472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44474         this_ptr_conv.is_owned = false;
44475         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
44476         return ret_conv;
44477 }
44478
44479 void  CS_LDK_SpliceAck_set_relative_satoshis(int64_t this_ptr, int64_t val) {
44480         LDKSpliceAck this_ptr_conv;
44481         this_ptr_conv.inner = untag_ptr(this_ptr);
44482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44484         this_ptr_conv.is_owned = false;
44485         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
44486 }
44487
44488 int8_tArray  CS_LDK_SpliceAck_get_funding_pubkey(int64_t this_ptr) {
44489         LDKSpliceAck this_ptr_conv;
44490         this_ptr_conv.inner = untag_ptr(this_ptr);
44491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44493         this_ptr_conv.is_owned = false;
44494         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44495         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44496         return ret_arr;
44497 }
44498
44499 void  CS_LDK_SpliceAck_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
44500         LDKSpliceAck this_ptr_conv;
44501         this_ptr_conv.inner = untag_ptr(this_ptr);
44502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44504         this_ptr_conv.is_owned = false;
44505         LDKPublicKey val_ref;
44506         CHECK(val->arr_len == 33);
44507         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44508         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
44509 }
44510
44511 int64_t  CS_LDK_SpliceAck_new(int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
44512         LDKThirtyTwoBytes channel_id_arg_ref;
44513         CHECK(channel_id_arg->arr_len == 32);
44514         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44515         LDKThirtyTwoBytes chain_hash_arg_ref;
44516         CHECK(chain_hash_arg->arr_len == 32);
44517         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44518         LDKPublicKey funding_pubkey_arg_ref;
44519         CHECK(funding_pubkey_arg->arr_len == 33);
44520         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
44521         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
44522         int64_t ret_ref = 0;
44523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44525         return ret_ref;
44526 }
44527
44528 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
44529         LDKSpliceAck ret_var = SpliceAck_clone(arg);
44530         int64_t ret_ref = 0;
44531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44533         return ret_ref;
44534 }
44535 int64_t  CS_LDK_SpliceAck_clone_ptr(int64_t arg) {
44536         LDKSpliceAck arg_conv;
44537         arg_conv.inner = untag_ptr(arg);
44538         arg_conv.is_owned = ptr_is_owned(arg);
44539         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44540         arg_conv.is_owned = false;
44541         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
44542         return ret_conv;
44543 }
44544
44545 int64_t  CS_LDK_SpliceAck_clone(int64_t orig) {
44546         LDKSpliceAck orig_conv;
44547         orig_conv.inner = untag_ptr(orig);
44548         orig_conv.is_owned = ptr_is_owned(orig);
44549         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44550         orig_conv.is_owned = false;
44551         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
44552         int64_t ret_ref = 0;
44553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44555         return ret_ref;
44556 }
44557
44558 jboolean  CS_LDK_SpliceAck_eq(int64_t a, int64_t b) {
44559         LDKSpliceAck a_conv;
44560         a_conv.inner = untag_ptr(a);
44561         a_conv.is_owned = ptr_is_owned(a);
44562         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44563         a_conv.is_owned = false;
44564         LDKSpliceAck b_conv;
44565         b_conv.inner = untag_ptr(b);
44566         b_conv.is_owned = ptr_is_owned(b);
44567         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44568         b_conv.is_owned = false;
44569         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
44570         return ret_conv;
44571 }
44572
44573 void  CS_LDK_SpliceLocked_free(int64_t this_obj) {
44574         LDKSpliceLocked this_obj_conv;
44575         this_obj_conv.inner = untag_ptr(this_obj);
44576         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44578         SpliceLocked_free(this_obj_conv);
44579 }
44580
44581 int8_tArray  CS_LDK_SpliceLocked_get_channel_id(int64_t this_ptr) {
44582         LDKSpliceLocked this_ptr_conv;
44583         this_ptr_conv.inner = untag_ptr(this_ptr);
44584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44586         this_ptr_conv.is_owned = false;
44587         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44588         memcpy(ret_arr->elems, *SpliceLocked_get_channel_id(&this_ptr_conv), 32);
44589         return ret_arr;
44590 }
44591
44592 void  CS_LDK_SpliceLocked_set_channel_id(int64_t this_ptr, int8_tArray val) {
44593         LDKSpliceLocked this_ptr_conv;
44594         this_ptr_conv.inner = untag_ptr(this_ptr);
44595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44597         this_ptr_conv.is_owned = false;
44598         LDKThirtyTwoBytes val_ref;
44599         CHECK(val->arr_len == 32);
44600         memcpy(val_ref.data, val->elems, 32); FREE(val);
44601         SpliceLocked_set_channel_id(&this_ptr_conv, val_ref);
44602 }
44603
44604 int64_t  CS_LDK_SpliceLocked_new(int8_tArray channel_id_arg) {
44605         LDKThirtyTwoBytes channel_id_arg_ref;
44606         CHECK(channel_id_arg->arr_len == 32);
44607         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44608         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_ref);
44609         int64_t ret_ref = 0;
44610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44612         return ret_ref;
44613 }
44614
44615 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
44616         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
44617         int64_t ret_ref = 0;
44618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44620         return ret_ref;
44621 }
44622 int64_t  CS_LDK_SpliceLocked_clone_ptr(int64_t arg) {
44623         LDKSpliceLocked arg_conv;
44624         arg_conv.inner = untag_ptr(arg);
44625         arg_conv.is_owned = ptr_is_owned(arg);
44626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44627         arg_conv.is_owned = false;
44628         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
44629         return ret_conv;
44630 }
44631
44632 int64_t  CS_LDK_SpliceLocked_clone(int64_t orig) {
44633         LDKSpliceLocked orig_conv;
44634         orig_conv.inner = untag_ptr(orig);
44635         orig_conv.is_owned = ptr_is_owned(orig);
44636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44637         orig_conv.is_owned = false;
44638         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
44639         int64_t ret_ref = 0;
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44642         return ret_ref;
44643 }
44644
44645 jboolean  CS_LDK_SpliceLocked_eq(int64_t a, int64_t b) {
44646         LDKSpliceLocked a_conv;
44647         a_conv.inner = untag_ptr(a);
44648         a_conv.is_owned = ptr_is_owned(a);
44649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44650         a_conv.is_owned = false;
44651         LDKSpliceLocked b_conv;
44652         b_conv.inner = untag_ptr(b);
44653         b_conv.is_owned = ptr_is_owned(b);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44655         b_conv.is_owned = false;
44656         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
44657         return ret_conv;
44658 }
44659
44660 void  CS_LDK_TxAddInput_free(int64_t this_obj) {
44661         LDKTxAddInput this_obj_conv;
44662         this_obj_conv.inner = untag_ptr(this_obj);
44663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44665         TxAddInput_free(this_obj_conv);
44666 }
44667
44668 int8_tArray  CS_LDK_TxAddInput_get_channel_id(int64_t this_ptr) {
44669         LDKTxAddInput this_ptr_conv;
44670         this_ptr_conv.inner = untag_ptr(this_ptr);
44671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44673         this_ptr_conv.is_owned = false;
44674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44675         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
44676         return ret_arr;
44677 }
44678
44679 void  CS_LDK_TxAddInput_set_channel_id(int64_t this_ptr, int8_tArray val) {
44680         LDKTxAddInput this_ptr_conv;
44681         this_ptr_conv.inner = untag_ptr(this_ptr);
44682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44684         this_ptr_conv.is_owned = false;
44685         LDKThirtyTwoBytes val_ref;
44686         CHECK(val->arr_len == 32);
44687         memcpy(val_ref.data, val->elems, 32); FREE(val);
44688         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
44689 }
44690
44691 int64_t  CS_LDK_TxAddInput_get_serial_id(int64_t this_ptr) {
44692         LDKTxAddInput this_ptr_conv;
44693         this_ptr_conv.inner = untag_ptr(this_ptr);
44694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44696         this_ptr_conv.is_owned = false;
44697         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
44698         return ret_conv;
44699 }
44700
44701 void  CS_LDK_TxAddInput_set_serial_id(int64_t this_ptr, int64_t val) {
44702         LDKTxAddInput this_ptr_conv;
44703         this_ptr_conv.inner = untag_ptr(this_ptr);
44704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44706         this_ptr_conv.is_owned = false;
44707         TxAddInput_set_serial_id(&this_ptr_conv, val);
44708 }
44709
44710 int64_t  CS_LDK_TxAddInput_get_prevtx(int64_t this_ptr) {
44711         LDKTxAddInput this_ptr_conv;
44712         this_ptr_conv.inner = untag_ptr(this_ptr);
44713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44715         this_ptr_conv.is_owned = false;
44716         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
44717         int64_t ret_ref = 0;
44718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44720         return ret_ref;
44721 }
44722
44723 void  CS_LDK_TxAddInput_set_prevtx(int64_t this_ptr, int64_t val) {
44724         LDKTxAddInput this_ptr_conv;
44725         this_ptr_conv.inner = untag_ptr(this_ptr);
44726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44728         this_ptr_conv.is_owned = false;
44729         LDKTransactionU16LenLimited val_conv;
44730         val_conv.inner = untag_ptr(val);
44731         val_conv.is_owned = ptr_is_owned(val);
44732         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44733         val_conv = TransactionU16LenLimited_clone(&val_conv);
44734         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
44735 }
44736
44737 int32_t  CS_LDK_TxAddInput_get_prevtx_out(int64_t this_ptr) {
44738         LDKTxAddInput this_ptr_conv;
44739         this_ptr_conv.inner = untag_ptr(this_ptr);
44740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44742         this_ptr_conv.is_owned = false;
44743         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
44744         return ret_conv;
44745 }
44746
44747 void  CS_LDK_TxAddInput_set_prevtx_out(int64_t this_ptr, int32_t val) {
44748         LDKTxAddInput this_ptr_conv;
44749         this_ptr_conv.inner = untag_ptr(this_ptr);
44750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44752         this_ptr_conv.is_owned = false;
44753         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
44754 }
44755
44756 int32_t  CS_LDK_TxAddInput_get_sequence(int64_t this_ptr) {
44757         LDKTxAddInput this_ptr_conv;
44758         this_ptr_conv.inner = untag_ptr(this_ptr);
44759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44761         this_ptr_conv.is_owned = false;
44762         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
44763         return ret_conv;
44764 }
44765
44766 void  CS_LDK_TxAddInput_set_sequence(int64_t this_ptr, int32_t val) {
44767         LDKTxAddInput this_ptr_conv;
44768         this_ptr_conv.inner = untag_ptr(this_ptr);
44769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44771         this_ptr_conv.is_owned = false;
44772         TxAddInput_set_sequence(&this_ptr_conv, val);
44773 }
44774
44775 int64_t  CS_LDK_TxAddInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
44776         LDKThirtyTwoBytes channel_id_arg_ref;
44777         CHECK(channel_id_arg->arr_len == 32);
44778         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44779         LDKTransactionU16LenLimited prevtx_arg_conv;
44780         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
44781         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
44782         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
44783         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
44784         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
44785         int64_t ret_ref = 0;
44786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44788         return ret_ref;
44789 }
44790
44791 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
44792         LDKTxAddInput ret_var = TxAddInput_clone(arg);
44793         int64_t ret_ref = 0;
44794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44796         return ret_ref;
44797 }
44798 int64_t  CS_LDK_TxAddInput_clone_ptr(int64_t arg) {
44799         LDKTxAddInput arg_conv;
44800         arg_conv.inner = untag_ptr(arg);
44801         arg_conv.is_owned = ptr_is_owned(arg);
44802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44803         arg_conv.is_owned = false;
44804         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
44805         return ret_conv;
44806 }
44807
44808 int64_t  CS_LDK_TxAddInput_clone(int64_t orig) {
44809         LDKTxAddInput orig_conv;
44810         orig_conv.inner = untag_ptr(orig);
44811         orig_conv.is_owned = ptr_is_owned(orig);
44812         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44813         orig_conv.is_owned = false;
44814         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
44815         int64_t ret_ref = 0;
44816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44818         return ret_ref;
44819 }
44820
44821 int64_t  CS_LDK_TxAddInput_hash(int64_t o) {
44822         LDKTxAddInput o_conv;
44823         o_conv.inner = untag_ptr(o);
44824         o_conv.is_owned = ptr_is_owned(o);
44825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44826         o_conv.is_owned = false;
44827         int64_t ret_conv = TxAddInput_hash(&o_conv);
44828         return ret_conv;
44829 }
44830
44831 jboolean  CS_LDK_TxAddInput_eq(int64_t a, int64_t b) {
44832         LDKTxAddInput a_conv;
44833         a_conv.inner = untag_ptr(a);
44834         a_conv.is_owned = ptr_is_owned(a);
44835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44836         a_conv.is_owned = false;
44837         LDKTxAddInput b_conv;
44838         b_conv.inner = untag_ptr(b);
44839         b_conv.is_owned = ptr_is_owned(b);
44840         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44841         b_conv.is_owned = false;
44842         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
44843         return ret_conv;
44844 }
44845
44846 void  CS_LDK_TxAddOutput_free(int64_t this_obj) {
44847         LDKTxAddOutput this_obj_conv;
44848         this_obj_conv.inner = untag_ptr(this_obj);
44849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44851         TxAddOutput_free(this_obj_conv);
44852 }
44853
44854 int8_tArray  CS_LDK_TxAddOutput_get_channel_id(int64_t this_ptr) {
44855         LDKTxAddOutput this_ptr_conv;
44856         this_ptr_conv.inner = untag_ptr(this_ptr);
44857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44859         this_ptr_conv.is_owned = false;
44860         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44861         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
44862         return ret_arr;
44863 }
44864
44865 void  CS_LDK_TxAddOutput_set_channel_id(int64_t this_ptr, int8_tArray val) {
44866         LDKTxAddOutput this_ptr_conv;
44867         this_ptr_conv.inner = untag_ptr(this_ptr);
44868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44870         this_ptr_conv.is_owned = false;
44871         LDKThirtyTwoBytes val_ref;
44872         CHECK(val->arr_len == 32);
44873         memcpy(val_ref.data, val->elems, 32); FREE(val);
44874         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
44875 }
44876
44877 int64_t  CS_LDK_TxAddOutput_get_serial_id(int64_t this_ptr) {
44878         LDKTxAddOutput this_ptr_conv;
44879         this_ptr_conv.inner = untag_ptr(this_ptr);
44880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44882         this_ptr_conv.is_owned = false;
44883         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
44884         return ret_conv;
44885 }
44886
44887 void  CS_LDK_TxAddOutput_set_serial_id(int64_t this_ptr, int64_t val) {
44888         LDKTxAddOutput this_ptr_conv;
44889         this_ptr_conv.inner = untag_ptr(this_ptr);
44890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44892         this_ptr_conv.is_owned = false;
44893         TxAddOutput_set_serial_id(&this_ptr_conv, val);
44894 }
44895
44896 int64_t  CS_LDK_TxAddOutput_get_sats(int64_t this_ptr) {
44897         LDKTxAddOutput this_ptr_conv;
44898         this_ptr_conv.inner = untag_ptr(this_ptr);
44899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44901         this_ptr_conv.is_owned = false;
44902         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
44903         return ret_conv;
44904 }
44905
44906 void  CS_LDK_TxAddOutput_set_sats(int64_t this_ptr, int64_t val) {
44907         LDKTxAddOutput this_ptr_conv;
44908         this_ptr_conv.inner = untag_ptr(this_ptr);
44909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44911         this_ptr_conv.is_owned = false;
44912         TxAddOutput_set_sats(&this_ptr_conv, val);
44913 }
44914
44915 int8_tArray  CS_LDK_TxAddOutput_get_script(int64_t this_ptr) {
44916         LDKTxAddOutput this_ptr_conv;
44917         this_ptr_conv.inner = untag_ptr(this_ptr);
44918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44920         this_ptr_conv.is_owned = false;
44921         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
44922         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44923         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44924         CVec_u8Z_free(ret_var);
44925         return ret_arr;
44926 }
44927
44928 void  CS_LDK_TxAddOutput_set_script(int64_t this_ptr, int8_tArray val) {
44929         LDKTxAddOutput this_ptr_conv;
44930         this_ptr_conv.inner = untag_ptr(this_ptr);
44931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44933         this_ptr_conv.is_owned = false;
44934         LDKCVec_u8Z val_ref;
44935         val_ref.datalen = val->arr_len;
44936         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44937         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
44938         TxAddOutput_set_script(&this_ptr_conv, val_ref);
44939 }
44940
44941 int64_t  CS_LDK_TxAddOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
44942         LDKThirtyTwoBytes channel_id_arg_ref;
44943         CHECK(channel_id_arg->arr_len == 32);
44944         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44945         LDKCVec_u8Z script_arg_ref;
44946         script_arg_ref.datalen = script_arg->arr_len;
44947         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44948         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
44949         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
44950         int64_t ret_ref = 0;
44951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44953         return ret_ref;
44954 }
44955
44956 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
44957         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
44958         int64_t ret_ref = 0;
44959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44961         return ret_ref;
44962 }
44963 int64_t  CS_LDK_TxAddOutput_clone_ptr(int64_t arg) {
44964         LDKTxAddOutput arg_conv;
44965         arg_conv.inner = untag_ptr(arg);
44966         arg_conv.is_owned = ptr_is_owned(arg);
44967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44968         arg_conv.is_owned = false;
44969         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
44970         return ret_conv;
44971 }
44972
44973 int64_t  CS_LDK_TxAddOutput_clone(int64_t orig) {
44974         LDKTxAddOutput orig_conv;
44975         orig_conv.inner = untag_ptr(orig);
44976         orig_conv.is_owned = ptr_is_owned(orig);
44977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44978         orig_conv.is_owned = false;
44979         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
44980         int64_t ret_ref = 0;
44981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44983         return ret_ref;
44984 }
44985
44986 int64_t  CS_LDK_TxAddOutput_hash(int64_t o) {
44987         LDKTxAddOutput o_conv;
44988         o_conv.inner = untag_ptr(o);
44989         o_conv.is_owned = ptr_is_owned(o);
44990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44991         o_conv.is_owned = false;
44992         int64_t ret_conv = TxAddOutput_hash(&o_conv);
44993         return ret_conv;
44994 }
44995
44996 jboolean  CS_LDK_TxAddOutput_eq(int64_t a, int64_t b) {
44997         LDKTxAddOutput a_conv;
44998         a_conv.inner = untag_ptr(a);
44999         a_conv.is_owned = ptr_is_owned(a);
45000         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45001         a_conv.is_owned = false;
45002         LDKTxAddOutput b_conv;
45003         b_conv.inner = untag_ptr(b);
45004         b_conv.is_owned = ptr_is_owned(b);
45005         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45006         b_conv.is_owned = false;
45007         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
45008         return ret_conv;
45009 }
45010
45011 void  CS_LDK_TxRemoveInput_free(int64_t this_obj) {
45012         LDKTxRemoveInput this_obj_conv;
45013         this_obj_conv.inner = untag_ptr(this_obj);
45014         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45016         TxRemoveInput_free(this_obj_conv);
45017 }
45018
45019 int8_tArray  CS_LDK_TxRemoveInput_get_channel_id(int64_t this_ptr) {
45020         LDKTxRemoveInput this_ptr_conv;
45021         this_ptr_conv.inner = untag_ptr(this_ptr);
45022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45024         this_ptr_conv.is_owned = false;
45025         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45026         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
45027         return ret_arr;
45028 }
45029
45030 void  CS_LDK_TxRemoveInput_set_channel_id(int64_t this_ptr, int8_tArray val) {
45031         LDKTxRemoveInput this_ptr_conv;
45032         this_ptr_conv.inner = untag_ptr(this_ptr);
45033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45035         this_ptr_conv.is_owned = false;
45036         LDKThirtyTwoBytes val_ref;
45037         CHECK(val->arr_len == 32);
45038         memcpy(val_ref.data, val->elems, 32); FREE(val);
45039         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
45040 }
45041
45042 int64_t  CS_LDK_TxRemoveInput_get_serial_id(int64_t this_ptr) {
45043         LDKTxRemoveInput this_ptr_conv;
45044         this_ptr_conv.inner = untag_ptr(this_ptr);
45045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45047         this_ptr_conv.is_owned = false;
45048         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
45049         return ret_conv;
45050 }
45051
45052 void  CS_LDK_TxRemoveInput_set_serial_id(int64_t this_ptr, int64_t val) {
45053         LDKTxRemoveInput this_ptr_conv;
45054         this_ptr_conv.inner = untag_ptr(this_ptr);
45055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45057         this_ptr_conv.is_owned = false;
45058         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
45059 }
45060
45061 int64_t  CS_LDK_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
45062         LDKThirtyTwoBytes channel_id_arg_ref;
45063         CHECK(channel_id_arg->arr_len == 32);
45064         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45065         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
45066         int64_t ret_ref = 0;
45067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45069         return ret_ref;
45070 }
45071
45072 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
45073         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
45074         int64_t ret_ref = 0;
45075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45077         return ret_ref;
45078 }
45079 int64_t  CS_LDK_TxRemoveInput_clone_ptr(int64_t arg) {
45080         LDKTxRemoveInput arg_conv;
45081         arg_conv.inner = untag_ptr(arg);
45082         arg_conv.is_owned = ptr_is_owned(arg);
45083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45084         arg_conv.is_owned = false;
45085         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
45086         return ret_conv;
45087 }
45088
45089 int64_t  CS_LDK_TxRemoveInput_clone(int64_t orig) {
45090         LDKTxRemoveInput orig_conv;
45091         orig_conv.inner = untag_ptr(orig);
45092         orig_conv.is_owned = ptr_is_owned(orig);
45093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45094         orig_conv.is_owned = false;
45095         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
45096         int64_t ret_ref = 0;
45097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45099         return ret_ref;
45100 }
45101
45102 int64_t  CS_LDK_TxRemoveInput_hash(int64_t o) {
45103         LDKTxRemoveInput o_conv;
45104         o_conv.inner = untag_ptr(o);
45105         o_conv.is_owned = ptr_is_owned(o);
45106         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45107         o_conv.is_owned = false;
45108         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
45109         return ret_conv;
45110 }
45111
45112 jboolean  CS_LDK_TxRemoveInput_eq(int64_t a, int64_t b) {
45113         LDKTxRemoveInput a_conv;
45114         a_conv.inner = untag_ptr(a);
45115         a_conv.is_owned = ptr_is_owned(a);
45116         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45117         a_conv.is_owned = false;
45118         LDKTxRemoveInput b_conv;
45119         b_conv.inner = untag_ptr(b);
45120         b_conv.is_owned = ptr_is_owned(b);
45121         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45122         b_conv.is_owned = false;
45123         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
45124         return ret_conv;
45125 }
45126
45127 void  CS_LDK_TxRemoveOutput_free(int64_t this_obj) {
45128         LDKTxRemoveOutput this_obj_conv;
45129         this_obj_conv.inner = untag_ptr(this_obj);
45130         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45132         TxRemoveOutput_free(this_obj_conv);
45133 }
45134
45135 int8_tArray  CS_LDK_TxRemoveOutput_get_channel_id(int64_t this_ptr) {
45136         LDKTxRemoveOutput this_ptr_conv;
45137         this_ptr_conv.inner = untag_ptr(this_ptr);
45138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45140         this_ptr_conv.is_owned = false;
45141         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45142         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
45143         return ret_arr;
45144 }
45145
45146 void  CS_LDK_TxRemoveOutput_set_channel_id(int64_t this_ptr, int8_tArray val) {
45147         LDKTxRemoveOutput this_ptr_conv;
45148         this_ptr_conv.inner = untag_ptr(this_ptr);
45149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45151         this_ptr_conv.is_owned = false;
45152         LDKThirtyTwoBytes val_ref;
45153         CHECK(val->arr_len == 32);
45154         memcpy(val_ref.data, val->elems, 32); FREE(val);
45155         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
45156 }
45157
45158 int64_t  CS_LDK_TxRemoveOutput_get_serial_id(int64_t this_ptr) {
45159         LDKTxRemoveOutput this_ptr_conv;
45160         this_ptr_conv.inner = untag_ptr(this_ptr);
45161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45163         this_ptr_conv.is_owned = false;
45164         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
45165         return ret_conv;
45166 }
45167
45168 void  CS_LDK_TxRemoveOutput_set_serial_id(int64_t this_ptr, int64_t val) {
45169         LDKTxRemoveOutput this_ptr_conv;
45170         this_ptr_conv.inner = untag_ptr(this_ptr);
45171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45173         this_ptr_conv.is_owned = false;
45174         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
45175 }
45176
45177 int64_t  CS_LDK_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
45178         LDKThirtyTwoBytes channel_id_arg_ref;
45179         CHECK(channel_id_arg->arr_len == 32);
45180         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45181         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
45182         int64_t ret_ref = 0;
45183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45185         return ret_ref;
45186 }
45187
45188 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
45189         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
45190         int64_t ret_ref = 0;
45191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45193         return ret_ref;
45194 }
45195 int64_t  CS_LDK_TxRemoveOutput_clone_ptr(int64_t arg) {
45196         LDKTxRemoveOutput arg_conv;
45197         arg_conv.inner = untag_ptr(arg);
45198         arg_conv.is_owned = ptr_is_owned(arg);
45199         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45200         arg_conv.is_owned = false;
45201         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
45202         return ret_conv;
45203 }
45204
45205 int64_t  CS_LDK_TxRemoveOutput_clone(int64_t orig) {
45206         LDKTxRemoveOutput orig_conv;
45207         orig_conv.inner = untag_ptr(orig);
45208         orig_conv.is_owned = ptr_is_owned(orig);
45209         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45210         orig_conv.is_owned = false;
45211         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
45212         int64_t ret_ref = 0;
45213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45215         return ret_ref;
45216 }
45217
45218 int64_t  CS_LDK_TxRemoveOutput_hash(int64_t o) {
45219         LDKTxRemoveOutput o_conv;
45220         o_conv.inner = untag_ptr(o);
45221         o_conv.is_owned = ptr_is_owned(o);
45222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45223         o_conv.is_owned = false;
45224         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
45225         return ret_conv;
45226 }
45227
45228 jboolean  CS_LDK_TxRemoveOutput_eq(int64_t a, int64_t b) {
45229         LDKTxRemoveOutput a_conv;
45230         a_conv.inner = untag_ptr(a);
45231         a_conv.is_owned = ptr_is_owned(a);
45232         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45233         a_conv.is_owned = false;
45234         LDKTxRemoveOutput b_conv;
45235         b_conv.inner = untag_ptr(b);
45236         b_conv.is_owned = ptr_is_owned(b);
45237         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45238         b_conv.is_owned = false;
45239         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
45240         return ret_conv;
45241 }
45242
45243 void  CS_LDK_TxComplete_free(int64_t this_obj) {
45244         LDKTxComplete this_obj_conv;
45245         this_obj_conv.inner = untag_ptr(this_obj);
45246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45248         TxComplete_free(this_obj_conv);
45249 }
45250
45251 int8_tArray  CS_LDK_TxComplete_get_channel_id(int64_t this_ptr) {
45252         LDKTxComplete this_ptr_conv;
45253         this_ptr_conv.inner = untag_ptr(this_ptr);
45254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45256         this_ptr_conv.is_owned = false;
45257         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45258         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
45259         return ret_arr;
45260 }
45261
45262 void  CS_LDK_TxComplete_set_channel_id(int64_t this_ptr, int8_tArray val) {
45263         LDKTxComplete this_ptr_conv;
45264         this_ptr_conv.inner = untag_ptr(this_ptr);
45265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45267         this_ptr_conv.is_owned = false;
45268         LDKThirtyTwoBytes val_ref;
45269         CHECK(val->arr_len == 32);
45270         memcpy(val_ref.data, val->elems, 32); FREE(val);
45271         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
45272 }
45273
45274 int64_t  CS_LDK_TxComplete_new(int8_tArray channel_id_arg) {
45275         LDKThirtyTwoBytes channel_id_arg_ref;
45276         CHECK(channel_id_arg->arr_len == 32);
45277         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45278         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
45279         int64_t ret_ref = 0;
45280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45282         return ret_ref;
45283 }
45284
45285 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
45286         LDKTxComplete ret_var = TxComplete_clone(arg);
45287         int64_t ret_ref = 0;
45288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45290         return ret_ref;
45291 }
45292 int64_t  CS_LDK_TxComplete_clone_ptr(int64_t arg) {
45293         LDKTxComplete arg_conv;
45294         arg_conv.inner = untag_ptr(arg);
45295         arg_conv.is_owned = ptr_is_owned(arg);
45296         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45297         arg_conv.is_owned = false;
45298         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
45299         return ret_conv;
45300 }
45301
45302 int64_t  CS_LDK_TxComplete_clone(int64_t orig) {
45303         LDKTxComplete orig_conv;
45304         orig_conv.inner = untag_ptr(orig);
45305         orig_conv.is_owned = ptr_is_owned(orig);
45306         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45307         orig_conv.is_owned = false;
45308         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
45309         int64_t ret_ref = 0;
45310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45312         return ret_ref;
45313 }
45314
45315 int64_t  CS_LDK_TxComplete_hash(int64_t o) {
45316         LDKTxComplete o_conv;
45317         o_conv.inner = untag_ptr(o);
45318         o_conv.is_owned = ptr_is_owned(o);
45319         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45320         o_conv.is_owned = false;
45321         int64_t ret_conv = TxComplete_hash(&o_conv);
45322         return ret_conv;
45323 }
45324
45325 jboolean  CS_LDK_TxComplete_eq(int64_t a, int64_t b) {
45326         LDKTxComplete a_conv;
45327         a_conv.inner = untag_ptr(a);
45328         a_conv.is_owned = ptr_is_owned(a);
45329         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45330         a_conv.is_owned = false;
45331         LDKTxComplete b_conv;
45332         b_conv.inner = untag_ptr(b);
45333         b_conv.is_owned = ptr_is_owned(b);
45334         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45335         b_conv.is_owned = false;
45336         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
45337         return ret_conv;
45338 }
45339
45340 void  CS_LDK_TxSignatures_free(int64_t this_obj) {
45341         LDKTxSignatures this_obj_conv;
45342         this_obj_conv.inner = untag_ptr(this_obj);
45343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45345         TxSignatures_free(this_obj_conv);
45346 }
45347
45348 int8_tArray  CS_LDK_TxSignatures_get_channel_id(int64_t this_ptr) {
45349         LDKTxSignatures this_ptr_conv;
45350         this_ptr_conv.inner = untag_ptr(this_ptr);
45351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45353         this_ptr_conv.is_owned = false;
45354         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45355         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
45356         return ret_arr;
45357 }
45358
45359 void  CS_LDK_TxSignatures_set_channel_id(int64_t this_ptr, int8_tArray val) {
45360         LDKTxSignatures this_ptr_conv;
45361         this_ptr_conv.inner = untag_ptr(this_ptr);
45362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45364         this_ptr_conv.is_owned = false;
45365         LDKThirtyTwoBytes val_ref;
45366         CHECK(val->arr_len == 32);
45367         memcpy(val_ref.data, val->elems, 32); FREE(val);
45368         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
45369 }
45370
45371 int8_tArray  CS_LDK_TxSignatures_get_tx_hash(int64_t this_ptr) {
45372         LDKTxSignatures this_ptr_conv;
45373         this_ptr_conv.inner = untag_ptr(this_ptr);
45374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45376         this_ptr_conv.is_owned = false;
45377         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45378         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
45379         return ret_arr;
45380 }
45381
45382 void  CS_LDK_TxSignatures_set_tx_hash(int64_t this_ptr, int8_tArray val) {
45383         LDKTxSignatures this_ptr_conv;
45384         this_ptr_conv.inner = untag_ptr(this_ptr);
45385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45387         this_ptr_conv.is_owned = false;
45388         LDKThirtyTwoBytes val_ref;
45389         CHECK(val->arr_len == 32);
45390         memcpy(val_ref.data, val->elems, 32); FREE(val);
45391         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
45392 }
45393
45394 ptrArray  CS_LDK_TxSignatures_get_witnesses(int64_t this_ptr) {
45395         LDKTxSignatures this_ptr_conv;
45396         this_ptr_conv.inner = untag_ptr(this_ptr);
45397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45399         this_ptr_conv.is_owned = false;
45400         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45401         ptrArray ret_arr = NULL;
45402         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
45403         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
45404         for (size_t i = 0; i < ret_var.datalen; i++) {
45405                 LDKWitness ret_conv_8_var = ret_var.data[i];
45406                 int8_tArray ret_conv_8_arr = init_int8_tArray(ret_conv_8_var.datalen, __LINE__);
45407                 memcpy(ret_conv_8_arr->elems, ret_conv_8_var.data, ret_conv_8_var.datalen);
45408                 Witness_free(ret_conv_8_var);
45409                 ret_arr_ptr[i] = ret_conv_8_arr;
45410         }
45411         
45412         FREE(ret_var.data);
45413         return ret_arr;
45414 }
45415
45416 void  CS_LDK_TxSignatures_set_witnesses(int64_t this_ptr, ptrArray val) {
45417         LDKTxSignatures this_ptr_conv;
45418         this_ptr_conv.inner = untag_ptr(this_ptr);
45419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45421         this_ptr_conv.is_owned = false;
45422         LDKCVec_WitnessZ val_constr;
45423         val_constr.datalen = val->arr_len;
45424         if (val_constr.datalen > 0)
45425                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45426         else
45427                 val_constr.data = NULL;
45428         int8_tArray* val_vals = (void*) val->elems;
45429         for (size_t i = 0; i < val_constr.datalen; i++) {
45430                 int8_tArray val_conv_8 = val_vals[i];
45431                 LDKWitness val_conv_8_ref;
45432                 val_conv_8_ref.datalen = val_conv_8->arr_len;
45433                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
45434                 memcpy(val_conv_8_ref.data, val_conv_8->elems, val_conv_8_ref.datalen); FREE(val_conv_8);
45435                 val_conv_8_ref.data_is_owned = true;
45436                 val_constr.data[i] = val_conv_8_ref;
45437         }
45438         FREE(val);
45439         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
45440 }
45441
45442 int64_t  CS_LDK_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
45443         LDKThirtyTwoBytes channel_id_arg_ref;
45444         CHECK(channel_id_arg->arr_len == 32);
45445         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45446         LDKThirtyTwoBytes tx_hash_arg_ref;
45447         CHECK(tx_hash_arg->arr_len == 32);
45448         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
45449         LDKCVec_WitnessZ witnesses_arg_constr;
45450         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
45451         if (witnesses_arg_constr.datalen > 0)
45452                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45453         else
45454                 witnesses_arg_constr.data = NULL;
45455         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
45456         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
45457                 int8_tArray witnesses_arg_conv_8 = witnesses_arg_vals[i];
45458                 LDKWitness witnesses_arg_conv_8_ref;
45459                 witnesses_arg_conv_8_ref.datalen = witnesses_arg_conv_8->arr_len;
45460                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
45461                 memcpy(witnesses_arg_conv_8_ref.data, witnesses_arg_conv_8->elems, witnesses_arg_conv_8_ref.datalen); FREE(witnesses_arg_conv_8);
45462                 witnesses_arg_conv_8_ref.data_is_owned = true;
45463                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
45464         }
45465         FREE(witnesses_arg);
45466         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
45467         int64_t ret_ref = 0;
45468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45470         return ret_ref;
45471 }
45472
45473 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
45474         LDKTxSignatures ret_var = TxSignatures_clone(arg);
45475         int64_t ret_ref = 0;
45476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45478         return ret_ref;
45479 }
45480 int64_t  CS_LDK_TxSignatures_clone_ptr(int64_t arg) {
45481         LDKTxSignatures arg_conv;
45482         arg_conv.inner = untag_ptr(arg);
45483         arg_conv.is_owned = ptr_is_owned(arg);
45484         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45485         arg_conv.is_owned = false;
45486         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
45487         return ret_conv;
45488 }
45489
45490 int64_t  CS_LDK_TxSignatures_clone(int64_t orig) {
45491         LDKTxSignatures orig_conv;
45492         orig_conv.inner = untag_ptr(orig);
45493         orig_conv.is_owned = ptr_is_owned(orig);
45494         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45495         orig_conv.is_owned = false;
45496         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
45497         int64_t ret_ref = 0;
45498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45500         return ret_ref;
45501 }
45502
45503 int64_t  CS_LDK_TxSignatures_hash(int64_t o) {
45504         LDKTxSignatures o_conv;
45505         o_conv.inner = untag_ptr(o);
45506         o_conv.is_owned = ptr_is_owned(o);
45507         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45508         o_conv.is_owned = false;
45509         int64_t ret_conv = TxSignatures_hash(&o_conv);
45510         return ret_conv;
45511 }
45512
45513 jboolean  CS_LDK_TxSignatures_eq(int64_t a, int64_t b) {
45514         LDKTxSignatures a_conv;
45515         a_conv.inner = untag_ptr(a);
45516         a_conv.is_owned = ptr_is_owned(a);
45517         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45518         a_conv.is_owned = false;
45519         LDKTxSignatures b_conv;
45520         b_conv.inner = untag_ptr(b);
45521         b_conv.is_owned = ptr_is_owned(b);
45522         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45523         b_conv.is_owned = false;
45524         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
45525         return ret_conv;
45526 }
45527
45528 void  CS_LDK_TxInitRbf_free(int64_t this_obj) {
45529         LDKTxInitRbf this_obj_conv;
45530         this_obj_conv.inner = untag_ptr(this_obj);
45531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45533         TxInitRbf_free(this_obj_conv);
45534 }
45535
45536 int8_tArray  CS_LDK_TxInitRbf_get_channel_id(int64_t this_ptr) {
45537         LDKTxInitRbf this_ptr_conv;
45538         this_ptr_conv.inner = untag_ptr(this_ptr);
45539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45541         this_ptr_conv.is_owned = false;
45542         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45543         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
45544         return ret_arr;
45545 }
45546
45547 void  CS_LDK_TxInitRbf_set_channel_id(int64_t this_ptr, int8_tArray val) {
45548         LDKTxInitRbf this_ptr_conv;
45549         this_ptr_conv.inner = untag_ptr(this_ptr);
45550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45552         this_ptr_conv.is_owned = false;
45553         LDKThirtyTwoBytes val_ref;
45554         CHECK(val->arr_len == 32);
45555         memcpy(val_ref.data, val->elems, 32); FREE(val);
45556         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
45557 }
45558
45559 int32_t  CS_LDK_TxInitRbf_get_locktime(int64_t this_ptr) {
45560         LDKTxInitRbf this_ptr_conv;
45561         this_ptr_conv.inner = untag_ptr(this_ptr);
45562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45564         this_ptr_conv.is_owned = false;
45565         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
45566         return ret_conv;
45567 }
45568
45569 void  CS_LDK_TxInitRbf_set_locktime(int64_t this_ptr, int32_t val) {
45570         LDKTxInitRbf this_ptr_conv;
45571         this_ptr_conv.inner = untag_ptr(this_ptr);
45572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45574         this_ptr_conv.is_owned = false;
45575         TxInitRbf_set_locktime(&this_ptr_conv, val);
45576 }
45577
45578 int32_t  CS_LDK_TxInitRbf_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
45579         LDKTxInitRbf this_ptr_conv;
45580         this_ptr_conv.inner = untag_ptr(this_ptr);
45581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45583         this_ptr_conv.is_owned = false;
45584         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45585         return ret_conv;
45586 }
45587
45588 void  CS_LDK_TxInitRbf_set_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
45589         LDKTxInitRbf this_ptr_conv;
45590         this_ptr_conv.inner = untag_ptr(this_ptr);
45591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45593         this_ptr_conv.is_owned = false;
45594         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45595 }
45596
45597 int64_t  CS_LDK_TxInitRbf_get_funding_output_contribution(int64_t this_ptr) {
45598         LDKTxInitRbf this_ptr_conv;
45599         this_ptr_conv.inner = untag_ptr(this_ptr);
45600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45602         this_ptr_conv.is_owned = false;
45603         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45604         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
45605         int64_t ret_ref = tag_ptr(ret_copy, true);
45606         return ret_ref;
45607 }
45608
45609 void  CS_LDK_TxInitRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
45610         LDKTxInitRbf this_ptr_conv;
45611         this_ptr_conv.inner = untag_ptr(this_ptr);
45612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45614         this_ptr_conv.is_owned = false;
45615         void* val_ptr = untag_ptr(val);
45616         CHECK_ACCESS(val_ptr);
45617         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45618         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45619         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45620 }
45621
45622 int64_t  CS_LDK_TxInitRbf_new(int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
45623         LDKThirtyTwoBytes channel_id_arg_ref;
45624         CHECK(channel_id_arg->arr_len == 32);
45625         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45626         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45627         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45628         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45629         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45630         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
45631         int64_t ret_ref = 0;
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45634         return ret_ref;
45635 }
45636
45637 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
45638         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
45639         int64_t ret_ref = 0;
45640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45642         return ret_ref;
45643 }
45644 int64_t  CS_LDK_TxInitRbf_clone_ptr(int64_t arg) {
45645         LDKTxInitRbf arg_conv;
45646         arg_conv.inner = untag_ptr(arg);
45647         arg_conv.is_owned = ptr_is_owned(arg);
45648         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45649         arg_conv.is_owned = false;
45650         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
45651         return ret_conv;
45652 }
45653
45654 int64_t  CS_LDK_TxInitRbf_clone(int64_t orig) {
45655         LDKTxInitRbf orig_conv;
45656         orig_conv.inner = untag_ptr(orig);
45657         orig_conv.is_owned = ptr_is_owned(orig);
45658         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45659         orig_conv.is_owned = false;
45660         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
45661         int64_t ret_ref = 0;
45662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45664         return ret_ref;
45665 }
45666
45667 int64_t  CS_LDK_TxInitRbf_hash(int64_t o) {
45668         LDKTxInitRbf o_conv;
45669         o_conv.inner = untag_ptr(o);
45670         o_conv.is_owned = ptr_is_owned(o);
45671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45672         o_conv.is_owned = false;
45673         int64_t ret_conv = TxInitRbf_hash(&o_conv);
45674         return ret_conv;
45675 }
45676
45677 jboolean  CS_LDK_TxInitRbf_eq(int64_t a, int64_t b) {
45678         LDKTxInitRbf a_conv;
45679         a_conv.inner = untag_ptr(a);
45680         a_conv.is_owned = ptr_is_owned(a);
45681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45682         a_conv.is_owned = false;
45683         LDKTxInitRbf b_conv;
45684         b_conv.inner = untag_ptr(b);
45685         b_conv.is_owned = ptr_is_owned(b);
45686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45687         b_conv.is_owned = false;
45688         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
45689         return ret_conv;
45690 }
45691
45692 void  CS_LDK_TxAckRbf_free(int64_t this_obj) {
45693         LDKTxAckRbf this_obj_conv;
45694         this_obj_conv.inner = untag_ptr(this_obj);
45695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45697         TxAckRbf_free(this_obj_conv);
45698 }
45699
45700 int8_tArray  CS_LDK_TxAckRbf_get_channel_id(int64_t this_ptr) {
45701         LDKTxAckRbf this_ptr_conv;
45702         this_ptr_conv.inner = untag_ptr(this_ptr);
45703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45705         this_ptr_conv.is_owned = false;
45706         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45707         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
45708         return ret_arr;
45709 }
45710
45711 void  CS_LDK_TxAckRbf_set_channel_id(int64_t this_ptr, int8_tArray val) {
45712         LDKTxAckRbf this_ptr_conv;
45713         this_ptr_conv.inner = untag_ptr(this_ptr);
45714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45716         this_ptr_conv.is_owned = false;
45717         LDKThirtyTwoBytes val_ref;
45718         CHECK(val->arr_len == 32);
45719         memcpy(val_ref.data, val->elems, 32); FREE(val);
45720         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
45721 }
45722
45723 int64_t  CS_LDK_TxAckRbf_get_funding_output_contribution(int64_t this_ptr) {
45724         LDKTxAckRbf this_ptr_conv;
45725         this_ptr_conv.inner = untag_ptr(this_ptr);
45726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45728         this_ptr_conv.is_owned = false;
45729         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45730         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
45731         int64_t ret_ref = tag_ptr(ret_copy, true);
45732         return ret_ref;
45733 }
45734
45735 void  CS_LDK_TxAckRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
45736         LDKTxAckRbf this_ptr_conv;
45737         this_ptr_conv.inner = untag_ptr(this_ptr);
45738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45740         this_ptr_conv.is_owned = false;
45741         void* val_ptr = untag_ptr(val);
45742         CHECK_ACCESS(val_ptr);
45743         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45744         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45745         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45746 }
45747
45748 int64_t  CS_LDK_TxAckRbf_new(int8_tArray channel_id_arg, int64_t funding_output_contribution_arg) {
45749         LDKThirtyTwoBytes channel_id_arg_ref;
45750         CHECK(channel_id_arg->arr_len == 32);
45751         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45752         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45753         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45754         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45755         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45756         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
45757         int64_t ret_ref = 0;
45758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45760         return ret_ref;
45761 }
45762
45763 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
45764         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
45765         int64_t ret_ref = 0;
45766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45768         return ret_ref;
45769 }
45770 int64_t  CS_LDK_TxAckRbf_clone_ptr(int64_t arg) {
45771         LDKTxAckRbf arg_conv;
45772         arg_conv.inner = untag_ptr(arg);
45773         arg_conv.is_owned = ptr_is_owned(arg);
45774         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45775         arg_conv.is_owned = false;
45776         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
45777         return ret_conv;
45778 }
45779
45780 int64_t  CS_LDK_TxAckRbf_clone(int64_t orig) {
45781         LDKTxAckRbf orig_conv;
45782         orig_conv.inner = untag_ptr(orig);
45783         orig_conv.is_owned = ptr_is_owned(orig);
45784         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45785         orig_conv.is_owned = false;
45786         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
45787         int64_t ret_ref = 0;
45788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45790         return ret_ref;
45791 }
45792
45793 int64_t  CS_LDK_TxAckRbf_hash(int64_t o) {
45794         LDKTxAckRbf o_conv;
45795         o_conv.inner = untag_ptr(o);
45796         o_conv.is_owned = ptr_is_owned(o);
45797         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45798         o_conv.is_owned = false;
45799         int64_t ret_conv = TxAckRbf_hash(&o_conv);
45800         return ret_conv;
45801 }
45802
45803 jboolean  CS_LDK_TxAckRbf_eq(int64_t a, int64_t b) {
45804         LDKTxAckRbf a_conv;
45805         a_conv.inner = untag_ptr(a);
45806         a_conv.is_owned = ptr_is_owned(a);
45807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45808         a_conv.is_owned = false;
45809         LDKTxAckRbf b_conv;
45810         b_conv.inner = untag_ptr(b);
45811         b_conv.is_owned = ptr_is_owned(b);
45812         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45813         b_conv.is_owned = false;
45814         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
45815         return ret_conv;
45816 }
45817
45818 void  CS_LDK_TxAbort_free(int64_t this_obj) {
45819         LDKTxAbort this_obj_conv;
45820         this_obj_conv.inner = untag_ptr(this_obj);
45821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45823         TxAbort_free(this_obj_conv);
45824 }
45825
45826 int8_tArray  CS_LDK_TxAbort_get_channel_id(int64_t this_ptr) {
45827         LDKTxAbort this_ptr_conv;
45828         this_ptr_conv.inner = untag_ptr(this_ptr);
45829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45831         this_ptr_conv.is_owned = false;
45832         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45833         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
45834         return ret_arr;
45835 }
45836
45837 void  CS_LDK_TxAbort_set_channel_id(int64_t this_ptr, int8_tArray val) {
45838         LDKTxAbort this_ptr_conv;
45839         this_ptr_conv.inner = untag_ptr(this_ptr);
45840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45842         this_ptr_conv.is_owned = false;
45843         LDKThirtyTwoBytes val_ref;
45844         CHECK(val->arr_len == 32);
45845         memcpy(val_ref.data, val->elems, 32); FREE(val);
45846         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
45847 }
45848
45849 int8_tArray  CS_LDK_TxAbort_get_data(int64_t this_ptr) {
45850         LDKTxAbort this_ptr_conv;
45851         this_ptr_conv.inner = untag_ptr(this_ptr);
45852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45854         this_ptr_conv.is_owned = false;
45855         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
45856         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45857         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45858         CVec_u8Z_free(ret_var);
45859         return ret_arr;
45860 }
45861
45862 void  CS_LDK_TxAbort_set_data(int64_t this_ptr, int8_tArray val) {
45863         LDKTxAbort this_ptr_conv;
45864         this_ptr_conv.inner = untag_ptr(this_ptr);
45865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45867         this_ptr_conv.is_owned = false;
45868         LDKCVec_u8Z val_ref;
45869         val_ref.datalen = val->arr_len;
45870         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45871         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45872         TxAbort_set_data(&this_ptr_conv, val_ref);
45873 }
45874
45875 int64_t  CS_LDK_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
45876         LDKThirtyTwoBytes channel_id_arg_ref;
45877         CHECK(channel_id_arg->arr_len == 32);
45878         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45879         LDKCVec_u8Z data_arg_ref;
45880         data_arg_ref.datalen = data_arg->arr_len;
45881         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45882         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
45883         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
45884         int64_t ret_ref = 0;
45885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45887         return ret_ref;
45888 }
45889
45890 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
45891         LDKTxAbort ret_var = TxAbort_clone(arg);
45892         int64_t ret_ref = 0;
45893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45895         return ret_ref;
45896 }
45897 int64_t  CS_LDK_TxAbort_clone_ptr(int64_t arg) {
45898         LDKTxAbort arg_conv;
45899         arg_conv.inner = untag_ptr(arg);
45900         arg_conv.is_owned = ptr_is_owned(arg);
45901         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45902         arg_conv.is_owned = false;
45903         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
45904         return ret_conv;
45905 }
45906
45907 int64_t  CS_LDK_TxAbort_clone(int64_t orig) {
45908         LDKTxAbort orig_conv;
45909         orig_conv.inner = untag_ptr(orig);
45910         orig_conv.is_owned = ptr_is_owned(orig);
45911         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45912         orig_conv.is_owned = false;
45913         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
45914         int64_t ret_ref = 0;
45915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45917         return ret_ref;
45918 }
45919
45920 int64_t  CS_LDK_TxAbort_hash(int64_t o) {
45921         LDKTxAbort o_conv;
45922         o_conv.inner = untag_ptr(o);
45923         o_conv.is_owned = ptr_is_owned(o);
45924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45925         o_conv.is_owned = false;
45926         int64_t ret_conv = TxAbort_hash(&o_conv);
45927         return ret_conv;
45928 }
45929
45930 jboolean  CS_LDK_TxAbort_eq(int64_t a, int64_t b) {
45931         LDKTxAbort a_conv;
45932         a_conv.inner = untag_ptr(a);
45933         a_conv.is_owned = ptr_is_owned(a);
45934         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45935         a_conv.is_owned = false;
45936         LDKTxAbort b_conv;
45937         b_conv.inner = untag_ptr(b);
45938         b_conv.is_owned = ptr_is_owned(b);
45939         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45940         b_conv.is_owned = false;
45941         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
45942         return ret_conv;
45943 }
45944
45945 void  CS_LDK_Shutdown_free(int64_t this_obj) {
45946         LDKShutdown this_obj_conv;
45947         this_obj_conv.inner = untag_ptr(this_obj);
45948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45950         Shutdown_free(this_obj_conv);
45951 }
45952
45953 int8_tArray  CS_LDK_Shutdown_get_channel_id(int64_t this_ptr) {
45954         LDKShutdown this_ptr_conv;
45955         this_ptr_conv.inner = untag_ptr(this_ptr);
45956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45958         this_ptr_conv.is_owned = false;
45959         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45960         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
45961         return ret_arr;
45962 }
45963
45964 void  CS_LDK_Shutdown_set_channel_id(int64_t this_ptr, int8_tArray val) {
45965         LDKShutdown this_ptr_conv;
45966         this_ptr_conv.inner = untag_ptr(this_ptr);
45967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45969         this_ptr_conv.is_owned = false;
45970         LDKThirtyTwoBytes val_ref;
45971         CHECK(val->arr_len == 32);
45972         memcpy(val_ref.data, val->elems, 32); FREE(val);
45973         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
45974 }
45975
45976 int8_tArray  CS_LDK_Shutdown_get_scriptpubkey(int64_t this_ptr) {
45977         LDKShutdown this_ptr_conv;
45978         this_ptr_conv.inner = untag_ptr(this_ptr);
45979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45981         this_ptr_conv.is_owned = false;
45982         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
45983         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45984         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45985         CVec_u8Z_free(ret_var);
45986         return ret_arr;
45987 }
45988
45989 void  CS_LDK_Shutdown_set_scriptpubkey(int64_t this_ptr, int8_tArray val) {
45990         LDKShutdown this_ptr_conv;
45991         this_ptr_conv.inner = untag_ptr(this_ptr);
45992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45994         this_ptr_conv.is_owned = false;
45995         LDKCVec_u8Z val_ref;
45996         val_ref.datalen = val->arr_len;
45997         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45998         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45999         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
46000 }
46001
46002 int64_t  CS_LDK_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
46003         LDKThirtyTwoBytes channel_id_arg_ref;
46004         CHECK(channel_id_arg->arr_len == 32);
46005         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46006         LDKCVec_u8Z scriptpubkey_arg_ref;
46007         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
46008         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46009         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
46010         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
46011         int64_t ret_ref = 0;
46012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46014         return ret_ref;
46015 }
46016
46017 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
46018         LDKShutdown ret_var = Shutdown_clone(arg);
46019         int64_t ret_ref = 0;
46020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46022         return ret_ref;
46023 }
46024 int64_t  CS_LDK_Shutdown_clone_ptr(int64_t arg) {
46025         LDKShutdown arg_conv;
46026         arg_conv.inner = untag_ptr(arg);
46027         arg_conv.is_owned = ptr_is_owned(arg);
46028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46029         arg_conv.is_owned = false;
46030         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
46031         return ret_conv;
46032 }
46033
46034 int64_t  CS_LDK_Shutdown_clone(int64_t orig) {
46035         LDKShutdown orig_conv;
46036         orig_conv.inner = untag_ptr(orig);
46037         orig_conv.is_owned = ptr_is_owned(orig);
46038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46039         orig_conv.is_owned = false;
46040         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
46041         int64_t ret_ref = 0;
46042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46044         return ret_ref;
46045 }
46046
46047 int64_t  CS_LDK_Shutdown_hash(int64_t o) {
46048         LDKShutdown o_conv;
46049         o_conv.inner = untag_ptr(o);
46050         o_conv.is_owned = ptr_is_owned(o);
46051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46052         o_conv.is_owned = false;
46053         int64_t ret_conv = Shutdown_hash(&o_conv);
46054         return ret_conv;
46055 }
46056
46057 jboolean  CS_LDK_Shutdown_eq(int64_t a, int64_t b) {
46058         LDKShutdown a_conv;
46059         a_conv.inner = untag_ptr(a);
46060         a_conv.is_owned = ptr_is_owned(a);
46061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46062         a_conv.is_owned = false;
46063         LDKShutdown b_conv;
46064         b_conv.inner = untag_ptr(b);
46065         b_conv.is_owned = ptr_is_owned(b);
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46067         b_conv.is_owned = false;
46068         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
46069         return ret_conv;
46070 }
46071
46072 void  CS_LDK_ClosingSignedFeeRange_free(int64_t this_obj) {
46073         LDKClosingSignedFeeRange this_obj_conv;
46074         this_obj_conv.inner = untag_ptr(this_obj);
46075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46077         ClosingSignedFeeRange_free(this_obj_conv);
46078 }
46079
46080 int64_t  CS_LDK_ClosingSignedFeeRange_get_min_fee_satoshis(int64_t this_ptr) {
46081         LDKClosingSignedFeeRange this_ptr_conv;
46082         this_ptr_conv.inner = untag_ptr(this_ptr);
46083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46085         this_ptr_conv.is_owned = false;
46086         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
46087         return ret_conv;
46088 }
46089
46090 void  CS_LDK_ClosingSignedFeeRange_set_min_fee_satoshis(int64_t this_ptr, int64_t val) {
46091         LDKClosingSignedFeeRange this_ptr_conv;
46092         this_ptr_conv.inner = untag_ptr(this_ptr);
46093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46095         this_ptr_conv.is_owned = false;
46096         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
46097 }
46098
46099 int64_t  CS_LDK_ClosingSignedFeeRange_get_max_fee_satoshis(int64_t this_ptr) {
46100         LDKClosingSignedFeeRange this_ptr_conv;
46101         this_ptr_conv.inner = untag_ptr(this_ptr);
46102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46104         this_ptr_conv.is_owned = false;
46105         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
46106         return ret_conv;
46107 }
46108
46109 void  CS_LDK_ClosingSignedFeeRange_set_max_fee_satoshis(int64_t this_ptr, int64_t val) {
46110         LDKClosingSignedFeeRange this_ptr_conv;
46111         this_ptr_conv.inner = untag_ptr(this_ptr);
46112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46114         this_ptr_conv.is_owned = false;
46115         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
46116 }
46117
46118 int64_t  CS_LDK_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
46119         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
46120         int64_t ret_ref = 0;
46121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46123         return ret_ref;
46124 }
46125
46126 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
46127         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
46128         int64_t ret_ref = 0;
46129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46131         return ret_ref;
46132 }
46133 int64_t  CS_LDK_ClosingSignedFeeRange_clone_ptr(int64_t arg) {
46134         LDKClosingSignedFeeRange arg_conv;
46135         arg_conv.inner = untag_ptr(arg);
46136         arg_conv.is_owned = ptr_is_owned(arg);
46137         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46138         arg_conv.is_owned = false;
46139         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
46140         return ret_conv;
46141 }
46142
46143 int64_t  CS_LDK_ClosingSignedFeeRange_clone(int64_t orig) {
46144         LDKClosingSignedFeeRange orig_conv;
46145         orig_conv.inner = untag_ptr(orig);
46146         orig_conv.is_owned = ptr_is_owned(orig);
46147         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46148         orig_conv.is_owned = false;
46149         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
46150         int64_t ret_ref = 0;
46151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46153         return ret_ref;
46154 }
46155
46156 int64_t  CS_LDK_ClosingSignedFeeRange_hash(int64_t o) {
46157         LDKClosingSignedFeeRange o_conv;
46158         o_conv.inner = untag_ptr(o);
46159         o_conv.is_owned = ptr_is_owned(o);
46160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46161         o_conv.is_owned = false;
46162         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
46163         return ret_conv;
46164 }
46165
46166 jboolean  CS_LDK_ClosingSignedFeeRange_eq(int64_t a, int64_t b) {
46167         LDKClosingSignedFeeRange a_conv;
46168         a_conv.inner = untag_ptr(a);
46169         a_conv.is_owned = ptr_is_owned(a);
46170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46171         a_conv.is_owned = false;
46172         LDKClosingSignedFeeRange b_conv;
46173         b_conv.inner = untag_ptr(b);
46174         b_conv.is_owned = ptr_is_owned(b);
46175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46176         b_conv.is_owned = false;
46177         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
46178         return ret_conv;
46179 }
46180
46181 void  CS_LDK_ClosingSigned_free(int64_t this_obj) {
46182         LDKClosingSigned this_obj_conv;
46183         this_obj_conv.inner = untag_ptr(this_obj);
46184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46186         ClosingSigned_free(this_obj_conv);
46187 }
46188
46189 int8_tArray  CS_LDK_ClosingSigned_get_channel_id(int64_t this_ptr) {
46190         LDKClosingSigned this_ptr_conv;
46191         this_ptr_conv.inner = untag_ptr(this_ptr);
46192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46194         this_ptr_conv.is_owned = false;
46195         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46196         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
46197         return ret_arr;
46198 }
46199
46200 void  CS_LDK_ClosingSigned_set_channel_id(int64_t this_ptr, int8_tArray val) {
46201         LDKClosingSigned this_ptr_conv;
46202         this_ptr_conv.inner = untag_ptr(this_ptr);
46203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46205         this_ptr_conv.is_owned = false;
46206         LDKThirtyTwoBytes val_ref;
46207         CHECK(val->arr_len == 32);
46208         memcpy(val_ref.data, val->elems, 32); FREE(val);
46209         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
46210 }
46211
46212 int64_t  CS_LDK_ClosingSigned_get_fee_satoshis(int64_t this_ptr) {
46213         LDKClosingSigned this_ptr_conv;
46214         this_ptr_conv.inner = untag_ptr(this_ptr);
46215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46217         this_ptr_conv.is_owned = false;
46218         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
46219         return ret_conv;
46220 }
46221
46222 void  CS_LDK_ClosingSigned_set_fee_satoshis(int64_t this_ptr, int64_t val) {
46223         LDKClosingSigned this_ptr_conv;
46224         this_ptr_conv.inner = untag_ptr(this_ptr);
46225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46227         this_ptr_conv.is_owned = false;
46228         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
46229 }
46230
46231 int8_tArray  CS_LDK_ClosingSigned_get_signature(int64_t this_ptr) {
46232         LDKClosingSigned this_ptr_conv;
46233         this_ptr_conv.inner = untag_ptr(this_ptr);
46234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46236         this_ptr_conv.is_owned = false;
46237         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46238         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
46239         return ret_arr;
46240 }
46241
46242 void  CS_LDK_ClosingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
46243         LDKClosingSigned this_ptr_conv;
46244         this_ptr_conv.inner = untag_ptr(this_ptr);
46245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46247         this_ptr_conv.is_owned = false;
46248         LDKECDSASignature val_ref;
46249         CHECK(val->arr_len == 64);
46250         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46251         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
46252 }
46253
46254 int64_t  CS_LDK_ClosingSigned_get_fee_range(int64_t this_ptr) {
46255         LDKClosingSigned this_ptr_conv;
46256         this_ptr_conv.inner = untag_ptr(this_ptr);
46257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46259         this_ptr_conv.is_owned = false;
46260         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
46261         int64_t ret_ref = 0;
46262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46264         return ret_ref;
46265 }
46266
46267 void  CS_LDK_ClosingSigned_set_fee_range(int64_t this_ptr, int64_t val) {
46268         LDKClosingSigned this_ptr_conv;
46269         this_ptr_conv.inner = untag_ptr(this_ptr);
46270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46272         this_ptr_conv.is_owned = false;
46273         LDKClosingSignedFeeRange val_conv;
46274         val_conv.inner = untag_ptr(val);
46275         val_conv.is_owned = ptr_is_owned(val);
46276         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46277         val_conv = ClosingSignedFeeRange_clone(&val_conv);
46278         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
46279 }
46280
46281 int64_t  CS_LDK_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
46282         LDKThirtyTwoBytes channel_id_arg_ref;
46283         CHECK(channel_id_arg->arr_len == 32);
46284         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46285         LDKECDSASignature signature_arg_ref;
46286         CHECK(signature_arg->arr_len == 64);
46287         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
46288         LDKClosingSignedFeeRange fee_range_arg_conv;
46289         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
46290         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
46291         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
46292         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
46293         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
46294         int64_t ret_ref = 0;
46295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46297         return ret_ref;
46298 }
46299
46300 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
46301         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
46302         int64_t ret_ref = 0;
46303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46305         return ret_ref;
46306 }
46307 int64_t  CS_LDK_ClosingSigned_clone_ptr(int64_t arg) {
46308         LDKClosingSigned arg_conv;
46309         arg_conv.inner = untag_ptr(arg);
46310         arg_conv.is_owned = ptr_is_owned(arg);
46311         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46312         arg_conv.is_owned = false;
46313         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
46314         return ret_conv;
46315 }
46316
46317 int64_t  CS_LDK_ClosingSigned_clone(int64_t orig) {
46318         LDKClosingSigned orig_conv;
46319         orig_conv.inner = untag_ptr(orig);
46320         orig_conv.is_owned = ptr_is_owned(orig);
46321         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46322         orig_conv.is_owned = false;
46323         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
46324         int64_t ret_ref = 0;
46325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46327         return ret_ref;
46328 }
46329
46330 int64_t  CS_LDK_ClosingSigned_hash(int64_t o) {
46331         LDKClosingSigned o_conv;
46332         o_conv.inner = untag_ptr(o);
46333         o_conv.is_owned = ptr_is_owned(o);
46334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46335         o_conv.is_owned = false;
46336         int64_t ret_conv = ClosingSigned_hash(&o_conv);
46337         return ret_conv;
46338 }
46339
46340 jboolean  CS_LDK_ClosingSigned_eq(int64_t a, int64_t b) {
46341         LDKClosingSigned a_conv;
46342         a_conv.inner = untag_ptr(a);
46343         a_conv.is_owned = ptr_is_owned(a);
46344         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46345         a_conv.is_owned = false;
46346         LDKClosingSigned b_conv;
46347         b_conv.inner = untag_ptr(b);
46348         b_conv.is_owned = ptr_is_owned(b);
46349         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46350         b_conv.is_owned = false;
46351         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
46352         return ret_conv;
46353 }
46354
46355 void  CS_LDK_UpdateAddHTLC_free(int64_t this_obj) {
46356         LDKUpdateAddHTLC this_obj_conv;
46357         this_obj_conv.inner = untag_ptr(this_obj);
46358         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46360         UpdateAddHTLC_free(this_obj_conv);
46361 }
46362
46363 int8_tArray  CS_LDK_UpdateAddHTLC_get_channel_id(int64_t this_ptr) {
46364         LDKUpdateAddHTLC this_ptr_conv;
46365         this_ptr_conv.inner = untag_ptr(this_ptr);
46366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46368         this_ptr_conv.is_owned = false;
46369         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46370         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
46371         return ret_arr;
46372 }
46373
46374 void  CS_LDK_UpdateAddHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
46375         LDKUpdateAddHTLC this_ptr_conv;
46376         this_ptr_conv.inner = untag_ptr(this_ptr);
46377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46379         this_ptr_conv.is_owned = false;
46380         LDKThirtyTwoBytes val_ref;
46381         CHECK(val->arr_len == 32);
46382         memcpy(val_ref.data, val->elems, 32); FREE(val);
46383         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
46384 }
46385
46386 int64_t  CS_LDK_UpdateAddHTLC_get_htlc_id(int64_t this_ptr) {
46387         LDKUpdateAddHTLC this_ptr_conv;
46388         this_ptr_conv.inner = untag_ptr(this_ptr);
46389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46391         this_ptr_conv.is_owned = false;
46392         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
46393         return ret_conv;
46394 }
46395
46396 void  CS_LDK_UpdateAddHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
46397         LDKUpdateAddHTLC this_ptr_conv;
46398         this_ptr_conv.inner = untag_ptr(this_ptr);
46399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46401         this_ptr_conv.is_owned = false;
46402         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46403 }
46404
46405 int64_t  CS_LDK_UpdateAddHTLC_get_amount_msat(int64_t this_ptr) {
46406         LDKUpdateAddHTLC this_ptr_conv;
46407         this_ptr_conv.inner = untag_ptr(this_ptr);
46408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46410         this_ptr_conv.is_owned = false;
46411         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46412         return ret_conv;
46413 }
46414
46415 void  CS_LDK_UpdateAddHTLC_set_amount_msat(int64_t this_ptr, int64_t val) {
46416         LDKUpdateAddHTLC this_ptr_conv;
46417         this_ptr_conv.inner = untag_ptr(this_ptr);
46418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46420         this_ptr_conv.is_owned = false;
46421         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46422 }
46423
46424 int8_tArray  CS_LDK_UpdateAddHTLC_get_payment_hash(int64_t this_ptr) {
46425         LDKUpdateAddHTLC this_ptr_conv;
46426         this_ptr_conv.inner = untag_ptr(this_ptr);
46427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46429         this_ptr_conv.is_owned = false;
46430         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46431         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
46432         return ret_arr;
46433 }
46434
46435 void  CS_LDK_UpdateAddHTLC_set_payment_hash(int64_t this_ptr, int8_tArray val) {
46436         LDKUpdateAddHTLC this_ptr_conv;
46437         this_ptr_conv.inner = untag_ptr(this_ptr);
46438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46440         this_ptr_conv.is_owned = false;
46441         LDKThirtyTwoBytes val_ref;
46442         CHECK(val->arr_len == 32);
46443         memcpy(val_ref.data, val->elems, 32); FREE(val);
46444         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46445 }
46446
46447 int32_t  CS_LDK_UpdateAddHTLC_get_cltv_expiry(int64_t this_ptr) {
46448         LDKUpdateAddHTLC this_ptr_conv;
46449         this_ptr_conv.inner = untag_ptr(this_ptr);
46450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46452         this_ptr_conv.is_owned = false;
46453         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46454         return ret_conv;
46455 }
46456
46457 void  CS_LDK_UpdateAddHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
46458         LDKUpdateAddHTLC this_ptr_conv;
46459         this_ptr_conv.inner = untag_ptr(this_ptr);
46460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46462         this_ptr_conv.is_owned = false;
46463         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46464 }
46465
46466 int64_t  CS_LDK_UpdateAddHTLC_get_skimmed_fee_msat(int64_t this_ptr) {
46467         LDKUpdateAddHTLC this_ptr_conv;
46468         this_ptr_conv.inner = untag_ptr(this_ptr);
46469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46471         this_ptr_conv.is_owned = false;
46472         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46473         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46474         int64_t ret_ref = tag_ptr(ret_copy, true);
46475         return ret_ref;
46476 }
46477
46478 void  CS_LDK_UpdateAddHTLC_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
46479         LDKUpdateAddHTLC this_ptr_conv;
46480         this_ptr_conv.inner = untag_ptr(this_ptr);
46481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46483         this_ptr_conv.is_owned = false;
46484         void* val_ptr = untag_ptr(val);
46485         CHECK_ACCESS(val_ptr);
46486         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46487         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46488         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46489 }
46490
46491 int64_t  CS_LDK_UpdateAddHTLC_get_onion_routing_packet(int64_t this_ptr) {
46492         LDKUpdateAddHTLC this_ptr_conv;
46493         this_ptr_conv.inner = untag_ptr(this_ptr);
46494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46496         this_ptr_conv.is_owned = false;
46497         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
46498         int64_t ret_ref = 0;
46499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46501         return ret_ref;
46502 }
46503
46504 void  CS_LDK_UpdateAddHTLC_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
46505         LDKUpdateAddHTLC this_ptr_conv;
46506         this_ptr_conv.inner = untag_ptr(this_ptr);
46507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46509         this_ptr_conv.is_owned = false;
46510         LDKOnionPacket val_conv;
46511         val_conv.inner = untag_ptr(val);
46512         val_conv.is_owned = ptr_is_owned(val);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46514         val_conv = OnionPacket_clone(&val_conv);
46515         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
46516 }
46517
46518 int8_tArray  CS_LDK_UpdateAddHTLC_get_blinding_point(int64_t this_ptr) {
46519         LDKUpdateAddHTLC this_ptr_conv;
46520         this_ptr_conv.inner = untag_ptr(this_ptr);
46521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46523         this_ptr_conv.is_owned = false;
46524         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46525         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46526         return ret_arr;
46527 }
46528
46529 void  CS_LDK_UpdateAddHTLC_set_blinding_point(int64_t this_ptr, int8_tArray val) {
46530         LDKUpdateAddHTLC this_ptr_conv;
46531         this_ptr_conv.inner = untag_ptr(this_ptr);
46532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46534         this_ptr_conv.is_owned = false;
46535         LDKPublicKey val_ref;
46536         CHECK(val->arr_len == 33);
46537         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46538         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
46539 }
46540
46541 int64_t  CS_LDK_UpdateAddHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, int64_t skimmed_fee_msat_arg, int64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
46542         LDKThirtyTwoBytes channel_id_arg_ref;
46543         CHECK(channel_id_arg->arr_len == 32);
46544         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46545         LDKThirtyTwoBytes payment_hash_arg_ref;
46546         CHECK(payment_hash_arg->arr_len == 32);
46547         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
46548         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
46549         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
46550         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
46551         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
46552         LDKOnionPacket onion_routing_packet_arg_conv;
46553         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46554         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46555         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46556         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
46557         LDKPublicKey blinding_point_arg_ref;
46558         CHECK(blinding_point_arg->arr_len == 33);
46559         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46560         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_ref, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
46561         int64_t ret_ref = 0;
46562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46564         return ret_ref;
46565 }
46566
46567 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46568         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46569         int64_t ret_ref = 0;
46570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46572         return ret_ref;
46573 }
46574 int64_t  CS_LDK_UpdateAddHTLC_clone_ptr(int64_t arg) {
46575         LDKUpdateAddHTLC arg_conv;
46576         arg_conv.inner = untag_ptr(arg);
46577         arg_conv.is_owned = ptr_is_owned(arg);
46578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46579         arg_conv.is_owned = false;
46580         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
46581         return ret_conv;
46582 }
46583
46584 int64_t  CS_LDK_UpdateAddHTLC_clone(int64_t orig) {
46585         LDKUpdateAddHTLC orig_conv;
46586         orig_conv.inner = untag_ptr(orig);
46587         orig_conv.is_owned = ptr_is_owned(orig);
46588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46589         orig_conv.is_owned = false;
46590         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
46591         int64_t ret_ref = 0;
46592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46594         return ret_ref;
46595 }
46596
46597 int64_t  CS_LDK_UpdateAddHTLC_hash(int64_t o) {
46598         LDKUpdateAddHTLC o_conv;
46599         o_conv.inner = untag_ptr(o);
46600         o_conv.is_owned = ptr_is_owned(o);
46601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46602         o_conv.is_owned = false;
46603         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
46604         return ret_conv;
46605 }
46606
46607 jboolean  CS_LDK_UpdateAddHTLC_eq(int64_t a, int64_t b) {
46608         LDKUpdateAddHTLC 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         LDKUpdateAddHTLC 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 = UpdateAddHTLC_eq(&a_conv, &b_conv);
46619         return ret_conv;
46620 }
46621
46622 void  CS_LDK_OnionMessage_free(int64_t this_obj) {
46623         LDKOnionMessage 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         OnionMessage_free(this_obj_conv);
46628 }
46629
46630 int8_tArray  CS_LDK_OnionMessage_get_blinding_point(int64_t this_ptr) {
46631         LDKOnionMessage 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46637         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46638         return ret_arr;
46639 }
46640
46641 void  CS_LDK_OnionMessage_set_blinding_point(int64_t this_ptr, int8_tArray val) {
46642         LDKOnionMessage this_ptr_conv;
46643         this_ptr_conv.inner = untag_ptr(this_ptr);
46644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46646         this_ptr_conv.is_owned = false;
46647         LDKPublicKey val_ref;
46648         CHECK(val->arr_len == 33);
46649         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46650         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
46651 }
46652
46653 int64_t  CS_LDK_OnionMessage_get_onion_routing_packet(int64_t this_ptr) {
46654         LDKOnionMessage this_ptr_conv;
46655         this_ptr_conv.inner = untag_ptr(this_ptr);
46656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46658         this_ptr_conv.is_owned = false;
46659         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
46660         int64_t ret_ref = 0;
46661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46663         return ret_ref;
46664 }
46665
46666 void  CS_LDK_OnionMessage_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
46667         LDKOnionMessage this_ptr_conv;
46668         this_ptr_conv.inner = untag_ptr(this_ptr);
46669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46671         this_ptr_conv.is_owned = false;
46672         LDKPacket val_conv;
46673         val_conv.inner = untag_ptr(val);
46674         val_conv.is_owned = ptr_is_owned(val);
46675         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46676         val_conv = Packet_clone(&val_conv);
46677         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
46678 }
46679
46680 int64_t  CS_LDK_OnionMessage_new(int8_tArray blinding_point_arg, int64_t onion_routing_packet_arg) {
46681         LDKPublicKey blinding_point_arg_ref;
46682         CHECK(blinding_point_arg->arr_len == 33);
46683         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46684         LDKPacket onion_routing_packet_arg_conv;
46685         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46686         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46687         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46688         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
46689         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
46690         int64_t ret_ref = 0;
46691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46693         return ret_ref;
46694 }
46695
46696 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
46697         LDKOnionMessage ret_var = OnionMessage_clone(arg);
46698         int64_t ret_ref = 0;
46699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46701         return ret_ref;
46702 }
46703 int64_t  CS_LDK_OnionMessage_clone_ptr(int64_t arg) {
46704         LDKOnionMessage arg_conv;
46705         arg_conv.inner = untag_ptr(arg);
46706         arg_conv.is_owned = ptr_is_owned(arg);
46707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46708         arg_conv.is_owned = false;
46709         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
46710         return ret_conv;
46711 }
46712
46713 int64_t  CS_LDK_OnionMessage_clone(int64_t orig) {
46714         LDKOnionMessage orig_conv;
46715         orig_conv.inner = untag_ptr(orig);
46716         orig_conv.is_owned = ptr_is_owned(orig);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46718         orig_conv.is_owned = false;
46719         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
46720         int64_t ret_ref = 0;
46721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46723         return ret_ref;
46724 }
46725
46726 int64_t  CS_LDK_OnionMessage_hash(int64_t o) {
46727         LDKOnionMessage o_conv;
46728         o_conv.inner = untag_ptr(o);
46729         o_conv.is_owned = ptr_is_owned(o);
46730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46731         o_conv.is_owned = false;
46732         int64_t ret_conv = OnionMessage_hash(&o_conv);
46733         return ret_conv;
46734 }
46735
46736 jboolean  CS_LDK_OnionMessage_eq(int64_t a, int64_t b) {
46737         LDKOnionMessage a_conv;
46738         a_conv.inner = untag_ptr(a);
46739         a_conv.is_owned = ptr_is_owned(a);
46740         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46741         a_conv.is_owned = false;
46742         LDKOnionMessage b_conv;
46743         b_conv.inner = untag_ptr(b);
46744         b_conv.is_owned = ptr_is_owned(b);
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46746         b_conv.is_owned = false;
46747         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
46748         return ret_conv;
46749 }
46750
46751 void  CS_LDK_UpdateFulfillHTLC_free(int64_t this_obj) {
46752         LDKUpdateFulfillHTLC this_obj_conv;
46753         this_obj_conv.inner = untag_ptr(this_obj);
46754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46756         UpdateFulfillHTLC_free(this_obj_conv);
46757 }
46758
46759 int8_tArray  CS_LDK_UpdateFulfillHTLC_get_channel_id(int64_t this_ptr) {
46760         LDKUpdateFulfillHTLC this_ptr_conv;
46761         this_ptr_conv.inner = untag_ptr(this_ptr);
46762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46764         this_ptr_conv.is_owned = false;
46765         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46766         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
46767         return ret_arr;
46768 }
46769
46770 void  CS_LDK_UpdateFulfillHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
46771         LDKUpdateFulfillHTLC this_ptr_conv;
46772         this_ptr_conv.inner = untag_ptr(this_ptr);
46773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46775         this_ptr_conv.is_owned = false;
46776         LDKThirtyTwoBytes val_ref;
46777         CHECK(val->arr_len == 32);
46778         memcpy(val_ref.data, val->elems, 32); FREE(val);
46779         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
46780 }
46781
46782 int64_t  CS_LDK_UpdateFulfillHTLC_get_htlc_id(int64_t this_ptr) {
46783         LDKUpdateFulfillHTLC this_ptr_conv;
46784         this_ptr_conv.inner = untag_ptr(this_ptr);
46785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46787         this_ptr_conv.is_owned = false;
46788         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
46789         return ret_conv;
46790 }
46791
46792 void  CS_LDK_UpdateFulfillHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
46793         LDKUpdateFulfillHTLC this_ptr_conv;
46794         this_ptr_conv.inner = untag_ptr(this_ptr);
46795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46797         this_ptr_conv.is_owned = false;
46798         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
46799 }
46800
46801 int8_tArray  CS_LDK_UpdateFulfillHTLC_get_payment_preimage(int64_t this_ptr) {
46802         LDKUpdateFulfillHTLC this_ptr_conv;
46803         this_ptr_conv.inner = untag_ptr(this_ptr);
46804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46806         this_ptr_conv.is_owned = false;
46807         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46808         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
46809         return ret_arr;
46810 }
46811
46812 void  CS_LDK_UpdateFulfillHTLC_set_payment_preimage(int64_t this_ptr, int8_tArray val) {
46813         LDKUpdateFulfillHTLC this_ptr_conv;
46814         this_ptr_conv.inner = untag_ptr(this_ptr);
46815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46817         this_ptr_conv.is_owned = false;
46818         LDKThirtyTwoBytes val_ref;
46819         CHECK(val->arr_len == 32);
46820         memcpy(val_ref.data, val->elems, 32); FREE(val);
46821         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
46822 }
46823
46824 int64_t  CS_LDK_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
46825         LDKThirtyTwoBytes channel_id_arg_ref;
46826         CHECK(channel_id_arg->arr_len == 32);
46827         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46828         LDKThirtyTwoBytes payment_preimage_arg_ref;
46829         CHECK(payment_preimage_arg->arr_len == 32);
46830         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
46831         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
46832         int64_t ret_ref = 0;
46833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46835         return ret_ref;
46836 }
46837
46838 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
46839         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
46840         int64_t ret_ref = 0;
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46843         return ret_ref;
46844 }
46845 int64_t  CS_LDK_UpdateFulfillHTLC_clone_ptr(int64_t arg) {
46846         LDKUpdateFulfillHTLC arg_conv;
46847         arg_conv.inner = untag_ptr(arg);
46848         arg_conv.is_owned = ptr_is_owned(arg);
46849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46850         arg_conv.is_owned = false;
46851         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
46852         return ret_conv;
46853 }
46854
46855 int64_t  CS_LDK_UpdateFulfillHTLC_clone(int64_t orig) {
46856         LDKUpdateFulfillHTLC orig_conv;
46857         orig_conv.inner = untag_ptr(orig);
46858         orig_conv.is_owned = ptr_is_owned(orig);
46859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46860         orig_conv.is_owned = false;
46861         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
46862         int64_t ret_ref = 0;
46863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46865         return ret_ref;
46866 }
46867
46868 int64_t  CS_LDK_UpdateFulfillHTLC_hash(int64_t o) {
46869         LDKUpdateFulfillHTLC o_conv;
46870         o_conv.inner = untag_ptr(o);
46871         o_conv.is_owned = ptr_is_owned(o);
46872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46873         o_conv.is_owned = false;
46874         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
46875         return ret_conv;
46876 }
46877
46878 jboolean  CS_LDK_UpdateFulfillHTLC_eq(int64_t a, int64_t b) {
46879         LDKUpdateFulfillHTLC a_conv;
46880         a_conv.inner = untag_ptr(a);
46881         a_conv.is_owned = ptr_is_owned(a);
46882         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46883         a_conv.is_owned = false;
46884         LDKUpdateFulfillHTLC b_conv;
46885         b_conv.inner = untag_ptr(b);
46886         b_conv.is_owned = ptr_is_owned(b);
46887         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46888         b_conv.is_owned = false;
46889         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
46890         return ret_conv;
46891 }
46892
46893 void  CS_LDK_UpdateFailHTLC_free(int64_t this_obj) {
46894         LDKUpdateFailHTLC this_obj_conv;
46895         this_obj_conv.inner = untag_ptr(this_obj);
46896         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46898         UpdateFailHTLC_free(this_obj_conv);
46899 }
46900
46901 int8_tArray  CS_LDK_UpdateFailHTLC_get_channel_id(int64_t this_ptr) {
46902         LDKUpdateFailHTLC this_ptr_conv;
46903         this_ptr_conv.inner = untag_ptr(this_ptr);
46904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46906         this_ptr_conv.is_owned = false;
46907         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46908         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
46909         return ret_arr;
46910 }
46911
46912 void  CS_LDK_UpdateFailHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
46913         LDKUpdateFailHTLC this_ptr_conv;
46914         this_ptr_conv.inner = untag_ptr(this_ptr);
46915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46917         this_ptr_conv.is_owned = false;
46918         LDKThirtyTwoBytes val_ref;
46919         CHECK(val->arr_len == 32);
46920         memcpy(val_ref.data, val->elems, 32); FREE(val);
46921         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
46922 }
46923
46924 int64_t  CS_LDK_UpdateFailHTLC_get_htlc_id(int64_t this_ptr) {
46925         LDKUpdateFailHTLC this_ptr_conv;
46926         this_ptr_conv.inner = untag_ptr(this_ptr);
46927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46929         this_ptr_conv.is_owned = false;
46930         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
46931         return ret_conv;
46932 }
46933
46934 void  CS_LDK_UpdateFailHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
46935         LDKUpdateFailHTLC this_ptr_conv;
46936         this_ptr_conv.inner = untag_ptr(this_ptr);
46937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46939         this_ptr_conv.is_owned = false;
46940         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
46941 }
46942
46943 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
46944         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
46945         int64_t ret_ref = 0;
46946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46948         return ret_ref;
46949 }
46950 int64_t  CS_LDK_UpdateFailHTLC_clone_ptr(int64_t arg) {
46951         LDKUpdateFailHTLC arg_conv;
46952         arg_conv.inner = untag_ptr(arg);
46953         arg_conv.is_owned = ptr_is_owned(arg);
46954         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46955         arg_conv.is_owned = false;
46956         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
46957         return ret_conv;
46958 }
46959
46960 int64_t  CS_LDK_UpdateFailHTLC_clone(int64_t orig) {
46961         LDKUpdateFailHTLC orig_conv;
46962         orig_conv.inner = untag_ptr(orig);
46963         orig_conv.is_owned = ptr_is_owned(orig);
46964         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46965         orig_conv.is_owned = false;
46966         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
46967         int64_t ret_ref = 0;
46968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46970         return ret_ref;
46971 }
46972
46973 int64_t  CS_LDK_UpdateFailHTLC_hash(int64_t o) {
46974         LDKUpdateFailHTLC o_conv;
46975         o_conv.inner = untag_ptr(o);
46976         o_conv.is_owned = ptr_is_owned(o);
46977         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46978         o_conv.is_owned = false;
46979         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
46980         return ret_conv;
46981 }
46982
46983 jboolean  CS_LDK_UpdateFailHTLC_eq(int64_t a, int64_t b) {
46984         LDKUpdateFailHTLC a_conv;
46985         a_conv.inner = untag_ptr(a);
46986         a_conv.is_owned = ptr_is_owned(a);
46987         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46988         a_conv.is_owned = false;
46989         LDKUpdateFailHTLC b_conv;
46990         b_conv.inner = untag_ptr(b);
46991         b_conv.is_owned = ptr_is_owned(b);
46992         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46993         b_conv.is_owned = false;
46994         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
46995         return ret_conv;
46996 }
46997
46998 void  CS_LDK_UpdateFailMalformedHTLC_free(int64_t this_obj) {
46999         LDKUpdateFailMalformedHTLC this_obj_conv;
47000         this_obj_conv.inner = untag_ptr(this_obj);
47001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47003         UpdateFailMalformedHTLC_free(this_obj_conv);
47004 }
47005
47006 int8_tArray  CS_LDK_UpdateFailMalformedHTLC_get_channel_id(int64_t this_ptr) {
47007         LDKUpdateFailMalformedHTLC this_ptr_conv;
47008         this_ptr_conv.inner = untag_ptr(this_ptr);
47009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47011         this_ptr_conv.is_owned = false;
47012         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47013         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
47014         return ret_arr;
47015 }
47016
47017 void  CS_LDK_UpdateFailMalformedHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
47018         LDKUpdateFailMalformedHTLC this_ptr_conv;
47019         this_ptr_conv.inner = untag_ptr(this_ptr);
47020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47022         this_ptr_conv.is_owned = false;
47023         LDKThirtyTwoBytes val_ref;
47024         CHECK(val->arr_len == 32);
47025         memcpy(val_ref.data, val->elems, 32); FREE(val);
47026         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
47027 }
47028
47029 int64_t  CS_LDK_UpdateFailMalformedHTLC_get_htlc_id(int64_t this_ptr) {
47030         LDKUpdateFailMalformedHTLC this_ptr_conv;
47031         this_ptr_conv.inner = untag_ptr(this_ptr);
47032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47034         this_ptr_conv.is_owned = false;
47035         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
47036         return ret_conv;
47037 }
47038
47039 void  CS_LDK_UpdateFailMalformedHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
47040         LDKUpdateFailMalformedHTLC this_ptr_conv;
47041         this_ptr_conv.inner = untag_ptr(this_ptr);
47042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47044         this_ptr_conv.is_owned = false;
47045         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
47046 }
47047
47048 int16_t  CS_LDK_UpdateFailMalformedHTLC_get_failure_code(int64_t this_ptr) {
47049         LDKUpdateFailMalformedHTLC this_ptr_conv;
47050         this_ptr_conv.inner = untag_ptr(this_ptr);
47051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47053         this_ptr_conv.is_owned = false;
47054         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
47055         return ret_conv;
47056 }
47057
47058 void  CS_LDK_UpdateFailMalformedHTLC_set_failure_code(int64_t this_ptr, int16_t val) {
47059         LDKUpdateFailMalformedHTLC this_ptr_conv;
47060         this_ptr_conv.inner = untag_ptr(this_ptr);
47061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47063         this_ptr_conv.is_owned = false;
47064         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
47065 }
47066
47067 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
47068         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
47069         int64_t ret_ref = 0;
47070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47072         return ret_ref;
47073 }
47074 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone_ptr(int64_t arg) {
47075         LDKUpdateFailMalformedHTLC arg_conv;
47076         arg_conv.inner = untag_ptr(arg);
47077         arg_conv.is_owned = ptr_is_owned(arg);
47078         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47079         arg_conv.is_owned = false;
47080         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
47081         return ret_conv;
47082 }
47083
47084 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone(int64_t orig) {
47085         LDKUpdateFailMalformedHTLC orig_conv;
47086         orig_conv.inner = untag_ptr(orig);
47087         orig_conv.is_owned = ptr_is_owned(orig);
47088         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47089         orig_conv.is_owned = false;
47090         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
47091         int64_t ret_ref = 0;
47092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47094         return ret_ref;
47095 }
47096
47097 int64_t  CS_LDK_UpdateFailMalformedHTLC_hash(int64_t o) {
47098         LDKUpdateFailMalformedHTLC o_conv;
47099         o_conv.inner = untag_ptr(o);
47100         o_conv.is_owned = ptr_is_owned(o);
47101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47102         o_conv.is_owned = false;
47103         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
47104         return ret_conv;
47105 }
47106
47107 jboolean  CS_LDK_UpdateFailMalformedHTLC_eq(int64_t a, int64_t b) {
47108         LDKUpdateFailMalformedHTLC a_conv;
47109         a_conv.inner = untag_ptr(a);
47110         a_conv.is_owned = ptr_is_owned(a);
47111         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47112         a_conv.is_owned = false;
47113         LDKUpdateFailMalformedHTLC b_conv;
47114         b_conv.inner = untag_ptr(b);
47115         b_conv.is_owned = ptr_is_owned(b);
47116         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47117         b_conv.is_owned = false;
47118         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
47119         return ret_conv;
47120 }
47121
47122 void  CS_LDK_CommitmentSigned_free(int64_t this_obj) {
47123         LDKCommitmentSigned this_obj_conv;
47124         this_obj_conv.inner = untag_ptr(this_obj);
47125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47127         CommitmentSigned_free(this_obj_conv);
47128 }
47129
47130 int8_tArray  CS_LDK_CommitmentSigned_get_channel_id(int64_t this_ptr) {
47131         LDKCommitmentSigned this_ptr_conv;
47132         this_ptr_conv.inner = untag_ptr(this_ptr);
47133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47135         this_ptr_conv.is_owned = false;
47136         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47137         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
47138         return ret_arr;
47139 }
47140
47141 void  CS_LDK_CommitmentSigned_set_channel_id(int64_t this_ptr, int8_tArray val) {
47142         LDKCommitmentSigned this_ptr_conv;
47143         this_ptr_conv.inner = untag_ptr(this_ptr);
47144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47146         this_ptr_conv.is_owned = false;
47147         LDKThirtyTwoBytes val_ref;
47148         CHECK(val->arr_len == 32);
47149         memcpy(val_ref.data, val->elems, 32); FREE(val);
47150         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
47151 }
47152
47153 int8_tArray  CS_LDK_CommitmentSigned_get_signature(int64_t this_ptr) {
47154         LDKCommitmentSigned this_ptr_conv;
47155         this_ptr_conv.inner = untag_ptr(this_ptr);
47156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47158         this_ptr_conv.is_owned = false;
47159         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47160         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
47161         return ret_arr;
47162 }
47163
47164 void  CS_LDK_CommitmentSigned_set_signature(int64_t this_ptr, int8_tArray val) {
47165         LDKCommitmentSigned this_ptr_conv;
47166         this_ptr_conv.inner = untag_ptr(this_ptr);
47167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47169         this_ptr_conv.is_owned = false;
47170         LDKECDSASignature val_ref;
47171         CHECK(val->arr_len == 64);
47172         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47173         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
47174 }
47175
47176 ptrArray  CS_LDK_CommitmentSigned_get_htlc_signatures(int64_t this_ptr) {
47177         LDKCommitmentSigned this_ptr_conv;
47178         this_ptr_conv.inner = untag_ptr(this_ptr);
47179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47181         this_ptr_conv.is_owned = false;
47182         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
47183         ptrArray ret_arr = NULL;
47184         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
47185         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
47186         for (size_t i = 0; i < ret_var.datalen; i++) {
47187                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
47188                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
47189                 ret_arr_ptr[i] = ret_conv_8_arr;
47190         }
47191         
47192         FREE(ret_var.data);
47193         return ret_arr;
47194 }
47195
47196 void  CS_LDK_CommitmentSigned_set_htlc_signatures(int64_t this_ptr, ptrArray val) {
47197         LDKCommitmentSigned this_ptr_conv;
47198         this_ptr_conv.inner = untag_ptr(this_ptr);
47199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47201         this_ptr_conv.is_owned = false;
47202         LDKCVec_ECDSASignatureZ val_constr;
47203         val_constr.datalen = val->arr_len;
47204         if (val_constr.datalen > 0)
47205                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47206         else
47207                 val_constr.data = NULL;
47208         int8_tArray* val_vals = (void*) val->elems;
47209         for (size_t i = 0; i < val_constr.datalen; i++) {
47210                 int8_tArray val_conv_8 = val_vals[i];
47211                 LDKECDSASignature val_conv_8_ref;
47212                 CHECK(val_conv_8->arr_len == 64);
47213                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
47214                 val_constr.data[i] = val_conv_8_ref;
47215         }
47216         FREE(val);
47217         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
47218 }
47219
47220 int64_t  CS_LDK_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
47221         LDKThirtyTwoBytes channel_id_arg_ref;
47222         CHECK(channel_id_arg->arr_len == 32);
47223         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47224         LDKECDSASignature signature_arg_ref;
47225         CHECK(signature_arg->arr_len == 64);
47226         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
47227         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
47228         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
47229         if (htlc_signatures_arg_constr.datalen > 0)
47230                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47231         else
47232                 htlc_signatures_arg_constr.data = NULL;
47233         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
47234         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
47235                 int8_tArray htlc_signatures_arg_conv_8 = htlc_signatures_arg_vals[i];
47236                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
47237                 CHECK(htlc_signatures_arg_conv_8->arr_len == 64);
47238                 memcpy(htlc_signatures_arg_conv_8_ref.compact_form, htlc_signatures_arg_conv_8->elems, 64); FREE(htlc_signatures_arg_conv_8);
47239                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
47240         }
47241         FREE(htlc_signatures_arg);
47242         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
47243         int64_t ret_ref = 0;
47244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47246         return ret_ref;
47247 }
47248
47249 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
47250         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
47251         int64_t ret_ref = 0;
47252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47254         return ret_ref;
47255 }
47256 int64_t  CS_LDK_CommitmentSigned_clone_ptr(int64_t arg) {
47257         LDKCommitmentSigned arg_conv;
47258         arg_conv.inner = untag_ptr(arg);
47259         arg_conv.is_owned = ptr_is_owned(arg);
47260         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47261         arg_conv.is_owned = false;
47262         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
47263         return ret_conv;
47264 }
47265
47266 int64_t  CS_LDK_CommitmentSigned_clone(int64_t orig) {
47267         LDKCommitmentSigned orig_conv;
47268         orig_conv.inner = untag_ptr(orig);
47269         orig_conv.is_owned = ptr_is_owned(orig);
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47271         orig_conv.is_owned = false;
47272         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
47273         int64_t ret_ref = 0;
47274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47276         return ret_ref;
47277 }
47278
47279 int64_t  CS_LDK_CommitmentSigned_hash(int64_t o) {
47280         LDKCommitmentSigned o_conv;
47281         o_conv.inner = untag_ptr(o);
47282         o_conv.is_owned = ptr_is_owned(o);
47283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47284         o_conv.is_owned = false;
47285         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
47286         return ret_conv;
47287 }
47288
47289 jboolean  CS_LDK_CommitmentSigned_eq(int64_t a, int64_t b) {
47290         LDKCommitmentSigned a_conv;
47291         a_conv.inner = untag_ptr(a);
47292         a_conv.is_owned = ptr_is_owned(a);
47293         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47294         a_conv.is_owned = false;
47295         LDKCommitmentSigned b_conv;
47296         b_conv.inner = untag_ptr(b);
47297         b_conv.is_owned = ptr_is_owned(b);
47298         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47299         b_conv.is_owned = false;
47300         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
47301         return ret_conv;
47302 }
47303
47304 void  CS_LDK_RevokeAndACK_free(int64_t this_obj) {
47305         LDKRevokeAndACK this_obj_conv;
47306         this_obj_conv.inner = untag_ptr(this_obj);
47307         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47309         RevokeAndACK_free(this_obj_conv);
47310 }
47311
47312 int8_tArray  CS_LDK_RevokeAndACK_get_channel_id(int64_t this_ptr) {
47313         LDKRevokeAndACK this_ptr_conv;
47314         this_ptr_conv.inner = untag_ptr(this_ptr);
47315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47317         this_ptr_conv.is_owned = false;
47318         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47319         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
47320         return ret_arr;
47321 }
47322
47323 void  CS_LDK_RevokeAndACK_set_channel_id(int64_t this_ptr, int8_tArray val) {
47324         LDKRevokeAndACK this_ptr_conv;
47325         this_ptr_conv.inner = untag_ptr(this_ptr);
47326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47328         this_ptr_conv.is_owned = false;
47329         LDKThirtyTwoBytes val_ref;
47330         CHECK(val->arr_len == 32);
47331         memcpy(val_ref.data, val->elems, 32); FREE(val);
47332         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
47333 }
47334
47335 int8_tArray  CS_LDK_RevokeAndACK_get_per_commitment_secret(int64_t this_ptr) {
47336         LDKRevokeAndACK this_ptr_conv;
47337         this_ptr_conv.inner = untag_ptr(this_ptr);
47338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47340         this_ptr_conv.is_owned = false;
47341         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47342         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
47343         return ret_arr;
47344 }
47345
47346 void  CS_LDK_RevokeAndACK_set_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
47347         LDKRevokeAndACK this_ptr_conv;
47348         this_ptr_conv.inner = untag_ptr(this_ptr);
47349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47351         this_ptr_conv.is_owned = false;
47352         LDKThirtyTwoBytes val_ref;
47353         CHECK(val->arr_len == 32);
47354         memcpy(val_ref.data, val->elems, 32); FREE(val);
47355         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
47356 }
47357
47358 int8_tArray  CS_LDK_RevokeAndACK_get_next_per_commitment_point(int64_t this_ptr) {
47359         LDKRevokeAndACK this_ptr_conv;
47360         this_ptr_conv.inner = untag_ptr(this_ptr);
47361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47363         this_ptr_conv.is_owned = false;
47364         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47365         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47366         return ret_arr;
47367 }
47368
47369 void  CS_LDK_RevokeAndACK_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47370         LDKRevokeAndACK this_ptr_conv;
47371         this_ptr_conv.inner = untag_ptr(this_ptr);
47372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47374         this_ptr_conv.is_owned = false;
47375         LDKPublicKey val_ref;
47376         CHECK(val->arr_len == 33);
47377         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47378         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47379 }
47380
47381 int64_t  CS_LDK_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
47382         LDKThirtyTwoBytes channel_id_arg_ref;
47383         CHECK(channel_id_arg->arr_len == 32);
47384         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47385         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
47386         CHECK(per_commitment_secret_arg->arr_len == 32);
47387         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
47388         LDKPublicKey next_per_commitment_point_arg_ref;
47389         CHECK(next_per_commitment_point_arg->arr_len == 33);
47390         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
47391         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
47392         int64_t ret_ref = 0;
47393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47395         return ret_ref;
47396 }
47397
47398 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47399         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47400         int64_t ret_ref = 0;
47401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47403         return ret_ref;
47404 }
47405 int64_t  CS_LDK_RevokeAndACK_clone_ptr(int64_t arg) {
47406         LDKRevokeAndACK arg_conv;
47407         arg_conv.inner = untag_ptr(arg);
47408         arg_conv.is_owned = ptr_is_owned(arg);
47409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47410         arg_conv.is_owned = false;
47411         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47412         return ret_conv;
47413 }
47414
47415 int64_t  CS_LDK_RevokeAndACK_clone(int64_t orig) {
47416         LDKRevokeAndACK orig_conv;
47417         orig_conv.inner = untag_ptr(orig);
47418         orig_conv.is_owned = ptr_is_owned(orig);
47419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47420         orig_conv.is_owned = false;
47421         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47422         int64_t ret_ref = 0;
47423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47425         return ret_ref;
47426 }
47427
47428 int64_t  CS_LDK_RevokeAndACK_hash(int64_t o) {
47429         LDKRevokeAndACK o_conv;
47430         o_conv.inner = untag_ptr(o);
47431         o_conv.is_owned = ptr_is_owned(o);
47432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47433         o_conv.is_owned = false;
47434         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
47435         return ret_conv;
47436 }
47437
47438 jboolean  CS_LDK_RevokeAndACK_eq(int64_t a, int64_t b) {
47439         LDKRevokeAndACK a_conv;
47440         a_conv.inner = untag_ptr(a);
47441         a_conv.is_owned = ptr_is_owned(a);
47442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47443         a_conv.is_owned = false;
47444         LDKRevokeAndACK b_conv;
47445         b_conv.inner = untag_ptr(b);
47446         b_conv.is_owned = ptr_is_owned(b);
47447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47448         b_conv.is_owned = false;
47449         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47450         return ret_conv;
47451 }
47452
47453 void  CS_LDK_UpdateFee_free(int64_t this_obj) {
47454         LDKUpdateFee this_obj_conv;
47455         this_obj_conv.inner = untag_ptr(this_obj);
47456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47458         UpdateFee_free(this_obj_conv);
47459 }
47460
47461 int8_tArray  CS_LDK_UpdateFee_get_channel_id(int64_t this_ptr) {
47462         LDKUpdateFee this_ptr_conv;
47463         this_ptr_conv.inner = untag_ptr(this_ptr);
47464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47466         this_ptr_conv.is_owned = false;
47467         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47468         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
47469         return ret_arr;
47470 }
47471
47472 void  CS_LDK_UpdateFee_set_channel_id(int64_t this_ptr, int8_tArray val) {
47473         LDKUpdateFee this_ptr_conv;
47474         this_ptr_conv.inner = untag_ptr(this_ptr);
47475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47477         this_ptr_conv.is_owned = false;
47478         LDKThirtyTwoBytes val_ref;
47479         CHECK(val->arr_len == 32);
47480         memcpy(val_ref.data, val->elems, 32); FREE(val);
47481         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47482 }
47483
47484 int32_t  CS_LDK_UpdateFee_get_feerate_per_kw(int64_t this_ptr) {
47485         LDKUpdateFee this_ptr_conv;
47486         this_ptr_conv.inner = untag_ptr(this_ptr);
47487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47489         this_ptr_conv.is_owned = false;
47490         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47491         return ret_conv;
47492 }
47493
47494 void  CS_LDK_UpdateFee_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
47495         LDKUpdateFee this_ptr_conv;
47496         this_ptr_conv.inner = untag_ptr(this_ptr);
47497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47499         this_ptr_conv.is_owned = false;
47500         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47501 }
47502
47503 int64_t  CS_LDK_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
47504         LDKThirtyTwoBytes channel_id_arg_ref;
47505         CHECK(channel_id_arg->arr_len == 32);
47506         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47507         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
47508         int64_t ret_ref = 0;
47509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47511         return ret_ref;
47512 }
47513
47514 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47515         LDKUpdateFee ret_var = UpdateFee_clone(arg);
47516         int64_t ret_ref = 0;
47517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47519         return ret_ref;
47520 }
47521 int64_t  CS_LDK_UpdateFee_clone_ptr(int64_t arg) {
47522         LDKUpdateFee arg_conv;
47523         arg_conv.inner = untag_ptr(arg);
47524         arg_conv.is_owned = ptr_is_owned(arg);
47525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47526         arg_conv.is_owned = false;
47527         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
47528         return ret_conv;
47529 }
47530
47531 int64_t  CS_LDK_UpdateFee_clone(int64_t orig) {
47532         LDKUpdateFee orig_conv;
47533         orig_conv.inner = untag_ptr(orig);
47534         orig_conv.is_owned = ptr_is_owned(orig);
47535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47536         orig_conv.is_owned = false;
47537         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
47538         int64_t ret_ref = 0;
47539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47541         return ret_ref;
47542 }
47543
47544 int64_t  CS_LDK_UpdateFee_hash(int64_t o) {
47545         LDKUpdateFee o_conv;
47546         o_conv.inner = untag_ptr(o);
47547         o_conv.is_owned = ptr_is_owned(o);
47548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47549         o_conv.is_owned = false;
47550         int64_t ret_conv = UpdateFee_hash(&o_conv);
47551         return ret_conv;
47552 }
47553
47554 jboolean  CS_LDK_UpdateFee_eq(int64_t a, int64_t b) {
47555         LDKUpdateFee a_conv;
47556         a_conv.inner = untag_ptr(a);
47557         a_conv.is_owned = ptr_is_owned(a);
47558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47559         a_conv.is_owned = false;
47560         LDKUpdateFee b_conv;
47561         b_conv.inner = untag_ptr(b);
47562         b_conv.is_owned = ptr_is_owned(b);
47563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47564         b_conv.is_owned = false;
47565         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47566         return ret_conv;
47567 }
47568
47569 void  CS_LDK_ChannelReestablish_free(int64_t this_obj) {
47570         LDKChannelReestablish this_obj_conv;
47571         this_obj_conv.inner = untag_ptr(this_obj);
47572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47574         ChannelReestablish_free(this_obj_conv);
47575 }
47576
47577 int8_tArray  CS_LDK_ChannelReestablish_get_channel_id(int64_t this_ptr) {
47578         LDKChannelReestablish this_ptr_conv;
47579         this_ptr_conv.inner = untag_ptr(this_ptr);
47580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47582         this_ptr_conv.is_owned = false;
47583         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47584         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
47585         return ret_arr;
47586 }
47587
47588 void  CS_LDK_ChannelReestablish_set_channel_id(int64_t this_ptr, int8_tArray val) {
47589         LDKChannelReestablish this_ptr_conv;
47590         this_ptr_conv.inner = untag_ptr(this_ptr);
47591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47593         this_ptr_conv.is_owned = false;
47594         LDKThirtyTwoBytes val_ref;
47595         CHECK(val->arr_len == 32);
47596         memcpy(val_ref.data, val->elems, 32); FREE(val);
47597         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47598 }
47599
47600 int64_t  CS_LDK_ChannelReestablish_get_next_local_commitment_number(int64_t this_ptr) {
47601         LDKChannelReestablish this_ptr_conv;
47602         this_ptr_conv.inner = untag_ptr(this_ptr);
47603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47605         this_ptr_conv.is_owned = false;
47606         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47607         return ret_conv;
47608 }
47609
47610 void  CS_LDK_ChannelReestablish_set_next_local_commitment_number(int64_t this_ptr, int64_t val) {
47611         LDKChannelReestablish this_ptr_conv;
47612         this_ptr_conv.inner = untag_ptr(this_ptr);
47613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47615         this_ptr_conv.is_owned = false;
47616         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47617 }
47618
47619 int64_t  CS_LDK_ChannelReestablish_get_next_remote_commitment_number(int64_t this_ptr) {
47620         LDKChannelReestablish this_ptr_conv;
47621         this_ptr_conv.inner = untag_ptr(this_ptr);
47622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47624         this_ptr_conv.is_owned = false;
47625         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47626         return ret_conv;
47627 }
47628
47629 void  CS_LDK_ChannelReestablish_set_next_remote_commitment_number(int64_t this_ptr, int64_t val) {
47630         LDKChannelReestablish this_ptr_conv;
47631         this_ptr_conv.inner = untag_ptr(this_ptr);
47632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47634         this_ptr_conv.is_owned = false;
47635         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47636 }
47637
47638 int8_tArray  CS_LDK_ChannelReestablish_get_your_last_per_commitment_secret(int64_t this_ptr) {
47639         LDKChannelReestablish this_ptr_conv;
47640         this_ptr_conv.inner = untag_ptr(this_ptr);
47641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47643         this_ptr_conv.is_owned = false;
47644         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47645         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
47646         return ret_arr;
47647 }
47648
47649 void  CS_LDK_ChannelReestablish_set_your_last_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
47650         LDKChannelReestablish this_ptr_conv;
47651         this_ptr_conv.inner = untag_ptr(this_ptr);
47652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47654         this_ptr_conv.is_owned = false;
47655         LDKThirtyTwoBytes val_ref;
47656         CHECK(val->arr_len == 32);
47657         memcpy(val_ref.data, val->elems, 32); FREE(val);
47658         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
47659 }
47660
47661 int8_tArray  CS_LDK_ChannelReestablish_get_my_current_per_commitment_point(int64_t this_ptr) {
47662         LDKChannelReestablish this_ptr_conv;
47663         this_ptr_conv.inner = untag_ptr(this_ptr);
47664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47666         this_ptr_conv.is_owned = false;
47667         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47668         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47669         return ret_arr;
47670 }
47671
47672 void  CS_LDK_ChannelReestablish_set_my_current_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47673         LDKChannelReestablish this_ptr_conv;
47674         this_ptr_conv.inner = untag_ptr(this_ptr);
47675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47677         this_ptr_conv.is_owned = false;
47678         LDKPublicKey val_ref;
47679         CHECK(val->arr_len == 33);
47680         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47681         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
47682 }
47683
47684 int64_t  CS_LDK_ChannelReestablish_get_next_funding_txid(int64_t this_ptr) {
47685         LDKChannelReestablish this_ptr_conv;
47686         this_ptr_conv.inner = untag_ptr(this_ptr);
47687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47689         this_ptr_conv.is_owned = false;
47690         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
47691         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
47692         int64_t ret_ref = tag_ptr(ret_copy, true);
47693         return ret_ref;
47694 }
47695
47696 void  CS_LDK_ChannelReestablish_set_next_funding_txid(int64_t this_ptr, int64_t val) {
47697         LDKChannelReestablish this_ptr_conv;
47698         this_ptr_conv.inner = untag_ptr(this_ptr);
47699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47701         this_ptr_conv.is_owned = false;
47702         void* val_ptr = untag_ptr(val);
47703         CHECK_ACCESS(val_ptr);
47704         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
47705         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
47706         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
47707 }
47708
47709 int64_t  CS_LDK_ChannelReestablish_new(int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
47710         LDKThirtyTwoBytes channel_id_arg_ref;
47711         CHECK(channel_id_arg->arr_len == 32);
47712         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47713         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
47714         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
47715         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
47716         LDKPublicKey my_current_per_commitment_point_arg_ref;
47717         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
47718         memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33); FREE(my_current_per_commitment_point_arg);
47719         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
47720         CHECK_ACCESS(next_funding_txid_arg_ptr);
47721         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
47722         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
47723         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
47724         int64_t ret_ref = 0;
47725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47727         return ret_ref;
47728 }
47729
47730 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
47731         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
47732         int64_t ret_ref = 0;
47733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47735         return ret_ref;
47736 }
47737 int64_t  CS_LDK_ChannelReestablish_clone_ptr(int64_t arg) {
47738         LDKChannelReestablish arg_conv;
47739         arg_conv.inner = untag_ptr(arg);
47740         arg_conv.is_owned = ptr_is_owned(arg);
47741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47742         arg_conv.is_owned = false;
47743         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
47744         return ret_conv;
47745 }
47746
47747 int64_t  CS_LDK_ChannelReestablish_clone(int64_t orig) {
47748         LDKChannelReestablish orig_conv;
47749         orig_conv.inner = untag_ptr(orig);
47750         orig_conv.is_owned = ptr_is_owned(orig);
47751         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47752         orig_conv.is_owned = false;
47753         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
47754         int64_t ret_ref = 0;
47755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47757         return ret_ref;
47758 }
47759
47760 int64_t  CS_LDK_ChannelReestablish_hash(int64_t o) {
47761         LDKChannelReestablish o_conv;
47762         o_conv.inner = untag_ptr(o);
47763         o_conv.is_owned = ptr_is_owned(o);
47764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47765         o_conv.is_owned = false;
47766         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
47767         return ret_conv;
47768 }
47769
47770 jboolean  CS_LDK_ChannelReestablish_eq(int64_t a, int64_t b) {
47771         LDKChannelReestablish a_conv;
47772         a_conv.inner = untag_ptr(a);
47773         a_conv.is_owned = ptr_is_owned(a);
47774         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47775         a_conv.is_owned = false;
47776         LDKChannelReestablish b_conv;
47777         b_conv.inner = untag_ptr(b);
47778         b_conv.is_owned = ptr_is_owned(b);
47779         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47780         b_conv.is_owned = false;
47781         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
47782         return ret_conv;
47783 }
47784
47785 void  CS_LDK_AnnouncementSignatures_free(int64_t this_obj) {
47786         LDKAnnouncementSignatures this_obj_conv;
47787         this_obj_conv.inner = untag_ptr(this_obj);
47788         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47790         AnnouncementSignatures_free(this_obj_conv);
47791 }
47792
47793 int8_tArray  CS_LDK_AnnouncementSignatures_get_channel_id(int64_t this_ptr) {
47794         LDKAnnouncementSignatures this_ptr_conv;
47795         this_ptr_conv.inner = untag_ptr(this_ptr);
47796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47798         this_ptr_conv.is_owned = false;
47799         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47800         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
47801         return ret_arr;
47802 }
47803
47804 void  CS_LDK_AnnouncementSignatures_set_channel_id(int64_t this_ptr, int8_tArray val) {
47805         LDKAnnouncementSignatures this_ptr_conv;
47806         this_ptr_conv.inner = untag_ptr(this_ptr);
47807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47809         this_ptr_conv.is_owned = false;
47810         LDKThirtyTwoBytes val_ref;
47811         CHECK(val->arr_len == 32);
47812         memcpy(val_ref.data, val->elems, 32); FREE(val);
47813         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
47814 }
47815
47816 int64_t  CS_LDK_AnnouncementSignatures_get_short_channel_id(int64_t this_ptr) {
47817         LDKAnnouncementSignatures this_ptr_conv;
47818         this_ptr_conv.inner = untag_ptr(this_ptr);
47819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47821         this_ptr_conv.is_owned = false;
47822         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
47823         return ret_conv;
47824 }
47825
47826 void  CS_LDK_AnnouncementSignatures_set_short_channel_id(int64_t this_ptr, int64_t val) {
47827         LDKAnnouncementSignatures 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         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
47833 }
47834
47835 int8_tArray  CS_LDK_AnnouncementSignatures_get_node_signature(int64_t this_ptr) {
47836         LDKAnnouncementSignatures this_ptr_conv;
47837         this_ptr_conv.inner = untag_ptr(this_ptr);
47838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47840         this_ptr_conv.is_owned = false;
47841         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47842         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
47843         return ret_arr;
47844 }
47845
47846 void  CS_LDK_AnnouncementSignatures_set_node_signature(int64_t this_ptr, int8_tArray val) {
47847         LDKAnnouncementSignatures this_ptr_conv;
47848         this_ptr_conv.inner = untag_ptr(this_ptr);
47849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47851         this_ptr_conv.is_owned = false;
47852         LDKECDSASignature val_ref;
47853         CHECK(val->arr_len == 64);
47854         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47855         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
47856 }
47857
47858 int8_tArray  CS_LDK_AnnouncementSignatures_get_bitcoin_signature(int64_t this_ptr) {
47859         LDKAnnouncementSignatures this_ptr_conv;
47860         this_ptr_conv.inner = untag_ptr(this_ptr);
47861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47863         this_ptr_conv.is_owned = false;
47864         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47865         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
47866         return ret_arr;
47867 }
47868
47869 void  CS_LDK_AnnouncementSignatures_set_bitcoin_signature(int64_t this_ptr, int8_tArray val) {
47870         LDKAnnouncementSignatures this_ptr_conv;
47871         this_ptr_conv.inner = untag_ptr(this_ptr);
47872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47874         this_ptr_conv.is_owned = false;
47875         LDKECDSASignature val_ref;
47876         CHECK(val->arr_len == 64);
47877         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47878         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
47879 }
47880
47881 int64_t  CS_LDK_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
47882         LDKThirtyTwoBytes channel_id_arg_ref;
47883         CHECK(channel_id_arg->arr_len == 32);
47884         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47885         LDKECDSASignature node_signature_arg_ref;
47886         CHECK(node_signature_arg->arr_len == 64);
47887         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
47888         LDKECDSASignature bitcoin_signature_arg_ref;
47889         CHECK(bitcoin_signature_arg->arr_len == 64);
47890         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
47891         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
47892         int64_t ret_ref = 0;
47893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47895         return ret_ref;
47896 }
47897
47898 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
47899         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
47900         int64_t ret_ref = 0;
47901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47903         return ret_ref;
47904 }
47905 int64_t  CS_LDK_AnnouncementSignatures_clone_ptr(int64_t arg) {
47906         LDKAnnouncementSignatures arg_conv;
47907         arg_conv.inner = untag_ptr(arg);
47908         arg_conv.is_owned = ptr_is_owned(arg);
47909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47910         arg_conv.is_owned = false;
47911         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
47912         return ret_conv;
47913 }
47914
47915 int64_t  CS_LDK_AnnouncementSignatures_clone(int64_t orig) {
47916         LDKAnnouncementSignatures orig_conv;
47917         orig_conv.inner = untag_ptr(orig);
47918         orig_conv.is_owned = ptr_is_owned(orig);
47919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47920         orig_conv.is_owned = false;
47921         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
47922         int64_t ret_ref = 0;
47923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47925         return ret_ref;
47926 }
47927
47928 int64_t  CS_LDK_AnnouncementSignatures_hash(int64_t o) {
47929         LDKAnnouncementSignatures o_conv;
47930         o_conv.inner = untag_ptr(o);
47931         o_conv.is_owned = ptr_is_owned(o);
47932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47933         o_conv.is_owned = false;
47934         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
47935         return ret_conv;
47936 }
47937
47938 jboolean  CS_LDK_AnnouncementSignatures_eq(int64_t a, int64_t b) {
47939         LDKAnnouncementSignatures a_conv;
47940         a_conv.inner = untag_ptr(a);
47941         a_conv.is_owned = ptr_is_owned(a);
47942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47943         a_conv.is_owned = false;
47944         LDKAnnouncementSignatures b_conv;
47945         b_conv.inner = untag_ptr(b);
47946         b_conv.is_owned = ptr_is_owned(b);
47947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47948         b_conv.is_owned = false;
47949         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
47950         return ret_conv;
47951 }
47952
47953 void  CS_LDK_SocketAddress_free(int64_t this_ptr) {
47954         if (!ptr_is_owned(this_ptr)) return;
47955         void* this_ptr_ptr = untag_ptr(this_ptr);
47956         CHECK_ACCESS(this_ptr_ptr);
47957         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
47958         FREE(untag_ptr(this_ptr));
47959         SocketAddress_free(this_ptr_conv);
47960 }
47961
47962 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
47963         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47964         *ret_copy = SocketAddress_clone(arg);
47965         int64_t ret_ref = tag_ptr(ret_copy, true);
47966         return ret_ref;
47967 }
47968 int64_t  CS_LDK_SocketAddress_clone_ptr(int64_t arg) {
47969         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
47970         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
47971         return ret_conv;
47972 }
47973
47974 int64_t  CS_LDK_SocketAddress_clone(int64_t orig) {
47975         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
47976         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47977         *ret_copy = SocketAddress_clone(orig_conv);
47978         int64_t ret_ref = tag_ptr(ret_copy, true);
47979         return ret_ref;
47980 }
47981
47982 int64_t  CS_LDK_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
47983         LDKFourBytes addr_ref;
47984         CHECK(addr->arr_len == 4);
47985         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
47986         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47987         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
47988         int64_t ret_ref = tag_ptr(ret_copy, true);
47989         return ret_ref;
47990 }
47991
47992 int64_t  CS_LDK_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
47993         LDKSixteenBytes addr_ref;
47994         CHECK(addr->arr_len == 16);
47995         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
47996         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47997         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
47998         int64_t ret_ref = tag_ptr(ret_copy, true);
47999         return ret_ref;
48000 }
48001
48002 int64_t  CS_LDK_SocketAddress_onion_v2(int8_tArray a) {
48003         LDKTwelveBytes a_ref;
48004         CHECK(a->arr_len == 12);
48005         memcpy(a_ref.data, a->elems, 12); FREE(a);
48006         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48007         *ret_copy = SocketAddress_onion_v2(a_ref);
48008         int64_t ret_ref = tag_ptr(ret_copy, true);
48009         return ret_ref;
48010 }
48011
48012 int64_t  CS_LDK_SocketAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
48013         LDKThirtyTwoBytes ed25519_pubkey_ref;
48014         CHECK(ed25519_pubkey->arr_len == 32);
48015         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
48016         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48017         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
48018         int64_t ret_ref = tag_ptr(ret_copy, true);
48019         return ret_ref;
48020 }
48021
48022 int64_t  CS_LDK_SocketAddress_hostname(int64_t hostname, int16_t port) {
48023         LDKHostname hostname_conv;
48024         hostname_conv.inner = untag_ptr(hostname);
48025         hostname_conv.is_owned = ptr_is_owned(hostname);
48026         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
48027         hostname_conv = Hostname_clone(&hostname_conv);
48028         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48029         *ret_copy = SocketAddress_hostname(hostname_conv, port);
48030         int64_t ret_ref = tag_ptr(ret_copy, true);
48031         return ret_ref;
48032 }
48033
48034 int64_t  CS_LDK_SocketAddress_hash(int64_t o) {
48035         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
48036         int64_t ret_conv = SocketAddress_hash(o_conv);
48037         return ret_conv;
48038 }
48039
48040 jboolean  CS_LDK_SocketAddress_eq(int64_t a, int64_t b) {
48041         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
48042         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
48043         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
48044         return ret_conv;
48045 }
48046
48047 int8_tArray  CS_LDK_SocketAddress_write(int64_t obj) {
48048         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
48049         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
48050         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48051         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48052         CVec_u8Z_free(ret_var);
48053         return ret_arr;
48054 }
48055
48056 int64_t  CS_LDK_SocketAddress_read(int8_tArray ser) {
48057         LDKu8slice ser_ref;
48058         ser_ref.datalen = ser->arr_len;
48059         ser_ref.data = ser->elems;
48060         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
48061         *ret_conv = SocketAddress_read(ser_ref);
48062         FREE(ser);
48063         return tag_ptr(ret_conv, true);
48064 }
48065
48066 int32_t  CS_LDK_SocketAddressParseError_clone(int64_t orig) {
48067         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
48068         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_clone(orig_conv));
48069         return ret_conv;
48070 }
48071
48072 int32_t  CS_LDK_SocketAddressParseError_socket_addr_parse() {
48073         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_socket_addr_parse());
48074         return ret_conv;
48075 }
48076
48077 int32_t  CS_LDK_SocketAddressParseError_invalid_input() {
48078         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_input());
48079         return ret_conv;
48080 }
48081
48082 int32_t  CS_LDK_SocketAddressParseError_invalid_port() {
48083         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_port());
48084         return ret_conv;
48085 }
48086
48087 int32_t  CS_LDK_SocketAddressParseError_invalid_onion_v3() {
48088         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_onion_v3());
48089         return ret_conv;
48090 }
48091
48092 int64_t  CS_LDK_SocketAddressParseError_hash(int64_t o) {
48093         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
48094         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
48095         return ret_conv;
48096 }
48097
48098 jboolean  CS_LDK_SocketAddressParseError_eq(int64_t a, int64_t b) {
48099         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
48100         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
48101         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
48102         return ret_conv;
48103 }
48104
48105 int64_t  CS_LDK_parse_onion_address(jstring host, int16_t port) {
48106         LDKStr host_conv = str_ref_to_owned_c(host);
48107         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48108         *ret_conv = parse_onion_address(host_conv, port);
48109         return tag_ptr(ret_conv, true);
48110 }
48111
48112 jstring  CS_LDK_SocketAddress_to_str(int64_t o) {
48113         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
48114         LDKStr ret_str = SocketAddress_to_str(o_conv);
48115         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
48116         Str_free(ret_str);
48117         return ret_conv;
48118 }
48119
48120 int64_t  CS_LDK_SocketAddress_from_str(jstring s) {
48121         LDKStr s_conv = str_ref_to_owned_c(s);
48122         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48123         *ret_conv = SocketAddress_from_str(s_conv);
48124         return tag_ptr(ret_conv, true);
48125 }
48126
48127 void  CS_LDK_UnsignedGossipMessage_free(int64_t this_ptr) {
48128         if (!ptr_is_owned(this_ptr)) return;
48129         void* this_ptr_ptr = untag_ptr(this_ptr);
48130         CHECK_ACCESS(this_ptr_ptr);
48131         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
48132         FREE(untag_ptr(this_ptr));
48133         UnsignedGossipMessage_free(this_ptr_conv);
48134 }
48135
48136 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
48137         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48138         *ret_copy = UnsignedGossipMessage_clone(arg);
48139         int64_t ret_ref = tag_ptr(ret_copy, true);
48140         return ret_ref;
48141 }
48142 int64_t  CS_LDK_UnsignedGossipMessage_clone_ptr(int64_t arg) {
48143         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
48144         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
48145         return ret_conv;
48146 }
48147
48148 int64_t  CS_LDK_UnsignedGossipMessage_clone(int64_t orig) {
48149         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
48150         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48151         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
48152         int64_t ret_ref = tag_ptr(ret_copy, true);
48153         return ret_ref;
48154 }
48155
48156 int64_t  CS_LDK_UnsignedGossipMessage_channel_announcement(int64_t a) {
48157         LDKUnsignedChannelAnnouncement a_conv;
48158         a_conv.inner = untag_ptr(a);
48159         a_conv.is_owned = ptr_is_owned(a);
48160         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48161         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
48162         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48163         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
48164         int64_t ret_ref = tag_ptr(ret_copy, true);
48165         return ret_ref;
48166 }
48167
48168 int64_t  CS_LDK_UnsignedGossipMessage_channel_update(int64_t a) {
48169         LDKUnsignedChannelUpdate a_conv;
48170         a_conv.inner = untag_ptr(a);
48171         a_conv.is_owned = ptr_is_owned(a);
48172         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48173         a_conv = UnsignedChannelUpdate_clone(&a_conv);
48174         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48175         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
48176         int64_t ret_ref = tag_ptr(ret_copy, true);
48177         return ret_ref;
48178 }
48179
48180 int64_t  CS_LDK_UnsignedGossipMessage_node_announcement(int64_t a) {
48181         LDKUnsignedNodeAnnouncement a_conv;
48182         a_conv.inner = untag_ptr(a);
48183         a_conv.is_owned = ptr_is_owned(a);
48184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48185         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
48186         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48187         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
48188         int64_t ret_ref = tag_ptr(ret_copy, true);
48189         return ret_ref;
48190 }
48191
48192 int8_tArray  CS_LDK_UnsignedGossipMessage_write(int64_t obj) {
48193         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
48194         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
48195         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48196         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48197         CVec_u8Z_free(ret_var);
48198         return ret_arr;
48199 }
48200
48201 void  CS_LDK_UnsignedNodeAnnouncement_free(int64_t this_obj) {
48202         LDKUnsignedNodeAnnouncement this_obj_conv;
48203         this_obj_conv.inner = untag_ptr(this_obj);
48204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48206         UnsignedNodeAnnouncement_free(this_obj_conv);
48207 }
48208
48209 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_features(int64_t this_ptr) {
48210         LDKUnsignedNodeAnnouncement this_ptr_conv;
48211         this_ptr_conv.inner = untag_ptr(this_ptr);
48212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48214         this_ptr_conv.is_owned = false;
48215         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
48216         int64_t ret_ref = 0;
48217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48219         return ret_ref;
48220 }
48221
48222 void  CS_LDK_UnsignedNodeAnnouncement_set_features(int64_t this_ptr, int64_t val) {
48223         LDKUnsignedNodeAnnouncement this_ptr_conv;
48224         this_ptr_conv.inner = untag_ptr(this_ptr);
48225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48227         this_ptr_conv.is_owned = false;
48228         LDKNodeFeatures val_conv;
48229         val_conv.inner = untag_ptr(val);
48230         val_conv.is_owned = ptr_is_owned(val);
48231         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48232         val_conv = NodeFeatures_clone(&val_conv);
48233         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
48234 }
48235
48236 int32_t  CS_LDK_UnsignedNodeAnnouncement_get_timestamp(int64_t this_ptr) {
48237         LDKUnsignedNodeAnnouncement this_ptr_conv;
48238         this_ptr_conv.inner = untag_ptr(this_ptr);
48239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48241         this_ptr_conv.is_owned = false;
48242         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
48243         return ret_conv;
48244 }
48245
48246 void  CS_LDK_UnsignedNodeAnnouncement_set_timestamp(int64_t this_ptr, int32_t val) {
48247         LDKUnsignedNodeAnnouncement this_ptr_conv;
48248         this_ptr_conv.inner = untag_ptr(this_ptr);
48249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48251         this_ptr_conv.is_owned = false;
48252         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
48253 }
48254
48255 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_node_id(int64_t this_ptr) {
48256         LDKUnsignedNodeAnnouncement this_ptr_conv;
48257         this_ptr_conv.inner = untag_ptr(this_ptr);
48258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48260         this_ptr_conv.is_owned = false;
48261         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
48262         int64_t ret_ref = 0;
48263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48265         return ret_ref;
48266 }
48267
48268 void  CS_LDK_UnsignedNodeAnnouncement_set_node_id(int64_t this_ptr, int64_t val) {
48269         LDKUnsignedNodeAnnouncement this_ptr_conv;
48270         this_ptr_conv.inner = untag_ptr(this_ptr);
48271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48273         this_ptr_conv.is_owned = false;
48274         LDKNodeId val_conv;
48275         val_conv.inner = untag_ptr(val);
48276         val_conv.is_owned = ptr_is_owned(val);
48277         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48278         val_conv = NodeId_clone(&val_conv);
48279         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
48280 }
48281
48282 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_rgb(int64_t this_ptr) {
48283         LDKUnsignedNodeAnnouncement this_ptr_conv;
48284         this_ptr_conv.inner = untag_ptr(this_ptr);
48285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48287         this_ptr_conv.is_owned = false;
48288         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
48289         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
48290         return ret_arr;
48291 }
48292
48293 void  CS_LDK_UnsignedNodeAnnouncement_set_rgb(int64_t this_ptr, int8_tArray val) {
48294         LDKUnsignedNodeAnnouncement this_ptr_conv;
48295         this_ptr_conv.inner = untag_ptr(this_ptr);
48296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48298         this_ptr_conv.is_owned = false;
48299         LDKThreeBytes val_ref;
48300         CHECK(val->arr_len == 3);
48301         memcpy(val_ref.data, val->elems, 3); FREE(val);
48302         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
48303 }
48304
48305 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_alias(int64_t this_ptr) {
48306         LDKUnsignedNodeAnnouncement this_ptr_conv;
48307         this_ptr_conv.inner = untag_ptr(this_ptr);
48308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48310         this_ptr_conv.is_owned = false;
48311         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
48312         int64_t ret_ref = 0;
48313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48315         return ret_ref;
48316 }
48317
48318 void  CS_LDK_UnsignedNodeAnnouncement_set_alias(int64_t this_ptr, int64_t val) {
48319         LDKUnsignedNodeAnnouncement this_ptr_conv;
48320         this_ptr_conv.inner = untag_ptr(this_ptr);
48321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48323         this_ptr_conv.is_owned = false;
48324         LDKNodeAlias val_conv;
48325         val_conv.inner = untag_ptr(val);
48326         val_conv.is_owned = ptr_is_owned(val);
48327         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48328         val_conv = NodeAlias_clone(&val_conv);
48329         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
48330 }
48331
48332 int64_tArray  CS_LDK_UnsignedNodeAnnouncement_get_addresses(int64_t this_ptr) {
48333         LDKUnsignedNodeAnnouncement this_ptr_conv;
48334         this_ptr_conv.inner = untag_ptr(this_ptr);
48335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48337         this_ptr_conv.is_owned = false;
48338         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
48339         int64_tArray ret_arr = NULL;
48340         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
48341         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
48342         for (size_t p = 0; p < ret_var.datalen; p++) {
48343                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48344                 *ret_conv_15_copy = ret_var.data[p];
48345                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
48346                 ret_arr_ptr[p] = ret_conv_15_ref;
48347         }
48348         
48349         FREE(ret_var.data);
48350         return ret_arr;
48351 }
48352
48353 void  CS_LDK_UnsignedNodeAnnouncement_set_addresses(int64_t this_ptr, int64_tArray val) {
48354         LDKUnsignedNodeAnnouncement this_ptr_conv;
48355         this_ptr_conv.inner = untag_ptr(this_ptr);
48356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48358         this_ptr_conv.is_owned = false;
48359         LDKCVec_SocketAddressZ val_constr;
48360         val_constr.datalen = val->arr_len;
48361         if (val_constr.datalen > 0)
48362                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
48363         else
48364                 val_constr.data = NULL;
48365         int64_t* val_vals = val->elems;
48366         for (size_t p = 0; p < val_constr.datalen; p++) {
48367                 int64_t val_conv_15 = val_vals[p];
48368                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
48369                 CHECK_ACCESS(val_conv_15_ptr);
48370                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
48371                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
48372                 val_constr.data[p] = val_conv_15_conv;
48373         }
48374         FREE(val);
48375         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
48376 }
48377
48378 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
48379         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
48380         int64_t ret_ref = 0;
48381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48383         return ret_ref;
48384 }
48385 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone_ptr(int64_t arg) {
48386         LDKUnsignedNodeAnnouncement arg_conv;
48387         arg_conv.inner = untag_ptr(arg);
48388         arg_conv.is_owned = ptr_is_owned(arg);
48389         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48390         arg_conv.is_owned = false;
48391         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
48392         return ret_conv;
48393 }
48394
48395 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone(int64_t orig) {
48396         LDKUnsignedNodeAnnouncement orig_conv;
48397         orig_conv.inner = untag_ptr(orig);
48398         orig_conv.is_owned = ptr_is_owned(orig);
48399         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48400         orig_conv.is_owned = false;
48401         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48402         int64_t ret_ref = 0;
48403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48405         return ret_ref;
48406 }
48407
48408 int64_t  CS_LDK_UnsignedNodeAnnouncement_hash(int64_t o) {
48409         LDKUnsignedNodeAnnouncement o_conv;
48410         o_conv.inner = untag_ptr(o);
48411         o_conv.is_owned = ptr_is_owned(o);
48412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48413         o_conv.is_owned = false;
48414         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
48415         return ret_conv;
48416 }
48417
48418 jboolean  CS_LDK_UnsignedNodeAnnouncement_eq(int64_t a, int64_t b) {
48419         LDKUnsignedNodeAnnouncement a_conv;
48420         a_conv.inner = untag_ptr(a);
48421         a_conv.is_owned = ptr_is_owned(a);
48422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48423         a_conv.is_owned = false;
48424         LDKUnsignedNodeAnnouncement b_conv;
48425         b_conv.inner = untag_ptr(b);
48426         b_conv.is_owned = ptr_is_owned(b);
48427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48428         b_conv.is_owned = false;
48429         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48430         return ret_conv;
48431 }
48432
48433 void  CS_LDK_NodeAnnouncement_free(int64_t this_obj) {
48434         LDKNodeAnnouncement this_obj_conv;
48435         this_obj_conv.inner = untag_ptr(this_obj);
48436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48438         NodeAnnouncement_free(this_obj_conv);
48439 }
48440
48441 int8_tArray  CS_LDK_NodeAnnouncement_get_signature(int64_t this_ptr) {
48442         LDKNodeAnnouncement this_ptr_conv;
48443         this_ptr_conv.inner = untag_ptr(this_ptr);
48444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48446         this_ptr_conv.is_owned = false;
48447         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48448         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
48449         return ret_arr;
48450 }
48451
48452 void  CS_LDK_NodeAnnouncement_set_signature(int64_t this_ptr, int8_tArray val) {
48453         LDKNodeAnnouncement this_ptr_conv;
48454         this_ptr_conv.inner = untag_ptr(this_ptr);
48455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48457         this_ptr_conv.is_owned = false;
48458         LDKECDSASignature val_ref;
48459         CHECK(val->arr_len == 64);
48460         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48461         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48462 }
48463
48464 int64_t  CS_LDK_NodeAnnouncement_get_contents(int64_t this_ptr) {
48465         LDKNodeAnnouncement this_ptr_conv;
48466         this_ptr_conv.inner = untag_ptr(this_ptr);
48467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48469         this_ptr_conv.is_owned = false;
48470         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48471         int64_t ret_ref = 0;
48472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48474         return ret_ref;
48475 }
48476
48477 void  CS_LDK_NodeAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
48478         LDKNodeAnnouncement this_ptr_conv;
48479         this_ptr_conv.inner = untag_ptr(this_ptr);
48480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48482         this_ptr_conv.is_owned = false;
48483         LDKUnsignedNodeAnnouncement val_conv;
48484         val_conv.inner = untag_ptr(val);
48485         val_conv.is_owned = ptr_is_owned(val);
48486         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48487         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48488         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48489 }
48490
48491 int64_t  CS_LDK_NodeAnnouncement_new(int8_tArray signature_arg, int64_t contents_arg) {
48492         LDKECDSASignature signature_arg_ref;
48493         CHECK(signature_arg->arr_len == 64);
48494         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48495         LDKUnsignedNodeAnnouncement contents_arg_conv;
48496         contents_arg_conv.inner = untag_ptr(contents_arg);
48497         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48498         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48499         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48500         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48501         int64_t ret_ref = 0;
48502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48504         return ret_ref;
48505 }
48506
48507 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48508         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48509         int64_t ret_ref = 0;
48510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48512         return ret_ref;
48513 }
48514 int64_t  CS_LDK_NodeAnnouncement_clone_ptr(int64_t arg) {
48515         LDKNodeAnnouncement arg_conv;
48516         arg_conv.inner = untag_ptr(arg);
48517         arg_conv.is_owned = ptr_is_owned(arg);
48518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48519         arg_conv.is_owned = false;
48520         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48521         return ret_conv;
48522 }
48523
48524 int64_t  CS_LDK_NodeAnnouncement_clone(int64_t orig) {
48525         LDKNodeAnnouncement orig_conv;
48526         orig_conv.inner = untag_ptr(orig);
48527         orig_conv.is_owned = ptr_is_owned(orig);
48528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48529         orig_conv.is_owned = false;
48530         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48531         int64_t ret_ref = 0;
48532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48534         return ret_ref;
48535 }
48536
48537 int64_t  CS_LDK_NodeAnnouncement_hash(int64_t o) {
48538         LDKNodeAnnouncement o_conv;
48539         o_conv.inner = untag_ptr(o);
48540         o_conv.is_owned = ptr_is_owned(o);
48541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48542         o_conv.is_owned = false;
48543         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
48544         return ret_conv;
48545 }
48546
48547 jboolean  CS_LDK_NodeAnnouncement_eq(int64_t a, int64_t b) {
48548         LDKNodeAnnouncement a_conv;
48549         a_conv.inner = untag_ptr(a);
48550         a_conv.is_owned = ptr_is_owned(a);
48551         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48552         a_conv.is_owned = false;
48553         LDKNodeAnnouncement b_conv;
48554         b_conv.inner = untag_ptr(b);
48555         b_conv.is_owned = ptr_is_owned(b);
48556         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48557         b_conv.is_owned = false;
48558         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48559         return ret_conv;
48560 }
48561
48562 void  CS_LDK_UnsignedChannelAnnouncement_free(int64_t this_obj) {
48563         LDKUnsignedChannelAnnouncement this_obj_conv;
48564         this_obj_conv.inner = untag_ptr(this_obj);
48565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48567         UnsignedChannelAnnouncement_free(this_obj_conv);
48568 }
48569
48570 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_features(int64_t this_ptr) {
48571         LDKUnsignedChannelAnnouncement this_ptr_conv;
48572         this_ptr_conv.inner = untag_ptr(this_ptr);
48573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48575         this_ptr_conv.is_owned = false;
48576         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48577         int64_t ret_ref = 0;
48578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48580         return ret_ref;
48581 }
48582
48583 void  CS_LDK_UnsignedChannelAnnouncement_set_features(int64_t this_ptr, int64_t val) {
48584         LDKUnsignedChannelAnnouncement this_ptr_conv;
48585         this_ptr_conv.inner = untag_ptr(this_ptr);
48586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48588         this_ptr_conv.is_owned = false;
48589         LDKChannelFeatures val_conv;
48590         val_conv.inner = untag_ptr(val);
48591         val_conv.is_owned = ptr_is_owned(val);
48592         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48593         val_conv = ChannelFeatures_clone(&val_conv);
48594         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48595 }
48596
48597 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_chain_hash(int64_t this_ptr) {
48598         LDKUnsignedChannelAnnouncement this_ptr_conv;
48599         this_ptr_conv.inner = untag_ptr(this_ptr);
48600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48602         this_ptr_conv.is_owned = false;
48603         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48604         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
48605         return ret_arr;
48606 }
48607
48608 void  CS_LDK_UnsignedChannelAnnouncement_set_chain_hash(int64_t this_ptr, int8_tArray val) {
48609         LDKUnsignedChannelAnnouncement this_ptr_conv;
48610         this_ptr_conv.inner = untag_ptr(this_ptr);
48611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48613         this_ptr_conv.is_owned = false;
48614         LDKThirtyTwoBytes val_ref;
48615         CHECK(val->arr_len == 32);
48616         memcpy(val_ref.data, val->elems, 32); FREE(val);
48617         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48618 }
48619
48620 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_short_channel_id(int64_t this_ptr) {
48621         LDKUnsignedChannelAnnouncement this_ptr_conv;
48622         this_ptr_conv.inner = untag_ptr(this_ptr);
48623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48625         this_ptr_conv.is_owned = false;
48626         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48627         return ret_conv;
48628 }
48629
48630 void  CS_LDK_UnsignedChannelAnnouncement_set_short_channel_id(int64_t this_ptr, int64_t val) {
48631         LDKUnsignedChannelAnnouncement this_ptr_conv;
48632         this_ptr_conv.inner = untag_ptr(this_ptr);
48633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48635         this_ptr_conv.is_owned = false;
48636         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48637 }
48638
48639 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_1(int64_t this_ptr) {
48640         LDKUnsignedChannelAnnouncement this_ptr_conv;
48641         this_ptr_conv.inner = untag_ptr(this_ptr);
48642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48644         this_ptr_conv.is_owned = false;
48645         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48646         int64_t ret_ref = 0;
48647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48649         return ret_ref;
48650 }
48651
48652 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_1(int64_t this_ptr, int64_t val) {
48653         LDKUnsignedChannelAnnouncement this_ptr_conv;
48654         this_ptr_conv.inner = untag_ptr(this_ptr);
48655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48657         this_ptr_conv.is_owned = false;
48658         LDKNodeId val_conv;
48659         val_conv.inner = untag_ptr(val);
48660         val_conv.is_owned = ptr_is_owned(val);
48661         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48662         val_conv = NodeId_clone(&val_conv);
48663         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48664 }
48665
48666 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_2(int64_t this_ptr) {
48667         LDKUnsignedChannelAnnouncement this_ptr_conv;
48668         this_ptr_conv.inner = untag_ptr(this_ptr);
48669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48671         this_ptr_conv.is_owned = false;
48672         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48673         int64_t ret_ref = 0;
48674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48676         return ret_ref;
48677 }
48678
48679 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_2(int64_t this_ptr, int64_t val) {
48680         LDKUnsignedChannelAnnouncement 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         LDKNodeId val_conv;
48686         val_conv.inner = untag_ptr(val);
48687         val_conv.is_owned = ptr_is_owned(val);
48688         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48689         val_conv = NodeId_clone(&val_conv);
48690         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48691 }
48692
48693 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_1(int64_t this_ptr) {
48694         LDKUnsignedChannelAnnouncement this_ptr_conv;
48695         this_ptr_conv.inner = untag_ptr(this_ptr);
48696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48698         this_ptr_conv.is_owned = false;
48699         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48700         int64_t ret_ref = 0;
48701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48703         return ret_ref;
48704 }
48705
48706 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_1(int64_t this_ptr, int64_t val) {
48707         LDKUnsignedChannelAnnouncement this_ptr_conv;
48708         this_ptr_conv.inner = untag_ptr(this_ptr);
48709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48711         this_ptr_conv.is_owned = false;
48712         LDKNodeId val_conv;
48713         val_conv.inner = untag_ptr(val);
48714         val_conv.is_owned = ptr_is_owned(val);
48715         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48716         val_conv = NodeId_clone(&val_conv);
48717         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
48718 }
48719
48720 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_2(int64_t this_ptr) {
48721         LDKUnsignedChannelAnnouncement this_ptr_conv;
48722         this_ptr_conv.inner = untag_ptr(this_ptr);
48723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48725         this_ptr_conv.is_owned = false;
48726         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
48727         int64_t ret_ref = 0;
48728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48730         return ret_ref;
48731 }
48732
48733 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_2(int64_t this_ptr, int64_t val) {
48734         LDKUnsignedChannelAnnouncement this_ptr_conv;
48735         this_ptr_conv.inner = untag_ptr(this_ptr);
48736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48738         this_ptr_conv.is_owned = false;
48739         LDKNodeId val_conv;
48740         val_conv.inner = untag_ptr(val);
48741         val_conv.is_owned = ptr_is_owned(val);
48742         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48743         val_conv = NodeId_clone(&val_conv);
48744         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
48745 }
48746
48747 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_excess_data(int64_t this_ptr) {
48748         LDKUnsignedChannelAnnouncement this_ptr_conv;
48749         this_ptr_conv.inner = untag_ptr(this_ptr);
48750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48752         this_ptr_conv.is_owned = false;
48753         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
48754         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48755         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48756         CVec_u8Z_free(ret_var);
48757         return ret_arr;
48758 }
48759
48760 void  CS_LDK_UnsignedChannelAnnouncement_set_excess_data(int64_t this_ptr, int8_tArray val) {
48761         LDKUnsignedChannelAnnouncement this_ptr_conv;
48762         this_ptr_conv.inner = untag_ptr(this_ptr);
48763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48765         this_ptr_conv.is_owned = false;
48766         LDKCVec_u8Z val_ref;
48767         val_ref.datalen = val->arr_len;
48768         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48769         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48770         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
48771 }
48772
48773 int64_t  CS_LDK_UnsignedChannelAnnouncement_new(int64_t features_arg, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int64_t node_id_1_arg, int64_t node_id_2_arg, int64_t bitcoin_key_1_arg, int64_t bitcoin_key_2_arg, int8_tArray excess_data_arg) {
48774         LDKChannelFeatures features_arg_conv;
48775         features_arg_conv.inner = untag_ptr(features_arg);
48776         features_arg_conv.is_owned = ptr_is_owned(features_arg);
48777         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
48778         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
48779         LDKThirtyTwoBytes chain_hash_arg_ref;
48780         CHECK(chain_hash_arg->arr_len == 32);
48781         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48782         LDKNodeId node_id_1_arg_conv;
48783         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
48784         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
48785         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
48786         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
48787         LDKNodeId node_id_2_arg_conv;
48788         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
48789         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
48790         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
48791         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
48792         LDKNodeId bitcoin_key_1_arg_conv;
48793         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
48794         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
48795         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
48796         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
48797         LDKNodeId bitcoin_key_2_arg_conv;
48798         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
48799         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
48800         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
48801         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
48802         LDKCVec_u8Z excess_data_arg_ref;
48803         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
48804         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48805         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
48806         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_new(features_arg_conv, chain_hash_arg_ref, short_channel_id_arg, node_id_1_arg_conv, node_id_2_arg_conv, bitcoin_key_1_arg_conv, bitcoin_key_2_arg_conv, excess_data_arg_ref);
48807         int64_t ret_ref = 0;
48808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48810         return ret_ref;
48811 }
48812
48813 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
48814         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
48815         int64_t ret_ref = 0;
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48818         return ret_ref;
48819 }
48820 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone_ptr(int64_t arg) {
48821         LDKUnsignedChannelAnnouncement arg_conv;
48822         arg_conv.inner = untag_ptr(arg);
48823         arg_conv.is_owned = ptr_is_owned(arg);
48824         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48825         arg_conv.is_owned = false;
48826         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
48827         return ret_conv;
48828 }
48829
48830 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone(int64_t orig) {
48831         LDKUnsignedChannelAnnouncement orig_conv;
48832         orig_conv.inner = untag_ptr(orig);
48833         orig_conv.is_owned = ptr_is_owned(orig);
48834         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48835         orig_conv.is_owned = false;
48836         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
48837         int64_t ret_ref = 0;
48838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48840         return ret_ref;
48841 }
48842
48843 int64_t  CS_LDK_UnsignedChannelAnnouncement_hash(int64_t o) {
48844         LDKUnsignedChannelAnnouncement o_conv;
48845         o_conv.inner = untag_ptr(o);
48846         o_conv.is_owned = ptr_is_owned(o);
48847         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48848         o_conv.is_owned = false;
48849         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
48850         return ret_conv;
48851 }
48852
48853 jboolean  CS_LDK_UnsignedChannelAnnouncement_eq(int64_t a, int64_t b) {
48854         LDKUnsignedChannelAnnouncement a_conv;
48855         a_conv.inner = untag_ptr(a);
48856         a_conv.is_owned = ptr_is_owned(a);
48857         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48858         a_conv.is_owned = false;
48859         LDKUnsignedChannelAnnouncement b_conv;
48860         b_conv.inner = untag_ptr(b);
48861         b_conv.is_owned = ptr_is_owned(b);
48862         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48863         b_conv.is_owned = false;
48864         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
48865         return ret_conv;
48866 }
48867
48868 void  CS_LDK_ChannelAnnouncement_free(int64_t this_obj) {
48869         LDKChannelAnnouncement this_obj_conv;
48870         this_obj_conv.inner = untag_ptr(this_obj);
48871         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48873         ChannelAnnouncement_free(this_obj_conv);
48874 }
48875
48876 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_1(int64_t this_ptr) {
48877         LDKChannelAnnouncement this_ptr_conv;
48878         this_ptr_conv.inner = untag_ptr(this_ptr);
48879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48881         this_ptr_conv.is_owned = false;
48882         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48883         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
48884         return ret_arr;
48885 }
48886
48887 void  CS_LDK_ChannelAnnouncement_set_node_signature_1(int64_t this_ptr, int8_tArray val) {
48888         LDKChannelAnnouncement this_ptr_conv;
48889         this_ptr_conv.inner = untag_ptr(this_ptr);
48890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48892         this_ptr_conv.is_owned = false;
48893         LDKECDSASignature val_ref;
48894         CHECK(val->arr_len == 64);
48895         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48896         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
48897 }
48898
48899 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_2(int64_t this_ptr) {
48900         LDKChannelAnnouncement this_ptr_conv;
48901         this_ptr_conv.inner = untag_ptr(this_ptr);
48902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48904         this_ptr_conv.is_owned = false;
48905         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48906         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
48907         return ret_arr;
48908 }
48909
48910 void  CS_LDK_ChannelAnnouncement_set_node_signature_2(int64_t this_ptr, int8_tArray val) {
48911         LDKChannelAnnouncement this_ptr_conv;
48912         this_ptr_conv.inner = untag_ptr(this_ptr);
48913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48915         this_ptr_conv.is_owned = false;
48916         LDKECDSASignature val_ref;
48917         CHECK(val->arr_len == 64);
48918         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48919         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
48920 }
48921
48922 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_1(int64_t this_ptr) {
48923         LDKChannelAnnouncement this_ptr_conv;
48924         this_ptr_conv.inner = untag_ptr(this_ptr);
48925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48927         this_ptr_conv.is_owned = false;
48928         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48929         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
48930         return ret_arr;
48931 }
48932
48933 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_1(int64_t this_ptr, int8_tArray val) {
48934         LDKChannelAnnouncement this_ptr_conv;
48935         this_ptr_conv.inner = untag_ptr(this_ptr);
48936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48938         this_ptr_conv.is_owned = false;
48939         LDKECDSASignature val_ref;
48940         CHECK(val->arr_len == 64);
48941         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48942         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
48943 }
48944
48945 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_2(int64_t this_ptr) {
48946         LDKChannelAnnouncement this_ptr_conv;
48947         this_ptr_conv.inner = untag_ptr(this_ptr);
48948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48950         this_ptr_conv.is_owned = false;
48951         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48952         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
48953         return ret_arr;
48954 }
48955
48956 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_2(int64_t this_ptr, int8_tArray val) {
48957         LDKChannelAnnouncement this_ptr_conv;
48958         this_ptr_conv.inner = untag_ptr(this_ptr);
48959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48961         this_ptr_conv.is_owned = false;
48962         LDKECDSASignature val_ref;
48963         CHECK(val->arr_len == 64);
48964         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48965         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
48966 }
48967
48968 int64_t  CS_LDK_ChannelAnnouncement_get_contents(int64_t this_ptr) {
48969         LDKChannelAnnouncement this_ptr_conv;
48970         this_ptr_conv.inner = untag_ptr(this_ptr);
48971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48973         this_ptr_conv.is_owned = false;
48974         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
48975         int64_t ret_ref = 0;
48976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48978         return ret_ref;
48979 }
48980
48981 void  CS_LDK_ChannelAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
48982         LDKChannelAnnouncement this_ptr_conv;
48983         this_ptr_conv.inner = untag_ptr(this_ptr);
48984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48986         this_ptr_conv.is_owned = false;
48987         LDKUnsignedChannelAnnouncement val_conv;
48988         val_conv.inner = untag_ptr(val);
48989         val_conv.is_owned = ptr_is_owned(val);
48990         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48991         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
48992         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
48993 }
48994
48995 int64_t  CS_LDK_ChannelAnnouncement_new(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) {
48996         LDKECDSASignature node_signature_1_arg_ref;
48997         CHECK(node_signature_1_arg->arr_len == 64);
48998         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
48999         LDKECDSASignature node_signature_2_arg_ref;
49000         CHECK(node_signature_2_arg->arr_len == 64);
49001         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
49002         LDKECDSASignature bitcoin_signature_1_arg_ref;
49003         CHECK(bitcoin_signature_1_arg->arr_len == 64);
49004         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
49005         LDKECDSASignature bitcoin_signature_2_arg_ref;
49006         CHECK(bitcoin_signature_2_arg->arr_len == 64);
49007         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
49008         LDKUnsignedChannelAnnouncement contents_arg_conv;
49009         contents_arg_conv.inner = untag_ptr(contents_arg);
49010         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49011         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49012         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
49013         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);
49014         int64_t ret_ref = 0;
49015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49017         return ret_ref;
49018 }
49019
49020 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
49021         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
49022         int64_t ret_ref = 0;
49023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49025         return ret_ref;
49026 }
49027 int64_t  CS_LDK_ChannelAnnouncement_clone_ptr(int64_t arg) {
49028         LDKChannelAnnouncement arg_conv;
49029         arg_conv.inner = untag_ptr(arg);
49030         arg_conv.is_owned = ptr_is_owned(arg);
49031         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49032         arg_conv.is_owned = false;
49033         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
49034         return ret_conv;
49035 }
49036
49037 int64_t  CS_LDK_ChannelAnnouncement_clone(int64_t orig) {
49038         LDKChannelAnnouncement orig_conv;
49039         orig_conv.inner = untag_ptr(orig);
49040         orig_conv.is_owned = ptr_is_owned(orig);
49041         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49042         orig_conv.is_owned = false;
49043         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
49044         int64_t ret_ref = 0;
49045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49047         return ret_ref;
49048 }
49049
49050 int64_t  CS_LDK_ChannelAnnouncement_hash(int64_t o) {
49051         LDKChannelAnnouncement o_conv;
49052         o_conv.inner = untag_ptr(o);
49053         o_conv.is_owned = ptr_is_owned(o);
49054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49055         o_conv.is_owned = false;
49056         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
49057         return ret_conv;
49058 }
49059
49060 jboolean  CS_LDK_ChannelAnnouncement_eq(int64_t a, int64_t b) {
49061         LDKChannelAnnouncement a_conv;
49062         a_conv.inner = untag_ptr(a);
49063         a_conv.is_owned = ptr_is_owned(a);
49064         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49065         a_conv.is_owned = false;
49066         LDKChannelAnnouncement b_conv;
49067         b_conv.inner = untag_ptr(b);
49068         b_conv.is_owned = ptr_is_owned(b);
49069         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49070         b_conv.is_owned = false;
49071         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
49072         return ret_conv;
49073 }
49074
49075 void  CS_LDK_UnsignedChannelUpdate_free(int64_t this_obj) {
49076         LDKUnsignedChannelUpdate this_obj_conv;
49077         this_obj_conv.inner = untag_ptr(this_obj);
49078         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49080         UnsignedChannelUpdate_free(this_obj_conv);
49081 }
49082
49083 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_chain_hash(int64_t this_ptr) {
49084         LDKUnsignedChannelUpdate this_ptr_conv;
49085         this_ptr_conv.inner = untag_ptr(this_ptr);
49086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49088         this_ptr_conv.is_owned = false;
49089         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49090         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
49091         return ret_arr;
49092 }
49093
49094 void  CS_LDK_UnsignedChannelUpdate_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49095         LDKUnsignedChannelUpdate this_ptr_conv;
49096         this_ptr_conv.inner = untag_ptr(this_ptr);
49097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49099         this_ptr_conv.is_owned = false;
49100         LDKThirtyTwoBytes val_ref;
49101         CHECK(val->arr_len == 32);
49102         memcpy(val_ref.data, val->elems, 32); FREE(val);
49103         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
49104 }
49105
49106 int64_t  CS_LDK_UnsignedChannelUpdate_get_short_channel_id(int64_t this_ptr) {
49107         LDKUnsignedChannelUpdate this_ptr_conv;
49108         this_ptr_conv.inner = untag_ptr(this_ptr);
49109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49111         this_ptr_conv.is_owned = false;
49112         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
49113         return ret_conv;
49114 }
49115
49116 void  CS_LDK_UnsignedChannelUpdate_set_short_channel_id(int64_t this_ptr, int64_t val) {
49117         LDKUnsignedChannelUpdate this_ptr_conv;
49118         this_ptr_conv.inner = untag_ptr(this_ptr);
49119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49121         this_ptr_conv.is_owned = false;
49122         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
49123 }
49124
49125 int32_t  CS_LDK_UnsignedChannelUpdate_get_timestamp(int64_t this_ptr) {
49126         LDKUnsignedChannelUpdate this_ptr_conv;
49127         this_ptr_conv.inner = untag_ptr(this_ptr);
49128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49130         this_ptr_conv.is_owned = false;
49131         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
49132         return ret_conv;
49133 }
49134
49135 void  CS_LDK_UnsignedChannelUpdate_set_timestamp(int64_t this_ptr, int32_t val) {
49136         LDKUnsignedChannelUpdate this_ptr_conv;
49137         this_ptr_conv.inner = untag_ptr(this_ptr);
49138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49140         this_ptr_conv.is_owned = false;
49141         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
49142 }
49143
49144 int8_t  CS_LDK_UnsignedChannelUpdate_get_flags(int64_t this_ptr) {
49145         LDKUnsignedChannelUpdate this_ptr_conv;
49146         this_ptr_conv.inner = untag_ptr(this_ptr);
49147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49149         this_ptr_conv.is_owned = false;
49150         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
49151         return ret_conv;
49152 }
49153
49154 void  CS_LDK_UnsignedChannelUpdate_set_flags(int64_t this_ptr, int8_t val) {
49155         LDKUnsignedChannelUpdate this_ptr_conv;
49156         this_ptr_conv.inner = untag_ptr(this_ptr);
49157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49159         this_ptr_conv.is_owned = false;
49160         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
49161 }
49162
49163 int16_t  CS_LDK_UnsignedChannelUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
49164         LDKUnsignedChannelUpdate this_ptr_conv;
49165         this_ptr_conv.inner = untag_ptr(this_ptr);
49166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49168         this_ptr_conv.is_owned = false;
49169         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
49170         return ret_conv;
49171 }
49172
49173 void  CS_LDK_UnsignedChannelUpdate_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
49174         LDKUnsignedChannelUpdate this_ptr_conv;
49175         this_ptr_conv.inner = untag_ptr(this_ptr);
49176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49178         this_ptr_conv.is_owned = false;
49179         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
49180 }
49181
49182 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_minimum_msat(int64_t this_ptr) {
49183         LDKUnsignedChannelUpdate this_ptr_conv;
49184         this_ptr_conv.inner = untag_ptr(this_ptr);
49185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49187         this_ptr_conv.is_owned = false;
49188         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
49189         return ret_conv;
49190 }
49191
49192 void  CS_LDK_UnsignedChannelUpdate_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
49193         LDKUnsignedChannelUpdate this_ptr_conv;
49194         this_ptr_conv.inner = untag_ptr(this_ptr);
49195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49197         this_ptr_conv.is_owned = false;
49198         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
49199 }
49200
49201 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_maximum_msat(int64_t this_ptr) {
49202         LDKUnsignedChannelUpdate this_ptr_conv;
49203         this_ptr_conv.inner = untag_ptr(this_ptr);
49204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49206         this_ptr_conv.is_owned = false;
49207         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
49208         return ret_conv;
49209 }
49210
49211 void  CS_LDK_UnsignedChannelUpdate_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
49212         LDKUnsignedChannelUpdate this_ptr_conv;
49213         this_ptr_conv.inner = untag_ptr(this_ptr);
49214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49216         this_ptr_conv.is_owned = false;
49217         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
49218 }
49219
49220 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_base_msat(int64_t this_ptr) {
49221         LDKUnsignedChannelUpdate this_ptr_conv;
49222         this_ptr_conv.inner = untag_ptr(this_ptr);
49223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49225         this_ptr_conv.is_owned = false;
49226         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
49227         return ret_conv;
49228 }
49229
49230 void  CS_LDK_UnsignedChannelUpdate_set_fee_base_msat(int64_t this_ptr, int32_t val) {
49231         LDKUnsignedChannelUpdate this_ptr_conv;
49232         this_ptr_conv.inner = untag_ptr(this_ptr);
49233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49235         this_ptr_conv.is_owned = false;
49236         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
49237 }
49238
49239 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_proportional_millionths(int64_t this_ptr) {
49240         LDKUnsignedChannelUpdate this_ptr_conv;
49241         this_ptr_conv.inner = untag_ptr(this_ptr);
49242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49244         this_ptr_conv.is_owned = false;
49245         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
49246         return ret_conv;
49247 }
49248
49249 void  CS_LDK_UnsignedChannelUpdate_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
49250         LDKUnsignedChannelUpdate this_ptr_conv;
49251         this_ptr_conv.inner = untag_ptr(this_ptr);
49252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49254         this_ptr_conv.is_owned = false;
49255         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
49256 }
49257
49258 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_excess_data(int64_t this_ptr) {
49259         LDKUnsignedChannelUpdate this_ptr_conv;
49260         this_ptr_conv.inner = untag_ptr(this_ptr);
49261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49263         this_ptr_conv.is_owned = false;
49264         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
49265         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49266         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49267         CVec_u8Z_free(ret_var);
49268         return ret_arr;
49269 }
49270
49271 void  CS_LDK_UnsignedChannelUpdate_set_excess_data(int64_t this_ptr, int8_tArray val) {
49272         LDKUnsignedChannelUpdate this_ptr_conv;
49273         this_ptr_conv.inner = untag_ptr(this_ptr);
49274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49276         this_ptr_conv.is_owned = false;
49277         LDKCVec_u8Z val_ref;
49278         val_ref.datalen = val->arr_len;
49279         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49280         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49281         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
49282 }
49283
49284 int64_t  CS_LDK_UnsignedChannelUpdate_new(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) {
49285         LDKThirtyTwoBytes chain_hash_arg_ref;
49286         CHECK(chain_hash_arg->arr_len == 32);
49287         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49288         LDKCVec_u8Z excess_data_arg_ref;
49289         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
49290         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49291         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
49292         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);
49293         int64_t ret_ref = 0;
49294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49296         return ret_ref;
49297 }
49298
49299 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
49300         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
49301         int64_t ret_ref = 0;
49302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49304         return ret_ref;
49305 }
49306 int64_t  CS_LDK_UnsignedChannelUpdate_clone_ptr(int64_t arg) {
49307         LDKUnsignedChannelUpdate arg_conv;
49308         arg_conv.inner = untag_ptr(arg);
49309         arg_conv.is_owned = ptr_is_owned(arg);
49310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49311         arg_conv.is_owned = false;
49312         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
49313         return ret_conv;
49314 }
49315
49316 int64_t  CS_LDK_UnsignedChannelUpdate_clone(int64_t orig) {
49317         LDKUnsignedChannelUpdate orig_conv;
49318         orig_conv.inner = untag_ptr(orig);
49319         orig_conv.is_owned = ptr_is_owned(orig);
49320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49321         orig_conv.is_owned = false;
49322         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
49323         int64_t ret_ref = 0;
49324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49326         return ret_ref;
49327 }
49328
49329 int64_t  CS_LDK_UnsignedChannelUpdate_hash(int64_t o) {
49330         LDKUnsignedChannelUpdate o_conv;
49331         o_conv.inner = untag_ptr(o);
49332         o_conv.is_owned = ptr_is_owned(o);
49333         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49334         o_conv.is_owned = false;
49335         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
49336         return ret_conv;
49337 }
49338
49339 jboolean  CS_LDK_UnsignedChannelUpdate_eq(int64_t a, int64_t b) {
49340         LDKUnsignedChannelUpdate a_conv;
49341         a_conv.inner = untag_ptr(a);
49342         a_conv.is_owned = ptr_is_owned(a);
49343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49344         a_conv.is_owned = false;
49345         LDKUnsignedChannelUpdate b_conv;
49346         b_conv.inner = untag_ptr(b);
49347         b_conv.is_owned = ptr_is_owned(b);
49348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49349         b_conv.is_owned = false;
49350         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
49351         return ret_conv;
49352 }
49353
49354 void  CS_LDK_ChannelUpdate_free(int64_t this_obj) {
49355         LDKChannelUpdate this_obj_conv;
49356         this_obj_conv.inner = untag_ptr(this_obj);
49357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49359         ChannelUpdate_free(this_obj_conv);
49360 }
49361
49362 int8_tArray  CS_LDK_ChannelUpdate_get_signature(int64_t this_ptr) {
49363         LDKChannelUpdate this_ptr_conv;
49364         this_ptr_conv.inner = untag_ptr(this_ptr);
49365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49367         this_ptr_conv.is_owned = false;
49368         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49369         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
49370         return ret_arr;
49371 }
49372
49373 void  CS_LDK_ChannelUpdate_set_signature(int64_t this_ptr, int8_tArray val) {
49374         LDKChannelUpdate this_ptr_conv;
49375         this_ptr_conv.inner = untag_ptr(this_ptr);
49376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49378         this_ptr_conv.is_owned = false;
49379         LDKECDSASignature val_ref;
49380         CHECK(val->arr_len == 64);
49381         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
49382         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
49383 }
49384
49385 int64_t  CS_LDK_ChannelUpdate_get_contents(int64_t this_ptr) {
49386         LDKChannelUpdate this_ptr_conv;
49387         this_ptr_conv.inner = untag_ptr(this_ptr);
49388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49390         this_ptr_conv.is_owned = false;
49391         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
49392         int64_t ret_ref = 0;
49393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49395         return ret_ref;
49396 }
49397
49398 void  CS_LDK_ChannelUpdate_set_contents(int64_t this_ptr, int64_t val) {
49399         LDKChannelUpdate this_ptr_conv;
49400         this_ptr_conv.inner = untag_ptr(this_ptr);
49401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49403         this_ptr_conv.is_owned = false;
49404         LDKUnsignedChannelUpdate val_conv;
49405         val_conv.inner = untag_ptr(val);
49406         val_conv.is_owned = ptr_is_owned(val);
49407         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49408         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49409         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49410 }
49411
49412 int64_t  CS_LDK_ChannelUpdate_new(int8_tArray signature_arg, int64_t contents_arg) {
49413         LDKECDSASignature signature_arg_ref;
49414         CHECK(signature_arg->arr_len == 64);
49415         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
49416         LDKUnsignedChannelUpdate contents_arg_conv;
49417         contents_arg_conv.inner = untag_ptr(contents_arg);
49418         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49419         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49420         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49421         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49422         int64_t ret_ref = 0;
49423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49425         return ret_ref;
49426 }
49427
49428 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49429         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49430         int64_t ret_ref = 0;
49431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49433         return ret_ref;
49434 }
49435 int64_t  CS_LDK_ChannelUpdate_clone_ptr(int64_t arg) {
49436         LDKChannelUpdate arg_conv;
49437         arg_conv.inner = untag_ptr(arg);
49438         arg_conv.is_owned = ptr_is_owned(arg);
49439         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49440         arg_conv.is_owned = false;
49441         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49442         return ret_conv;
49443 }
49444
49445 int64_t  CS_LDK_ChannelUpdate_clone(int64_t orig) {
49446         LDKChannelUpdate orig_conv;
49447         orig_conv.inner = untag_ptr(orig);
49448         orig_conv.is_owned = ptr_is_owned(orig);
49449         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49450         orig_conv.is_owned = false;
49451         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49452         int64_t ret_ref = 0;
49453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49455         return ret_ref;
49456 }
49457
49458 int64_t  CS_LDK_ChannelUpdate_hash(int64_t o) {
49459         LDKChannelUpdate o_conv;
49460         o_conv.inner = untag_ptr(o);
49461         o_conv.is_owned = ptr_is_owned(o);
49462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49463         o_conv.is_owned = false;
49464         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
49465         return ret_conv;
49466 }
49467
49468 jboolean  CS_LDK_ChannelUpdate_eq(int64_t a, int64_t b) {
49469         LDKChannelUpdate a_conv;
49470         a_conv.inner = untag_ptr(a);
49471         a_conv.is_owned = ptr_is_owned(a);
49472         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49473         a_conv.is_owned = false;
49474         LDKChannelUpdate b_conv;
49475         b_conv.inner = untag_ptr(b);
49476         b_conv.is_owned = ptr_is_owned(b);
49477         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49478         b_conv.is_owned = false;
49479         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49480         return ret_conv;
49481 }
49482
49483 void  CS_LDK_QueryChannelRange_free(int64_t this_obj) {
49484         LDKQueryChannelRange this_obj_conv;
49485         this_obj_conv.inner = untag_ptr(this_obj);
49486         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49488         QueryChannelRange_free(this_obj_conv);
49489 }
49490
49491 int8_tArray  CS_LDK_QueryChannelRange_get_chain_hash(int64_t this_ptr) {
49492         LDKQueryChannelRange this_ptr_conv;
49493         this_ptr_conv.inner = untag_ptr(this_ptr);
49494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49496         this_ptr_conv.is_owned = false;
49497         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49498         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
49499         return ret_arr;
49500 }
49501
49502 void  CS_LDK_QueryChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49503         LDKQueryChannelRange this_ptr_conv;
49504         this_ptr_conv.inner = untag_ptr(this_ptr);
49505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49507         this_ptr_conv.is_owned = false;
49508         LDKThirtyTwoBytes val_ref;
49509         CHECK(val->arr_len == 32);
49510         memcpy(val_ref.data, val->elems, 32); FREE(val);
49511         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49512 }
49513
49514 int32_t  CS_LDK_QueryChannelRange_get_first_blocknum(int64_t this_ptr) {
49515         LDKQueryChannelRange this_ptr_conv;
49516         this_ptr_conv.inner = untag_ptr(this_ptr);
49517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49519         this_ptr_conv.is_owned = false;
49520         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49521         return ret_conv;
49522 }
49523
49524 void  CS_LDK_QueryChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
49525         LDKQueryChannelRange this_ptr_conv;
49526         this_ptr_conv.inner = untag_ptr(this_ptr);
49527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49529         this_ptr_conv.is_owned = false;
49530         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49531 }
49532
49533 int32_t  CS_LDK_QueryChannelRange_get_number_of_blocks(int64_t this_ptr) {
49534         LDKQueryChannelRange this_ptr_conv;
49535         this_ptr_conv.inner = untag_ptr(this_ptr);
49536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49538         this_ptr_conv.is_owned = false;
49539         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49540         return ret_conv;
49541 }
49542
49543 void  CS_LDK_QueryChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
49544         LDKQueryChannelRange this_ptr_conv;
49545         this_ptr_conv.inner = untag_ptr(this_ptr);
49546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49548         this_ptr_conv.is_owned = false;
49549         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49550 }
49551
49552 int64_t  CS_LDK_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
49553         LDKThirtyTwoBytes chain_hash_arg_ref;
49554         CHECK(chain_hash_arg->arr_len == 32);
49555         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49556         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49557         int64_t ret_ref = 0;
49558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49560         return ret_ref;
49561 }
49562
49563 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49564         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49565         int64_t ret_ref = 0;
49566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49568         return ret_ref;
49569 }
49570 int64_t  CS_LDK_QueryChannelRange_clone_ptr(int64_t arg) {
49571         LDKQueryChannelRange arg_conv;
49572         arg_conv.inner = untag_ptr(arg);
49573         arg_conv.is_owned = ptr_is_owned(arg);
49574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49575         arg_conv.is_owned = false;
49576         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49577         return ret_conv;
49578 }
49579
49580 int64_t  CS_LDK_QueryChannelRange_clone(int64_t orig) {
49581         LDKQueryChannelRange orig_conv;
49582         orig_conv.inner = untag_ptr(orig);
49583         orig_conv.is_owned = ptr_is_owned(orig);
49584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49585         orig_conv.is_owned = false;
49586         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49587         int64_t ret_ref = 0;
49588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49590         return ret_ref;
49591 }
49592
49593 int64_t  CS_LDK_QueryChannelRange_hash(int64_t o) {
49594         LDKQueryChannelRange o_conv;
49595         o_conv.inner = untag_ptr(o);
49596         o_conv.is_owned = ptr_is_owned(o);
49597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49598         o_conv.is_owned = false;
49599         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
49600         return ret_conv;
49601 }
49602
49603 jboolean  CS_LDK_QueryChannelRange_eq(int64_t a, int64_t b) {
49604         LDKQueryChannelRange a_conv;
49605         a_conv.inner = untag_ptr(a);
49606         a_conv.is_owned = ptr_is_owned(a);
49607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49608         a_conv.is_owned = false;
49609         LDKQueryChannelRange b_conv;
49610         b_conv.inner = untag_ptr(b);
49611         b_conv.is_owned = ptr_is_owned(b);
49612         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49613         b_conv.is_owned = false;
49614         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49615         return ret_conv;
49616 }
49617
49618 void  CS_LDK_ReplyChannelRange_free(int64_t this_obj) {
49619         LDKReplyChannelRange this_obj_conv;
49620         this_obj_conv.inner = untag_ptr(this_obj);
49621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49623         ReplyChannelRange_free(this_obj_conv);
49624 }
49625
49626 int8_tArray  CS_LDK_ReplyChannelRange_get_chain_hash(int64_t this_ptr) {
49627         LDKReplyChannelRange this_ptr_conv;
49628         this_ptr_conv.inner = untag_ptr(this_ptr);
49629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49631         this_ptr_conv.is_owned = false;
49632         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49633         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
49634         return ret_arr;
49635 }
49636
49637 void  CS_LDK_ReplyChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49638         LDKReplyChannelRange this_ptr_conv;
49639         this_ptr_conv.inner = untag_ptr(this_ptr);
49640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49642         this_ptr_conv.is_owned = false;
49643         LDKThirtyTwoBytes val_ref;
49644         CHECK(val->arr_len == 32);
49645         memcpy(val_ref.data, val->elems, 32); FREE(val);
49646         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49647 }
49648
49649 int32_t  CS_LDK_ReplyChannelRange_get_first_blocknum(int64_t this_ptr) {
49650         LDKReplyChannelRange this_ptr_conv;
49651         this_ptr_conv.inner = untag_ptr(this_ptr);
49652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49654         this_ptr_conv.is_owned = false;
49655         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49656         return ret_conv;
49657 }
49658
49659 void  CS_LDK_ReplyChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
49660         LDKReplyChannelRange this_ptr_conv;
49661         this_ptr_conv.inner = untag_ptr(this_ptr);
49662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49664         this_ptr_conv.is_owned = false;
49665         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49666 }
49667
49668 int32_t  CS_LDK_ReplyChannelRange_get_number_of_blocks(int64_t this_ptr) {
49669         LDKReplyChannelRange this_ptr_conv;
49670         this_ptr_conv.inner = untag_ptr(this_ptr);
49671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49673         this_ptr_conv.is_owned = false;
49674         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49675         return ret_conv;
49676 }
49677
49678 void  CS_LDK_ReplyChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
49679         LDKReplyChannelRange this_ptr_conv;
49680         this_ptr_conv.inner = untag_ptr(this_ptr);
49681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49683         this_ptr_conv.is_owned = false;
49684         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49685 }
49686
49687 jboolean  CS_LDK_ReplyChannelRange_get_sync_complete(int64_t this_ptr) {
49688         LDKReplyChannelRange this_ptr_conv;
49689         this_ptr_conv.inner = untag_ptr(this_ptr);
49690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49692         this_ptr_conv.is_owned = false;
49693         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49694         return ret_conv;
49695 }
49696
49697 void  CS_LDK_ReplyChannelRange_set_sync_complete(int64_t this_ptr, jboolean val) {
49698         LDKReplyChannelRange this_ptr_conv;
49699         this_ptr_conv.inner = untag_ptr(this_ptr);
49700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49702         this_ptr_conv.is_owned = false;
49703         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49704 }
49705
49706 int64_tArray  CS_LDK_ReplyChannelRange_get_short_channel_ids(int64_t this_ptr) {
49707         LDKReplyChannelRange this_ptr_conv;
49708         this_ptr_conv.inner = untag_ptr(this_ptr);
49709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49711         this_ptr_conv.is_owned = false;
49712         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49713         int64_tArray ret_arr = NULL;
49714         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49715         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49716         for (size_t g = 0; g < ret_var.datalen; g++) {
49717                 int64_t ret_conv_6_conv = ret_var.data[g];
49718                 ret_arr_ptr[g] = ret_conv_6_conv;
49719         }
49720         
49721         FREE(ret_var.data);
49722         return ret_arr;
49723 }
49724
49725 void  CS_LDK_ReplyChannelRange_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
49726         LDKReplyChannelRange this_ptr_conv;
49727         this_ptr_conv.inner = untag_ptr(this_ptr);
49728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49730         this_ptr_conv.is_owned = false;
49731         LDKCVec_u64Z val_constr;
49732         val_constr.datalen = val->arr_len;
49733         if (val_constr.datalen > 0)
49734                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49735         else
49736                 val_constr.data = NULL;
49737         int64_t* val_vals = val->elems;
49738         for (size_t g = 0; g < val_constr.datalen; g++) {
49739                 int64_t val_conv_6 = val_vals[g];
49740                 val_constr.data[g] = val_conv_6;
49741         }
49742         FREE(val);
49743         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49744 }
49745
49746 int64_t  CS_LDK_ReplyChannelRange_new(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) {
49747         LDKThirtyTwoBytes chain_hash_arg_ref;
49748         CHECK(chain_hash_arg->arr_len == 32);
49749         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49750         LDKCVec_u64Z short_channel_ids_arg_constr;
49751         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49752         if (short_channel_ids_arg_constr.datalen > 0)
49753                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49754         else
49755                 short_channel_ids_arg_constr.data = NULL;
49756         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49757         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49758                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49759                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49760         }
49761         FREE(short_channel_ids_arg);
49762         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
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 ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
49770         LDKReplyChannelRange ret_var = ReplyChannelRange_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 int64_t  CS_LDK_ReplyChannelRange_clone_ptr(int64_t arg) {
49777         LDKReplyChannelRange 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 = ReplyChannelRange_clone_ptr(&arg_conv);
49783         return ret_conv;
49784 }
49785
49786 int64_t  CS_LDK_ReplyChannelRange_clone(int64_t orig) {
49787         LDKReplyChannelRange 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         LDKReplyChannelRange ret_var = ReplyChannelRange_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 int64_t  CS_LDK_ReplyChannelRange_hash(int64_t o) {
49800         LDKReplyChannelRange 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 = ReplyChannelRange_hash(&o_conv);
49806         return ret_conv;
49807 }
49808
49809 jboolean  CS_LDK_ReplyChannelRange_eq(int64_t a, int64_t b) {
49810         LDKReplyChannelRange 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         LDKReplyChannelRange 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 = ReplyChannelRange_eq(&a_conv, &b_conv);
49821         return ret_conv;
49822 }
49823
49824 void  CS_LDK_QueryShortChannelIds_free(int64_t this_obj) {
49825         LDKQueryShortChannelIds this_obj_conv;
49826         this_obj_conv.inner = untag_ptr(this_obj);
49827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49829         QueryShortChannelIds_free(this_obj_conv);
49830 }
49831
49832 int8_tArray  CS_LDK_QueryShortChannelIds_get_chain_hash(int64_t this_ptr) {
49833         LDKQueryShortChannelIds this_ptr_conv;
49834         this_ptr_conv.inner = untag_ptr(this_ptr);
49835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49837         this_ptr_conv.is_owned = false;
49838         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49839         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
49840         return ret_arr;
49841 }
49842
49843 void  CS_LDK_QueryShortChannelIds_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49844         LDKQueryShortChannelIds this_ptr_conv;
49845         this_ptr_conv.inner = untag_ptr(this_ptr);
49846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49848         this_ptr_conv.is_owned = false;
49849         LDKThirtyTwoBytes val_ref;
49850         CHECK(val->arr_len == 32);
49851         memcpy(val_ref.data, val->elems, 32); FREE(val);
49852         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
49853 }
49854
49855 int64_tArray  CS_LDK_QueryShortChannelIds_get_short_channel_ids(int64_t this_ptr) {
49856         LDKQueryShortChannelIds this_ptr_conv;
49857         this_ptr_conv.inner = untag_ptr(this_ptr);
49858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49860         this_ptr_conv.is_owned = false;
49861         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
49862         int64_tArray ret_arr = NULL;
49863         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49864         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49865         for (size_t g = 0; g < ret_var.datalen; g++) {
49866                 int64_t ret_conv_6_conv = ret_var.data[g];
49867                 ret_arr_ptr[g] = ret_conv_6_conv;
49868         }
49869         
49870         FREE(ret_var.data);
49871         return ret_arr;
49872 }
49873
49874 void  CS_LDK_QueryShortChannelIds_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
49875         LDKQueryShortChannelIds this_ptr_conv;
49876         this_ptr_conv.inner = untag_ptr(this_ptr);
49877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49879         this_ptr_conv.is_owned = false;
49880         LDKCVec_u64Z val_constr;
49881         val_constr.datalen = val->arr_len;
49882         if (val_constr.datalen > 0)
49883                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49884         else
49885                 val_constr.data = NULL;
49886         int64_t* val_vals = val->elems;
49887         for (size_t g = 0; g < val_constr.datalen; g++) {
49888                 int64_t val_conv_6 = val_vals[g];
49889                 val_constr.data[g] = val_conv_6;
49890         }
49891         FREE(val);
49892         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
49893 }
49894
49895 int64_t  CS_LDK_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
49896         LDKThirtyTwoBytes chain_hash_arg_ref;
49897         CHECK(chain_hash_arg->arr_len == 32);
49898         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49899         LDKCVec_u64Z short_channel_ids_arg_constr;
49900         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49901         if (short_channel_ids_arg_constr.datalen > 0)
49902                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49903         else
49904                 short_channel_ids_arg_constr.data = NULL;
49905         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49906         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49907                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49908                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49909         }
49910         FREE(short_channel_ids_arg);
49911         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
49912         int64_t ret_ref = 0;
49913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49915         return ret_ref;
49916 }
49917
49918 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
49919         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
49920         int64_t ret_ref = 0;
49921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49923         return ret_ref;
49924 }
49925 int64_t  CS_LDK_QueryShortChannelIds_clone_ptr(int64_t arg) {
49926         LDKQueryShortChannelIds arg_conv;
49927         arg_conv.inner = untag_ptr(arg);
49928         arg_conv.is_owned = ptr_is_owned(arg);
49929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49930         arg_conv.is_owned = false;
49931         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
49932         return ret_conv;
49933 }
49934
49935 int64_t  CS_LDK_QueryShortChannelIds_clone(int64_t orig) {
49936         LDKQueryShortChannelIds orig_conv;
49937         orig_conv.inner = untag_ptr(orig);
49938         orig_conv.is_owned = ptr_is_owned(orig);
49939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49940         orig_conv.is_owned = false;
49941         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
49942         int64_t ret_ref = 0;
49943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49945         return ret_ref;
49946 }
49947
49948 int64_t  CS_LDK_QueryShortChannelIds_hash(int64_t o) {
49949         LDKQueryShortChannelIds o_conv;
49950         o_conv.inner = untag_ptr(o);
49951         o_conv.is_owned = ptr_is_owned(o);
49952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49953         o_conv.is_owned = false;
49954         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
49955         return ret_conv;
49956 }
49957
49958 jboolean  CS_LDK_QueryShortChannelIds_eq(int64_t a, int64_t b) {
49959         LDKQueryShortChannelIds a_conv;
49960         a_conv.inner = untag_ptr(a);
49961         a_conv.is_owned = ptr_is_owned(a);
49962         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49963         a_conv.is_owned = false;
49964         LDKQueryShortChannelIds b_conv;
49965         b_conv.inner = untag_ptr(b);
49966         b_conv.is_owned = ptr_is_owned(b);
49967         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49968         b_conv.is_owned = false;
49969         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
49970         return ret_conv;
49971 }
49972
49973 void  CS_LDK_ReplyShortChannelIdsEnd_free(int64_t this_obj) {
49974         LDKReplyShortChannelIdsEnd this_obj_conv;
49975         this_obj_conv.inner = untag_ptr(this_obj);
49976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49978         ReplyShortChannelIdsEnd_free(this_obj_conv);
49979 }
49980
49981 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_get_chain_hash(int64_t this_ptr) {
49982         LDKReplyShortChannelIdsEnd this_ptr_conv;
49983         this_ptr_conv.inner = untag_ptr(this_ptr);
49984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49986         this_ptr_conv.is_owned = false;
49987         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49988         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
49989         return ret_arr;
49990 }
49991
49992 void  CS_LDK_ReplyShortChannelIdsEnd_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49993         LDKReplyShortChannelIdsEnd this_ptr_conv;
49994         this_ptr_conv.inner = untag_ptr(this_ptr);
49995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49997         this_ptr_conv.is_owned = false;
49998         LDKThirtyTwoBytes val_ref;
49999         CHECK(val->arr_len == 32);
50000         memcpy(val_ref.data, val->elems, 32); FREE(val);
50001         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
50002 }
50003
50004 jboolean  CS_LDK_ReplyShortChannelIdsEnd_get_full_information(int64_t this_ptr) {
50005         LDKReplyShortChannelIdsEnd this_ptr_conv;
50006         this_ptr_conv.inner = untag_ptr(this_ptr);
50007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50009         this_ptr_conv.is_owned = false;
50010         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
50011         return ret_conv;
50012 }
50013
50014 void  CS_LDK_ReplyShortChannelIdsEnd_set_full_information(int64_t this_ptr, jboolean val) {
50015         LDKReplyShortChannelIdsEnd this_ptr_conv;
50016         this_ptr_conv.inner = untag_ptr(this_ptr);
50017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50019         this_ptr_conv.is_owned = false;
50020         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
50021 }
50022
50023 int64_t  CS_LDK_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
50024         LDKThirtyTwoBytes chain_hash_arg_ref;
50025         CHECK(chain_hash_arg->arr_len == 32);
50026         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
50027         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
50028         int64_t ret_ref = 0;
50029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50031         return ret_ref;
50032 }
50033
50034 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
50035         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
50036         int64_t ret_ref = 0;
50037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50039         return ret_ref;
50040 }
50041 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone_ptr(int64_t arg) {
50042         LDKReplyShortChannelIdsEnd arg_conv;
50043         arg_conv.inner = untag_ptr(arg);
50044         arg_conv.is_owned = ptr_is_owned(arg);
50045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50046         arg_conv.is_owned = false;
50047         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
50048         return ret_conv;
50049 }
50050
50051 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone(int64_t orig) {
50052         LDKReplyShortChannelIdsEnd orig_conv;
50053         orig_conv.inner = untag_ptr(orig);
50054         orig_conv.is_owned = ptr_is_owned(orig);
50055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50056         orig_conv.is_owned = false;
50057         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
50058         int64_t ret_ref = 0;
50059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50061         return ret_ref;
50062 }
50063
50064 int64_t  CS_LDK_ReplyShortChannelIdsEnd_hash(int64_t o) {
50065         LDKReplyShortChannelIdsEnd o_conv;
50066         o_conv.inner = untag_ptr(o);
50067         o_conv.is_owned = ptr_is_owned(o);
50068         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50069         o_conv.is_owned = false;
50070         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
50071         return ret_conv;
50072 }
50073
50074 jboolean  CS_LDK_ReplyShortChannelIdsEnd_eq(int64_t a, int64_t b) {
50075         LDKReplyShortChannelIdsEnd a_conv;
50076         a_conv.inner = untag_ptr(a);
50077         a_conv.is_owned = ptr_is_owned(a);
50078         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50079         a_conv.is_owned = false;
50080         LDKReplyShortChannelIdsEnd b_conv;
50081         b_conv.inner = untag_ptr(b);
50082         b_conv.is_owned = ptr_is_owned(b);
50083         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50084         b_conv.is_owned = false;
50085         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
50086         return ret_conv;
50087 }
50088
50089 void  CS_LDK_GossipTimestampFilter_free(int64_t this_obj) {
50090         LDKGossipTimestampFilter this_obj_conv;
50091         this_obj_conv.inner = untag_ptr(this_obj);
50092         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50094         GossipTimestampFilter_free(this_obj_conv);
50095 }
50096
50097 int8_tArray  CS_LDK_GossipTimestampFilter_get_chain_hash(int64_t this_ptr) {
50098         LDKGossipTimestampFilter this_ptr_conv;
50099         this_ptr_conv.inner = untag_ptr(this_ptr);
50100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50102         this_ptr_conv.is_owned = false;
50103         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50104         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
50105         return ret_arr;
50106 }
50107
50108 void  CS_LDK_GossipTimestampFilter_set_chain_hash(int64_t this_ptr, int8_tArray val) {
50109         LDKGossipTimestampFilter 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         LDKThirtyTwoBytes val_ref;
50115         CHECK(val->arr_len == 32);
50116         memcpy(val_ref.data, val->elems, 32); FREE(val);
50117         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
50118 }
50119
50120 int32_t  CS_LDK_GossipTimestampFilter_get_first_timestamp(int64_t this_ptr) {
50121         LDKGossipTimestampFilter 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         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
50127         return ret_conv;
50128 }
50129
50130 void  CS_LDK_GossipTimestampFilter_set_first_timestamp(int64_t this_ptr, int32_t val) {
50131         LDKGossipTimestampFilter this_ptr_conv;
50132         this_ptr_conv.inner = untag_ptr(this_ptr);
50133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50135         this_ptr_conv.is_owned = false;
50136         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
50137 }
50138
50139 int32_t  CS_LDK_GossipTimestampFilter_get_timestamp_range(int64_t this_ptr) {
50140         LDKGossipTimestampFilter this_ptr_conv;
50141         this_ptr_conv.inner = untag_ptr(this_ptr);
50142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50144         this_ptr_conv.is_owned = false;
50145         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
50146         return ret_conv;
50147 }
50148
50149 void  CS_LDK_GossipTimestampFilter_set_timestamp_range(int64_t this_ptr, int32_t val) {
50150         LDKGossipTimestampFilter this_ptr_conv;
50151         this_ptr_conv.inner = untag_ptr(this_ptr);
50152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50154         this_ptr_conv.is_owned = false;
50155         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
50156 }
50157
50158 int64_t  CS_LDK_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
50159         LDKThirtyTwoBytes chain_hash_arg_ref;
50160         CHECK(chain_hash_arg->arr_len == 32);
50161         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
50162         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
50163         int64_t ret_ref = 0;
50164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50166         return ret_ref;
50167 }
50168
50169 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
50170         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
50171         int64_t ret_ref = 0;
50172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50174         return ret_ref;
50175 }
50176 int64_t  CS_LDK_GossipTimestampFilter_clone_ptr(int64_t arg) {
50177         LDKGossipTimestampFilter arg_conv;
50178         arg_conv.inner = untag_ptr(arg);
50179         arg_conv.is_owned = ptr_is_owned(arg);
50180         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50181         arg_conv.is_owned = false;
50182         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
50183         return ret_conv;
50184 }
50185
50186 int64_t  CS_LDK_GossipTimestampFilter_clone(int64_t orig) {
50187         LDKGossipTimestampFilter orig_conv;
50188         orig_conv.inner = untag_ptr(orig);
50189         orig_conv.is_owned = ptr_is_owned(orig);
50190         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50191         orig_conv.is_owned = false;
50192         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
50193         int64_t ret_ref = 0;
50194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50196         return ret_ref;
50197 }
50198
50199 int64_t  CS_LDK_GossipTimestampFilter_hash(int64_t o) {
50200         LDKGossipTimestampFilter o_conv;
50201         o_conv.inner = untag_ptr(o);
50202         o_conv.is_owned = ptr_is_owned(o);
50203         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50204         o_conv.is_owned = false;
50205         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
50206         return ret_conv;
50207 }
50208
50209 jboolean  CS_LDK_GossipTimestampFilter_eq(int64_t a, int64_t b) {
50210         LDKGossipTimestampFilter a_conv;
50211         a_conv.inner = untag_ptr(a);
50212         a_conv.is_owned = ptr_is_owned(a);
50213         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50214         a_conv.is_owned = false;
50215         LDKGossipTimestampFilter b_conv;
50216         b_conv.inner = untag_ptr(b);
50217         b_conv.is_owned = ptr_is_owned(b);
50218         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50219         b_conv.is_owned = false;
50220         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
50221         return ret_conv;
50222 }
50223
50224 void  CS_LDK_ErrorAction_free(int64_t this_ptr) {
50225         if (!ptr_is_owned(this_ptr)) return;
50226         void* this_ptr_ptr = untag_ptr(this_ptr);
50227         CHECK_ACCESS(this_ptr_ptr);
50228         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
50229         FREE(untag_ptr(this_ptr));
50230         ErrorAction_free(this_ptr_conv);
50231 }
50232
50233 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
50234         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50235         *ret_copy = ErrorAction_clone(arg);
50236         int64_t ret_ref = tag_ptr(ret_copy, true);
50237         return ret_ref;
50238 }
50239 int64_t  CS_LDK_ErrorAction_clone_ptr(int64_t arg) {
50240         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
50241         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
50242         return ret_conv;
50243 }
50244
50245 int64_t  CS_LDK_ErrorAction_clone(int64_t orig) {
50246         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
50247         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50248         *ret_copy = ErrorAction_clone(orig_conv);
50249         int64_t ret_ref = tag_ptr(ret_copy, true);
50250         return ret_ref;
50251 }
50252
50253 int64_t  CS_LDK_ErrorAction_disconnect_peer(int64_t msg) {
50254         LDKErrorMessage msg_conv;
50255         msg_conv.inner = untag_ptr(msg);
50256         msg_conv.is_owned = ptr_is_owned(msg);
50257         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50258         msg_conv = ErrorMessage_clone(&msg_conv);
50259         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50260         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
50261         int64_t ret_ref = tag_ptr(ret_copy, true);
50262         return ret_ref;
50263 }
50264
50265 int64_t  CS_LDK_ErrorAction_disconnect_peer_with_warning(int64_t msg) {
50266         LDKWarningMessage msg_conv;
50267         msg_conv.inner = untag_ptr(msg);
50268         msg_conv.is_owned = ptr_is_owned(msg);
50269         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50270         msg_conv = WarningMessage_clone(&msg_conv);
50271         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50272         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
50273         int64_t ret_ref = tag_ptr(ret_copy, true);
50274         return ret_ref;
50275 }
50276
50277 int64_t  CS_LDK_ErrorAction_ignore_error() {
50278         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50279         *ret_copy = ErrorAction_ignore_error();
50280         int64_t ret_ref = tag_ptr(ret_copy, true);
50281         return ret_ref;
50282 }
50283
50284 int64_t  CS_LDK_ErrorAction_ignore_and_log(int32_t a) {
50285         LDKLevel a_conv = LDKLevel_from_cs(a);
50286         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50287         *ret_copy = ErrorAction_ignore_and_log(a_conv);
50288         int64_t ret_ref = tag_ptr(ret_copy, true);
50289         return ret_ref;
50290 }
50291
50292 int64_t  CS_LDK_ErrorAction_ignore_duplicate_gossip() {
50293         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50294         *ret_copy = ErrorAction_ignore_duplicate_gossip();
50295         int64_t ret_ref = tag_ptr(ret_copy, true);
50296         return ret_ref;
50297 }
50298
50299 int64_t  CS_LDK_ErrorAction_send_error_message(int64_t msg) {
50300         LDKErrorMessage msg_conv;
50301         msg_conv.inner = untag_ptr(msg);
50302         msg_conv.is_owned = ptr_is_owned(msg);
50303         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50304         msg_conv = ErrorMessage_clone(&msg_conv);
50305         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50306         *ret_copy = ErrorAction_send_error_message(msg_conv);
50307         int64_t ret_ref = tag_ptr(ret_copy, true);
50308         return ret_ref;
50309 }
50310
50311 int64_t  CS_LDK_ErrorAction_send_warning_message(int64_t msg, int32_t log_level) {
50312         LDKWarningMessage msg_conv;
50313         msg_conv.inner = untag_ptr(msg);
50314         msg_conv.is_owned = ptr_is_owned(msg);
50315         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50316         msg_conv = WarningMessage_clone(&msg_conv);
50317         LDKLevel log_level_conv = LDKLevel_from_cs(log_level);
50318         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50319         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
50320         int64_t ret_ref = tag_ptr(ret_copy, true);
50321         return ret_ref;
50322 }
50323
50324 int64_t  CS_LDK_ErrorAction_hash(int64_t o) {
50325         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
50326         int64_t ret_conv = ErrorAction_hash(o_conv);
50327         return ret_conv;
50328 }
50329
50330 void  CS_LDK_LightningError_free(int64_t this_obj) {
50331         LDKLightningError this_obj_conv;
50332         this_obj_conv.inner = untag_ptr(this_obj);
50333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50335         LightningError_free(this_obj_conv);
50336 }
50337
50338 jstring  CS_LDK_LightningError_get_err(int64_t this_ptr) {
50339         LDKLightningError this_ptr_conv;
50340         this_ptr_conv.inner = untag_ptr(this_ptr);
50341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50343         this_ptr_conv.is_owned = false;
50344         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
50345         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
50346         Str_free(ret_str);
50347         return ret_conv;
50348 }
50349
50350 void  CS_LDK_LightningError_set_err(int64_t this_ptr, jstring val) {
50351         LDKLightningError this_ptr_conv;
50352         this_ptr_conv.inner = untag_ptr(this_ptr);
50353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50355         this_ptr_conv.is_owned = false;
50356         LDKStr val_conv = str_ref_to_owned_c(val);
50357         LightningError_set_err(&this_ptr_conv, val_conv);
50358 }
50359
50360 int64_t  CS_LDK_LightningError_get_action(int64_t this_ptr) {
50361         LDKLightningError this_ptr_conv;
50362         this_ptr_conv.inner = untag_ptr(this_ptr);
50363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50365         this_ptr_conv.is_owned = false;
50366         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50367         *ret_copy = LightningError_get_action(&this_ptr_conv);
50368         int64_t ret_ref = tag_ptr(ret_copy, true);
50369         return ret_ref;
50370 }
50371
50372 void  CS_LDK_LightningError_set_action(int64_t this_ptr, int64_t val) {
50373         LDKLightningError this_ptr_conv;
50374         this_ptr_conv.inner = untag_ptr(this_ptr);
50375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50377         this_ptr_conv.is_owned = false;
50378         void* val_ptr = untag_ptr(val);
50379         CHECK_ACCESS(val_ptr);
50380         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
50381         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
50382         LightningError_set_action(&this_ptr_conv, val_conv);
50383 }
50384
50385 int64_t  CS_LDK_LightningError_new(jstring err_arg, int64_t action_arg) {
50386         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
50387         void* action_arg_ptr = untag_ptr(action_arg);
50388         CHECK_ACCESS(action_arg_ptr);
50389         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
50390         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
50391         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
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 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
50399         LDKLightningError ret_var = LightningError_clone(arg);
50400         int64_t ret_ref = 0;
50401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50403         return ret_ref;
50404 }
50405 int64_t  CS_LDK_LightningError_clone_ptr(int64_t arg) {
50406         LDKLightningError arg_conv;
50407         arg_conv.inner = untag_ptr(arg);
50408         arg_conv.is_owned = ptr_is_owned(arg);
50409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50410         arg_conv.is_owned = false;
50411         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
50412         return ret_conv;
50413 }
50414
50415 int64_t  CS_LDK_LightningError_clone(int64_t orig) {
50416         LDKLightningError orig_conv;
50417         orig_conv.inner = untag_ptr(orig);
50418         orig_conv.is_owned = ptr_is_owned(orig);
50419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50420         orig_conv.is_owned = false;
50421         LDKLightningError ret_var = LightningError_clone(&orig_conv);
50422         int64_t ret_ref = 0;
50423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50425         return ret_ref;
50426 }
50427
50428 void  CS_LDK_CommitmentUpdate_free(int64_t this_obj) {
50429         LDKCommitmentUpdate this_obj_conv;
50430         this_obj_conv.inner = untag_ptr(this_obj);
50431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50433         CommitmentUpdate_free(this_obj_conv);
50434 }
50435
50436 int64_tArray  CS_LDK_CommitmentUpdate_get_update_add_htlcs(int64_t this_ptr) {
50437         LDKCommitmentUpdate this_ptr_conv;
50438         this_ptr_conv.inner = untag_ptr(this_ptr);
50439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50441         this_ptr_conv.is_owned = false;
50442         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
50443         int64_tArray ret_arr = NULL;
50444         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50445         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50446         for (size_t p = 0; p < ret_var.datalen; p++) {
50447                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
50448                 int64_t ret_conv_15_ref = 0;
50449                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
50450                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50451                 ret_arr_ptr[p] = ret_conv_15_ref;
50452         }
50453         
50454         FREE(ret_var.data);
50455         return ret_arr;
50456 }
50457
50458 void  CS_LDK_CommitmentUpdate_set_update_add_htlcs(int64_t this_ptr, int64_tArray val) {
50459         LDKCommitmentUpdate this_ptr_conv;
50460         this_ptr_conv.inner = untag_ptr(this_ptr);
50461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50463         this_ptr_conv.is_owned = false;
50464         LDKCVec_UpdateAddHTLCZ val_constr;
50465         val_constr.datalen = val->arr_len;
50466         if (val_constr.datalen > 0)
50467                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50468         else
50469                 val_constr.data = NULL;
50470         int64_t* val_vals = val->elems;
50471         for (size_t p = 0; p < val_constr.datalen; p++) {
50472                 int64_t val_conv_15 = val_vals[p];
50473                 LDKUpdateAddHTLC val_conv_15_conv;
50474                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50475                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50476                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50477                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50478                 val_constr.data[p] = val_conv_15_conv;
50479         }
50480         FREE(val);
50481         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50482 }
50483
50484 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fulfill_htlcs(int64_t this_ptr) {
50485         LDKCommitmentUpdate this_ptr_conv;
50486         this_ptr_conv.inner = untag_ptr(this_ptr);
50487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50489         this_ptr_conv.is_owned = false;
50490         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50491         int64_tArray ret_arr = NULL;
50492         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50493         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50494         for (size_t t = 0; t < ret_var.datalen; t++) {
50495                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50496                 int64_t ret_conv_19_ref = 0;
50497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50498                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50499                 ret_arr_ptr[t] = ret_conv_19_ref;
50500         }
50501         
50502         FREE(ret_var.data);
50503         return ret_arr;
50504 }
50505
50506 void  CS_LDK_CommitmentUpdate_set_update_fulfill_htlcs(int64_t this_ptr, int64_tArray val) {
50507         LDKCommitmentUpdate this_ptr_conv;
50508         this_ptr_conv.inner = untag_ptr(this_ptr);
50509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50511         this_ptr_conv.is_owned = false;
50512         LDKCVec_UpdateFulfillHTLCZ val_constr;
50513         val_constr.datalen = val->arr_len;
50514         if (val_constr.datalen > 0)
50515                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50516         else
50517                 val_constr.data = NULL;
50518         int64_t* val_vals = val->elems;
50519         for (size_t t = 0; t < val_constr.datalen; t++) {
50520                 int64_t val_conv_19 = val_vals[t];
50521                 LDKUpdateFulfillHTLC val_conv_19_conv;
50522                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50523                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50524                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50525                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50526                 val_constr.data[t] = val_conv_19_conv;
50527         }
50528         FREE(val);
50529         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50530 }
50531
50532 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_htlcs(int64_t this_ptr) {
50533         LDKCommitmentUpdate this_ptr_conv;
50534         this_ptr_conv.inner = untag_ptr(this_ptr);
50535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50537         this_ptr_conv.is_owned = false;
50538         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50539         int64_tArray ret_arr = NULL;
50540         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50541         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50542         for (size_t q = 0; q < ret_var.datalen; q++) {
50543                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50544                 int64_t ret_conv_16_ref = 0;
50545                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50546                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50547                 ret_arr_ptr[q] = ret_conv_16_ref;
50548         }
50549         
50550         FREE(ret_var.data);
50551         return ret_arr;
50552 }
50553
50554 void  CS_LDK_CommitmentUpdate_set_update_fail_htlcs(int64_t this_ptr, int64_tArray val) {
50555         LDKCommitmentUpdate this_ptr_conv;
50556         this_ptr_conv.inner = untag_ptr(this_ptr);
50557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50559         this_ptr_conv.is_owned = false;
50560         LDKCVec_UpdateFailHTLCZ val_constr;
50561         val_constr.datalen = val->arr_len;
50562         if (val_constr.datalen > 0)
50563                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50564         else
50565                 val_constr.data = NULL;
50566         int64_t* val_vals = val->elems;
50567         for (size_t q = 0; q < val_constr.datalen; q++) {
50568                 int64_t val_conv_16 = val_vals[q];
50569                 LDKUpdateFailHTLC val_conv_16_conv;
50570                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50571                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50572                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50573                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50574                 val_constr.data[q] = val_conv_16_conv;
50575         }
50576         FREE(val);
50577         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50578 }
50579
50580 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_malformed_htlcs(int64_t this_ptr) {
50581         LDKCommitmentUpdate this_ptr_conv;
50582         this_ptr_conv.inner = untag_ptr(this_ptr);
50583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50585         this_ptr_conv.is_owned = false;
50586         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50587         int64_tArray ret_arr = NULL;
50588         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50589         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50590         for (size_t z = 0; z < ret_var.datalen; z++) {
50591                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50592                 int64_t ret_conv_25_ref = 0;
50593                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50594                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50595                 ret_arr_ptr[z] = ret_conv_25_ref;
50596         }
50597         
50598         FREE(ret_var.data);
50599         return ret_arr;
50600 }
50601
50602 void  CS_LDK_CommitmentUpdate_set_update_fail_malformed_htlcs(int64_t this_ptr, int64_tArray val) {
50603         LDKCommitmentUpdate this_ptr_conv;
50604         this_ptr_conv.inner = untag_ptr(this_ptr);
50605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50607         this_ptr_conv.is_owned = false;
50608         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50609         val_constr.datalen = val->arr_len;
50610         if (val_constr.datalen > 0)
50611                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50612         else
50613                 val_constr.data = NULL;
50614         int64_t* val_vals = val->elems;
50615         for (size_t z = 0; z < val_constr.datalen; z++) {
50616                 int64_t val_conv_25 = val_vals[z];
50617                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50618                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50619                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50620                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50621                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50622                 val_constr.data[z] = val_conv_25_conv;
50623         }
50624         FREE(val);
50625         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50626 }
50627
50628 int64_t  CS_LDK_CommitmentUpdate_get_update_fee(int64_t this_ptr) {
50629         LDKCommitmentUpdate this_ptr_conv;
50630         this_ptr_conv.inner = untag_ptr(this_ptr);
50631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50633         this_ptr_conv.is_owned = false;
50634         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50635         int64_t ret_ref = 0;
50636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50638         return ret_ref;
50639 }
50640
50641 void  CS_LDK_CommitmentUpdate_set_update_fee(int64_t this_ptr, int64_t val) {
50642         LDKCommitmentUpdate this_ptr_conv;
50643         this_ptr_conv.inner = untag_ptr(this_ptr);
50644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50646         this_ptr_conv.is_owned = false;
50647         LDKUpdateFee val_conv;
50648         val_conv.inner = untag_ptr(val);
50649         val_conv.is_owned = ptr_is_owned(val);
50650         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50651         val_conv = UpdateFee_clone(&val_conv);
50652         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50653 }
50654
50655 int64_t  CS_LDK_CommitmentUpdate_get_commitment_signed(int64_t this_ptr) {
50656         LDKCommitmentUpdate this_ptr_conv;
50657         this_ptr_conv.inner = untag_ptr(this_ptr);
50658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50660         this_ptr_conv.is_owned = false;
50661         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50662         int64_t ret_ref = 0;
50663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50665         return ret_ref;
50666 }
50667
50668 void  CS_LDK_CommitmentUpdate_set_commitment_signed(int64_t this_ptr, int64_t val) {
50669         LDKCommitmentUpdate this_ptr_conv;
50670         this_ptr_conv.inner = untag_ptr(this_ptr);
50671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50673         this_ptr_conv.is_owned = false;
50674         LDKCommitmentSigned val_conv;
50675         val_conv.inner = untag_ptr(val);
50676         val_conv.is_owned = ptr_is_owned(val);
50677         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50678         val_conv = CommitmentSigned_clone(&val_conv);
50679         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50680 }
50681
50682 int64_t  CS_LDK_CommitmentUpdate_new(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) {
50683         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50684         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
50685         if (update_add_htlcs_arg_constr.datalen > 0)
50686                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50687         else
50688                 update_add_htlcs_arg_constr.data = NULL;
50689         int64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
50690         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50691                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50692                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50693                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50694                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50695                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50696                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50697                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50698         }
50699         FREE(update_add_htlcs_arg);
50700         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50701         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
50702         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50703                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50704         else
50705                 update_fulfill_htlcs_arg_constr.data = NULL;
50706         int64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
50707         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50708                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50709                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50710                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50711                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50712                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50713                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50714                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50715         }
50716         FREE(update_fulfill_htlcs_arg);
50717         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50718         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
50719         if (update_fail_htlcs_arg_constr.datalen > 0)
50720                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50721         else
50722                 update_fail_htlcs_arg_constr.data = NULL;
50723         int64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
50724         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50725                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50726                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50727                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50728                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50729                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50730                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50731                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50732         }
50733         FREE(update_fail_htlcs_arg);
50734         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50735         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
50736         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50737                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50738         else
50739                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50740         int64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
50741         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50742                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50743                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50744                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50745                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50746                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50747                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50748                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50749         }
50750         FREE(update_fail_malformed_htlcs_arg);
50751         LDKUpdateFee update_fee_arg_conv;
50752         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50753         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50754         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50755         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50756         LDKCommitmentSigned commitment_signed_arg_conv;
50757         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50758         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50759         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50760         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50761         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);
50762         int64_t ret_ref = 0;
50763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50765         return ret_ref;
50766 }
50767
50768 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50769         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50770         int64_t ret_ref = 0;
50771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50773         return ret_ref;
50774 }
50775 int64_t  CS_LDK_CommitmentUpdate_clone_ptr(int64_t arg) {
50776         LDKCommitmentUpdate arg_conv;
50777         arg_conv.inner = untag_ptr(arg);
50778         arg_conv.is_owned = ptr_is_owned(arg);
50779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50780         arg_conv.is_owned = false;
50781         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50782         return ret_conv;
50783 }
50784
50785 int64_t  CS_LDK_CommitmentUpdate_clone(int64_t orig) {
50786         LDKCommitmentUpdate orig_conv;
50787         orig_conv.inner = untag_ptr(orig);
50788         orig_conv.is_owned = ptr_is_owned(orig);
50789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50790         orig_conv.is_owned = false;
50791         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50792         int64_t ret_ref = 0;
50793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50795         return ret_ref;
50796 }
50797
50798 int64_t  CS_LDK_CommitmentUpdate_hash(int64_t o) {
50799         LDKCommitmentUpdate o_conv;
50800         o_conv.inner = untag_ptr(o);
50801         o_conv.is_owned = ptr_is_owned(o);
50802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50803         o_conv.is_owned = false;
50804         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
50805         return ret_conv;
50806 }
50807
50808 jboolean  CS_LDK_CommitmentUpdate_eq(int64_t a, int64_t b) {
50809         LDKCommitmentUpdate a_conv;
50810         a_conv.inner = untag_ptr(a);
50811         a_conv.is_owned = ptr_is_owned(a);
50812         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50813         a_conv.is_owned = false;
50814         LDKCommitmentUpdate b_conv;
50815         b_conv.inner = untag_ptr(b);
50816         b_conv.is_owned = ptr_is_owned(b);
50817         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50818         b_conv.is_owned = false;
50819         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
50820         return ret_conv;
50821 }
50822
50823 void  CS_LDK_ChannelMessageHandler_free(int64_t this_ptr) {
50824         if (!ptr_is_owned(this_ptr)) return;
50825         void* this_ptr_ptr = untag_ptr(this_ptr);
50826         CHECK_ACCESS(this_ptr_ptr);
50827         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
50828         FREE(untag_ptr(this_ptr));
50829         ChannelMessageHandler_free(this_ptr_conv);
50830 }
50831
50832 void  CS_LDK_RoutingMessageHandler_free(int64_t this_ptr) {
50833         if (!ptr_is_owned(this_ptr)) return;
50834         void* this_ptr_ptr = untag_ptr(this_ptr);
50835         CHECK_ACCESS(this_ptr_ptr);
50836         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
50837         FREE(untag_ptr(this_ptr));
50838         RoutingMessageHandler_free(this_ptr_conv);
50839 }
50840
50841 void  CS_LDK_OnionMessageHandler_free(int64_t this_ptr) {
50842         if (!ptr_is_owned(this_ptr)) return;
50843         void* this_ptr_ptr = untag_ptr(this_ptr);
50844         CHECK_ACCESS(this_ptr_ptr);
50845         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
50846         FREE(untag_ptr(this_ptr));
50847         OnionMessageHandler_free(this_ptr_conv);
50848 }
50849
50850 void  CS_LDK_FinalOnionHopData_free(int64_t this_obj) {
50851         LDKFinalOnionHopData this_obj_conv;
50852         this_obj_conv.inner = untag_ptr(this_obj);
50853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50855         FinalOnionHopData_free(this_obj_conv);
50856 }
50857
50858 int8_tArray  CS_LDK_FinalOnionHopData_get_payment_secret(int64_t this_ptr) {
50859         LDKFinalOnionHopData this_ptr_conv;
50860         this_ptr_conv.inner = untag_ptr(this_ptr);
50861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50863         this_ptr_conv.is_owned = false;
50864         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50865         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
50866         return ret_arr;
50867 }
50868
50869 void  CS_LDK_FinalOnionHopData_set_payment_secret(int64_t this_ptr, int8_tArray val) {
50870         LDKFinalOnionHopData this_ptr_conv;
50871         this_ptr_conv.inner = untag_ptr(this_ptr);
50872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50874         this_ptr_conv.is_owned = false;
50875         LDKThirtyTwoBytes val_ref;
50876         CHECK(val->arr_len == 32);
50877         memcpy(val_ref.data, val->elems, 32); FREE(val);
50878         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
50879 }
50880
50881 int64_t  CS_LDK_FinalOnionHopData_get_total_msat(int64_t this_ptr) {
50882         LDKFinalOnionHopData this_ptr_conv;
50883         this_ptr_conv.inner = untag_ptr(this_ptr);
50884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50886         this_ptr_conv.is_owned = false;
50887         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
50888         return ret_conv;
50889 }
50890
50891 void  CS_LDK_FinalOnionHopData_set_total_msat(int64_t this_ptr, int64_t val) {
50892         LDKFinalOnionHopData this_ptr_conv;
50893         this_ptr_conv.inner = untag_ptr(this_ptr);
50894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50896         this_ptr_conv.is_owned = false;
50897         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
50898 }
50899
50900 int64_t  CS_LDK_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
50901         LDKThirtyTwoBytes payment_secret_arg_ref;
50902         CHECK(payment_secret_arg->arr_len == 32);
50903         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
50904         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
50905         int64_t ret_ref = 0;
50906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50908         return ret_ref;
50909 }
50910
50911 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
50912         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
50913         int64_t ret_ref = 0;
50914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50916         return ret_ref;
50917 }
50918 int64_t  CS_LDK_FinalOnionHopData_clone_ptr(int64_t arg) {
50919         LDKFinalOnionHopData arg_conv;
50920         arg_conv.inner = untag_ptr(arg);
50921         arg_conv.is_owned = ptr_is_owned(arg);
50922         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50923         arg_conv.is_owned = false;
50924         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
50925         return ret_conv;
50926 }
50927
50928 int64_t  CS_LDK_FinalOnionHopData_clone(int64_t orig) {
50929         LDKFinalOnionHopData orig_conv;
50930         orig_conv.inner = untag_ptr(orig);
50931         orig_conv.is_owned = ptr_is_owned(orig);
50932         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50933         orig_conv.is_owned = false;
50934         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
50935         int64_t ret_ref = 0;
50936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50938         return ret_ref;
50939 }
50940
50941 void  CS_LDK_OnionPacket_free(int64_t this_obj) {
50942         LDKOnionPacket this_obj_conv;
50943         this_obj_conv.inner = untag_ptr(this_obj);
50944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50946         OnionPacket_free(this_obj_conv);
50947 }
50948
50949 int8_t  CS_LDK_OnionPacket_get_version(int64_t this_ptr) {
50950         LDKOnionPacket this_ptr_conv;
50951         this_ptr_conv.inner = untag_ptr(this_ptr);
50952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50954         this_ptr_conv.is_owned = false;
50955         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
50956         return ret_conv;
50957 }
50958
50959 void  CS_LDK_OnionPacket_set_version(int64_t this_ptr, int8_t val) {
50960         LDKOnionPacket this_ptr_conv;
50961         this_ptr_conv.inner = untag_ptr(this_ptr);
50962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50964         this_ptr_conv.is_owned = false;
50965         OnionPacket_set_version(&this_ptr_conv, val);
50966 }
50967
50968 int64_t  CS_LDK_OnionPacket_get_public_key(int64_t this_ptr) {
50969         LDKOnionPacket this_ptr_conv;
50970         this_ptr_conv.inner = untag_ptr(this_ptr);
50971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50973         this_ptr_conv.is_owned = false;
50974         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
50975         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
50976         return tag_ptr(ret_conv, true);
50977 }
50978
50979 void  CS_LDK_OnionPacket_set_public_key(int64_t this_ptr, int64_t val) {
50980         LDKOnionPacket this_ptr_conv;
50981         this_ptr_conv.inner = untag_ptr(this_ptr);
50982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50984         this_ptr_conv.is_owned = false;
50985         void* val_ptr = untag_ptr(val);
50986         CHECK_ACCESS(val_ptr);
50987         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
50988         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
50989         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
50990 }
50991
50992 int8_tArray  CS_LDK_OnionPacket_get_hmac(int64_t this_ptr) {
50993         LDKOnionPacket this_ptr_conv;
50994         this_ptr_conv.inner = untag_ptr(this_ptr);
50995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50997         this_ptr_conv.is_owned = false;
50998         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50999         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
51000         return ret_arr;
51001 }
51002
51003 void  CS_LDK_OnionPacket_set_hmac(int64_t this_ptr, int8_tArray val) {
51004         LDKOnionPacket this_ptr_conv;
51005         this_ptr_conv.inner = untag_ptr(this_ptr);
51006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51008         this_ptr_conv.is_owned = false;
51009         LDKThirtyTwoBytes val_ref;
51010         CHECK(val->arr_len == 32);
51011         memcpy(val_ref.data, val->elems, 32); FREE(val);
51012         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
51013 }
51014
51015 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
51016         LDKOnionPacket ret_var = OnionPacket_clone(arg);
51017         int64_t ret_ref = 0;
51018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51020         return ret_ref;
51021 }
51022 int64_t  CS_LDK_OnionPacket_clone_ptr(int64_t arg) {
51023         LDKOnionPacket arg_conv;
51024         arg_conv.inner = untag_ptr(arg);
51025         arg_conv.is_owned = ptr_is_owned(arg);
51026         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51027         arg_conv.is_owned = false;
51028         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
51029         return ret_conv;
51030 }
51031
51032 int64_t  CS_LDK_OnionPacket_clone(int64_t orig) {
51033         LDKOnionPacket orig_conv;
51034         orig_conv.inner = untag_ptr(orig);
51035         orig_conv.is_owned = ptr_is_owned(orig);
51036         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51037         orig_conv.is_owned = false;
51038         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
51039         int64_t ret_ref = 0;
51040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51042         return ret_ref;
51043 }
51044
51045 int64_t  CS_LDK_OnionPacket_hash(int64_t o) {
51046         LDKOnionPacket o_conv;
51047         o_conv.inner = untag_ptr(o);
51048         o_conv.is_owned = ptr_is_owned(o);
51049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51050         o_conv.is_owned = false;
51051         int64_t ret_conv = OnionPacket_hash(&o_conv);
51052         return ret_conv;
51053 }
51054
51055 jboolean  CS_LDK_OnionPacket_eq(int64_t a, int64_t b) {
51056         LDKOnionPacket a_conv;
51057         a_conv.inner = untag_ptr(a);
51058         a_conv.is_owned = ptr_is_owned(a);
51059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51060         a_conv.is_owned = false;
51061         LDKOnionPacket b_conv;
51062         b_conv.inner = untag_ptr(b);
51063         b_conv.is_owned = ptr_is_owned(b);
51064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51065         b_conv.is_owned = false;
51066         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
51067         return ret_conv;
51068 }
51069
51070 int8_tArray  CS_LDK_AcceptChannel_write(int64_t obj) {
51071         LDKAcceptChannel obj_conv;
51072         obj_conv.inner = untag_ptr(obj);
51073         obj_conv.is_owned = ptr_is_owned(obj);
51074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51075         obj_conv.is_owned = false;
51076         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
51077         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51078         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51079         CVec_u8Z_free(ret_var);
51080         return ret_arr;
51081 }
51082
51083 int64_t  CS_LDK_AcceptChannel_read(int8_tArray ser) {
51084         LDKu8slice ser_ref;
51085         ser_ref.datalen = ser->arr_len;
51086         ser_ref.data = ser->elems;
51087         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
51088         *ret_conv = AcceptChannel_read(ser_ref);
51089         FREE(ser);
51090         return tag_ptr(ret_conv, true);
51091 }
51092
51093 int8_tArray  CS_LDK_AcceptChannelV2_write(int64_t obj) {
51094         LDKAcceptChannelV2 obj_conv;
51095         obj_conv.inner = untag_ptr(obj);
51096         obj_conv.is_owned = ptr_is_owned(obj);
51097         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51098         obj_conv.is_owned = false;
51099         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
51100         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51101         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51102         CVec_u8Z_free(ret_var);
51103         return ret_arr;
51104 }
51105
51106 int64_t  CS_LDK_AcceptChannelV2_read(int8_tArray ser) {
51107         LDKu8slice ser_ref;
51108         ser_ref.datalen = ser->arr_len;
51109         ser_ref.data = ser->elems;
51110         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
51111         *ret_conv = AcceptChannelV2_read(ser_ref);
51112         FREE(ser);
51113         return tag_ptr(ret_conv, true);
51114 }
51115
51116 int8_tArray  CS_LDK_Stfu_write(int64_t obj) {
51117         LDKStfu obj_conv;
51118         obj_conv.inner = untag_ptr(obj);
51119         obj_conv.is_owned = ptr_is_owned(obj);
51120         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51121         obj_conv.is_owned = false;
51122         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
51123         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51124         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51125         CVec_u8Z_free(ret_var);
51126         return ret_arr;
51127 }
51128
51129 int64_t  CS_LDK_Stfu_read(int8_tArray ser) {
51130         LDKu8slice ser_ref;
51131         ser_ref.datalen = ser->arr_len;
51132         ser_ref.data = ser->elems;
51133         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
51134         *ret_conv = Stfu_read(ser_ref);
51135         FREE(ser);
51136         return tag_ptr(ret_conv, true);
51137 }
51138
51139 int8_tArray  CS_LDK_Splice_write(int64_t obj) {
51140         LDKSplice obj_conv;
51141         obj_conv.inner = untag_ptr(obj);
51142         obj_conv.is_owned = ptr_is_owned(obj);
51143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51144         obj_conv.is_owned = false;
51145         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
51146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51148         CVec_u8Z_free(ret_var);
51149         return ret_arr;
51150 }
51151
51152 int64_t  CS_LDK_Splice_read(int8_tArray ser) {
51153         LDKu8slice ser_ref;
51154         ser_ref.datalen = ser->arr_len;
51155         ser_ref.data = ser->elems;
51156         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
51157         *ret_conv = Splice_read(ser_ref);
51158         FREE(ser);
51159         return tag_ptr(ret_conv, true);
51160 }
51161
51162 int8_tArray  CS_LDK_SpliceAck_write(int64_t obj) {
51163         LDKSpliceAck obj_conv;
51164         obj_conv.inner = untag_ptr(obj);
51165         obj_conv.is_owned = ptr_is_owned(obj);
51166         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51167         obj_conv.is_owned = false;
51168         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
51169         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51170         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51171         CVec_u8Z_free(ret_var);
51172         return ret_arr;
51173 }
51174
51175 int64_t  CS_LDK_SpliceAck_read(int8_tArray ser) {
51176         LDKu8slice ser_ref;
51177         ser_ref.datalen = ser->arr_len;
51178         ser_ref.data = ser->elems;
51179         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
51180         *ret_conv = SpliceAck_read(ser_ref);
51181         FREE(ser);
51182         return tag_ptr(ret_conv, true);
51183 }
51184
51185 int8_tArray  CS_LDK_SpliceLocked_write(int64_t obj) {
51186         LDKSpliceLocked obj_conv;
51187         obj_conv.inner = untag_ptr(obj);
51188         obj_conv.is_owned = ptr_is_owned(obj);
51189         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51190         obj_conv.is_owned = false;
51191         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
51192         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51193         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51194         CVec_u8Z_free(ret_var);
51195         return ret_arr;
51196 }
51197
51198 int64_t  CS_LDK_SpliceLocked_read(int8_tArray ser) {
51199         LDKu8slice ser_ref;
51200         ser_ref.datalen = ser->arr_len;
51201         ser_ref.data = ser->elems;
51202         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
51203         *ret_conv = SpliceLocked_read(ser_ref);
51204         FREE(ser);
51205         return tag_ptr(ret_conv, true);
51206 }
51207
51208 int8_tArray  CS_LDK_TxAddInput_write(int64_t obj) {
51209         LDKTxAddInput obj_conv;
51210         obj_conv.inner = untag_ptr(obj);
51211         obj_conv.is_owned = ptr_is_owned(obj);
51212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51213         obj_conv.is_owned = false;
51214         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
51215         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51216         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51217         CVec_u8Z_free(ret_var);
51218         return ret_arr;
51219 }
51220
51221 int64_t  CS_LDK_TxAddInput_read(int8_tArray ser) {
51222         LDKu8slice ser_ref;
51223         ser_ref.datalen = ser->arr_len;
51224         ser_ref.data = ser->elems;
51225         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
51226         *ret_conv = TxAddInput_read(ser_ref);
51227         FREE(ser);
51228         return tag_ptr(ret_conv, true);
51229 }
51230
51231 int8_tArray  CS_LDK_TxAddOutput_write(int64_t obj) {
51232         LDKTxAddOutput obj_conv;
51233         obj_conv.inner = untag_ptr(obj);
51234         obj_conv.is_owned = ptr_is_owned(obj);
51235         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51236         obj_conv.is_owned = false;
51237         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
51238         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51239         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51240         CVec_u8Z_free(ret_var);
51241         return ret_arr;
51242 }
51243
51244 int64_t  CS_LDK_TxAddOutput_read(int8_tArray ser) {
51245         LDKu8slice ser_ref;
51246         ser_ref.datalen = ser->arr_len;
51247         ser_ref.data = ser->elems;
51248         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
51249         *ret_conv = TxAddOutput_read(ser_ref);
51250         FREE(ser);
51251         return tag_ptr(ret_conv, true);
51252 }
51253
51254 int8_tArray  CS_LDK_TxRemoveInput_write(int64_t obj) {
51255         LDKTxRemoveInput obj_conv;
51256         obj_conv.inner = untag_ptr(obj);
51257         obj_conv.is_owned = ptr_is_owned(obj);
51258         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51259         obj_conv.is_owned = false;
51260         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
51261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51263         CVec_u8Z_free(ret_var);
51264         return ret_arr;
51265 }
51266
51267 int64_t  CS_LDK_TxRemoveInput_read(int8_tArray ser) {
51268         LDKu8slice ser_ref;
51269         ser_ref.datalen = ser->arr_len;
51270         ser_ref.data = ser->elems;
51271         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
51272         *ret_conv = TxRemoveInput_read(ser_ref);
51273         FREE(ser);
51274         return tag_ptr(ret_conv, true);
51275 }
51276
51277 int8_tArray  CS_LDK_TxRemoveOutput_write(int64_t obj) {
51278         LDKTxRemoveOutput obj_conv;
51279         obj_conv.inner = untag_ptr(obj);
51280         obj_conv.is_owned = ptr_is_owned(obj);
51281         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51282         obj_conv.is_owned = false;
51283         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
51284         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51285         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51286         CVec_u8Z_free(ret_var);
51287         return ret_arr;
51288 }
51289
51290 int64_t  CS_LDK_TxRemoveOutput_read(int8_tArray ser) {
51291         LDKu8slice ser_ref;
51292         ser_ref.datalen = ser->arr_len;
51293         ser_ref.data = ser->elems;
51294         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
51295         *ret_conv = TxRemoveOutput_read(ser_ref);
51296         FREE(ser);
51297         return tag_ptr(ret_conv, true);
51298 }
51299
51300 int8_tArray  CS_LDK_TxComplete_write(int64_t obj) {
51301         LDKTxComplete obj_conv;
51302         obj_conv.inner = untag_ptr(obj);
51303         obj_conv.is_owned = ptr_is_owned(obj);
51304         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51305         obj_conv.is_owned = false;
51306         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
51307         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51308         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51309         CVec_u8Z_free(ret_var);
51310         return ret_arr;
51311 }
51312
51313 int64_t  CS_LDK_TxComplete_read(int8_tArray ser) {
51314         LDKu8slice ser_ref;
51315         ser_ref.datalen = ser->arr_len;
51316         ser_ref.data = ser->elems;
51317         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
51318         *ret_conv = TxComplete_read(ser_ref);
51319         FREE(ser);
51320         return tag_ptr(ret_conv, true);
51321 }
51322
51323 int8_tArray  CS_LDK_TxSignatures_write(int64_t obj) {
51324         LDKTxSignatures obj_conv;
51325         obj_conv.inner = untag_ptr(obj);
51326         obj_conv.is_owned = ptr_is_owned(obj);
51327         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51328         obj_conv.is_owned = false;
51329         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
51330         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51331         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51332         CVec_u8Z_free(ret_var);
51333         return ret_arr;
51334 }
51335
51336 int64_t  CS_LDK_TxSignatures_read(int8_tArray ser) {
51337         LDKu8slice ser_ref;
51338         ser_ref.datalen = ser->arr_len;
51339         ser_ref.data = ser->elems;
51340         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
51341         *ret_conv = TxSignatures_read(ser_ref);
51342         FREE(ser);
51343         return tag_ptr(ret_conv, true);
51344 }
51345
51346 int8_tArray  CS_LDK_TxInitRbf_write(int64_t obj) {
51347         LDKTxInitRbf obj_conv;
51348         obj_conv.inner = untag_ptr(obj);
51349         obj_conv.is_owned = ptr_is_owned(obj);
51350         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51351         obj_conv.is_owned = false;
51352         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
51353         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51354         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51355         CVec_u8Z_free(ret_var);
51356         return ret_arr;
51357 }
51358
51359 int64_t  CS_LDK_TxInitRbf_read(int8_tArray ser) {
51360         LDKu8slice ser_ref;
51361         ser_ref.datalen = ser->arr_len;
51362         ser_ref.data = ser->elems;
51363         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
51364         *ret_conv = TxInitRbf_read(ser_ref);
51365         FREE(ser);
51366         return tag_ptr(ret_conv, true);
51367 }
51368
51369 int8_tArray  CS_LDK_TxAckRbf_write(int64_t obj) {
51370         LDKTxAckRbf obj_conv;
51371         obj_conv.inner = untag_ptr(obj);
51372         obj_conv.is_owned = ptr_is_owned(obj);
51373         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51374         obj_conv.is_owned = false;
51375         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
51376         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51377         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51378         CVec_u8Z_free(ret_var);
51379         return ret_arr;
51380 }
51381
51382 int64_t  CS_LDK_TxAckRbf_read(int8_tArray ser) {
51383         LDKu8slice ser_ref;
51384         ser_ref.datalen = ser->arr_len;
51385         ser_ref.data = ser->elems;
51386         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
51387         *ret_conv = TxAckRbf_read(ser_ref);
51388         FREE(ser);
51389         return tag_ptr(ret_conv, true);
51390 }
51391
51392 int8_tArray  CS_LDK_TxAbort_write(int64_t obj) {
51393         LDKTxAbort obj_conv;
51394         obj_conv.inner = untag_ptr(obj);
51395         obj_conv.is_owned = ptr_is_owned(obj);
51396         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51397         obj_conv.is_owned = false;
51398         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
51399         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51400         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51401         CVec_u8Z_free(ret_var);
51402         return ret_arr;
51403 }
51404
51405 int64_t  CS_LDK_TxAbort_read(int8_tArray ser) {
51406         LDKu8slice ser_ref;
51407         ser_ref.datalen = ser->arr_len;
51408         ser_ref.data = ser->elems;
51409         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
51410         *ret_conv = TxAbort_read(ser_ref);
51411         FREE(ser);
51412         return tag_ptr(ret_conv, true);
51413 }
51414
51415 int8_tArray  CS_LDK_AnnouncementSignatures_write(int64_t obj) {
51416         LDKAnnouncementSignatures obj_conv;
51417         obj_conv.inner = untag_ptr(obj);
51418         obj_conv.is_owned = ptr_is_owned(obj);
51419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51420         obj_conv.is_owned = false;
51421         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
51422         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51423         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51424         CVec_u8Z_free(ret_var);
51425         return ret_arr;
51426 }
51427
51428 int64_t  CS_LDK_AnnouncementSignatures_read(int8_tArray ser) {
51429         LDKu8slice ser_ref;
51430         ser_ref.datalen = ser->arr_len;
51431         ser_ref.data = ser->elems;
51432         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
51433         *ret_conv = AnnouncementSignatures_read(ser_ref);
51434         FREE(ser);
51435         return tag_ptr(ret_conv, true);
51436 }
51437
51438 int8_tArray  CS_LDK_ChannelReestablish_write(int64_t obj) {
51439         LDKChannelReestablish obj_conv;
51440         obj_conv.inner = untag_ptr(obj);
51441         obj_conv.is_owned = ptr_is_owned(obj);
51442         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51443         obj_conv.is_owned = false;
51444         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
51445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51447         CVec_u8Z_free(ret_var);
51448         return ret_arr;
51449 }
51450
51451 int64_t  CS_LDK_ChannelReestablish_read(int8_tArray ser) {
51452         LDKu8slice ser_ref;
51453         ser_ref.datalen = ser->arr_len;
51454         ser_ref.data = ser->elems;
51455         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
51456         *ret_conv = ChannelReestablish_read(ser_ref);
51457         FREE(ser);
51458         return tag_ptr(ret_conv, true);
51459 }
51460
51461 int8_tArray  CS_LDK_ClosingSigned_write(int64_t obj) {
51462         LDKClosingSigned obj_conv;
51463         obj_conv.inner = untag_ptr(obj);
51464         obj_conv.is_owned = ptr_is_owned(obj);
51465         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51466         obj_conv.is_owned = false;
51467         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
51468         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51469         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51470         CVec_u8Z_free(ret_var);
51471         return ret_arr;
51472 }
51473
51474 int64_t  CS_LDK_ClosingSigned_read(int8_tArray ser) {
51475         LDKu8slice ser_ref;
51476         ser_ref.datalen = ser->arr_len;
51477         ser_ref.data = ser->elems;
51478         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
51479         *ret_conv = ClosingSigned_read(ser_ref);
51480         FREE(ser);
51481         return tag_ptr(ret_conv, true);
51482 }
51483
51484 int8_tArray  CS_LDK_ClosingSignedFeeRange_write(int64_t obj) {
51485         LDKClosingSignedFeeRange obj_conv;
51486         obj_conv.inner = untag_ptr(obj);
51487         obj_conv.is_owned = ptr_is_owned(obj);
51488         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51489         obj_conv.is_owned = false;
51490         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
51491         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51492         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51493         CVec_u8Z_free(ret_var);
51494         return ret_arr;
51495 }
51496
51497 int64_t  CS_LDK_ClosingSignedFeeRange_read(int8_tArray ser) {
51498         LDKu8slice ser_ref;
51499         ser_ref.datalen = ser->arr_len;
51500         ser_ref.data = ser->elems;
51501         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
51502         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
51503         FREE(ser);
51504         return tag_ptr(ret_conv, true);
51505 }
51506
51507 int8_tArray  CS_LDK_CommitmentSigned_write(int64_t obj) {
51508         LDKCommitmentSigned obj_conv;
51509         obj_conv.inner = untag_ptr(obj);
51510         obj_conv.is_owned = ptr_is_owned(obj);
51511         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51512         obj_conv.is_owned = false;
51513         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
51514         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51515         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51516         CVec_u8Z_free(ret_var);
51517         return ret_arr;
51518 }
51519
51520 int64_t  CS_LDK_CommitmentSigned_read(int8_tArray ser) {
51521         LDKu8slice ser_ref;
51522         ser_ref.datalen = ser->arr_len;
51523         ser_ref.data = ser->elems;
51524         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
51525         *ret_conv = CommitmentSigned_read(ser_ref);
51526         FREE(ser);
51527         return tag_ptr(ret_conv, true);
51528 }
51529
51530 int8_tArray  CS_LDK_FundingCreated_write(int64_t obj) {
51531         LDKFundingCreated obj_conv;
51532         obj_conv.inner = untag_ptr(obj);
51533         obj_conv.is_owned = ptr_is_owned(obj);
51534         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51535         obj_conv.is_owned = false;
51536         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
51537         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51538         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51539         CVec_u8Z_free(ret_var);
51540         return ret_arr;
51541 }
51542
51543 int64_t  CS_LDK_FundingCreated_read(int8_tArray ser) {
51544         LDKu8slice ser_ref;
51545         ser_ref.datalen = ser->arr_len;
51546         ser_ref.data = ser->elems;
51547         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
51548         *ret_conv = FundingCreated_read(ser_ref);
51549         FREE(ser);
51550         return tag_ptr(ret_conv, true);
51551 }
51552
51553 int8_tArray  CS_LDK_FundingSigned_write(int64_t obj) {
51554         LDKFundingSigned obj_conv;
51555         obj_conv.inner = untag_ptr(obj);
51556         obj_conv.is_owned = ptr_is_owned(obj);
51557         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51558         obj_conv.is_owned = false;
51559         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
51560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51562         CVec_u8Z_free(ret_var);
51563         return ret_arr;
51564 }
51565
51566 int64_t  CS_LDK_FundingSigned_read(int8_tArray ser) {
51567         LDKu8slice ser_ref;
51568         ser_ref.datalen = ser->arr_len;
51569         ser_ref.data = ser->elems;
51570         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
51571         *ret_conv = FundingSigned_read(ser_ref);
51572         FREE(ser);
51573         return tag_ptr(ret_conv, true);
51574 }
51575
51576 int8_tArray  CS_LDK_ChannelReady_write(int64_t obj) {
51577         LDKChannelReady obj_conv;
51578         obj_conv.inner = untag_ptr(obj);
51579         obj_conv.is_owned = ptr_is_owned(obj);
51580         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51581         obj_conv.is_owned = false;
51582         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
51583         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51584         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51585         CVec_u8Z_free(ret_var);
51586         return ret_arr;
51587 }
51588
51589 int64_t  CS_LDK_ChannelReady_read(int8_tArray ser) {
51590         LDKu8slice ser_ref;
51591         ser_ref.datalen = ser->arr_len;
51592         ser_ref.data = ser->elems;
51593         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
51594         *ret_conv = ChannelReady_read(ser_ref);
51595         FREE(ser);
51596         return tag_ptr(ret_conv, true);
51597 }
51598
51599 int8_tArray  CS_LDK_Init_write(int64_t obj) {
51600         LDKInit obj_conv;
51601         obj_conv.inner = untag_ptr(obj);
51602         obj_conv.is_owned = ptr_is_owned(obj);
51603         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51604         obj_conv.is_owned = false;
51605         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
51606         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51607         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51608         CVec_u8Z_free(ret_var);
51609         return ret_arr;
51610 }
51611
51612 int64_t  CS_LDK_Init_read(int8_tArray ser) {
51613         LDKu8slice ser_ref;
51614         ser_ref.datalen = ser->arr_len;
51615         ser_ref.data = ser->elems;
51616         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
51617         *ret_conv = Init_read(ser_ref);
51618         FREE(ser);
51619         return tag_ptr(ret_conv, true);
51620 }
51621
51622 int8_tArray  CS_LDK_OpenChannel_write(int64_t obj) {
51623         LDKOpenChannel obj_conv;
51624         obj_conv.inner = untag_ptr(obj);
51625         obj_conv.is_owned = ptr_is_owned(obj);
51626         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51627         obj_conv.is_owned = false;
51628         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
51629         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51630         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51631         CVec_u8Z_free(ret_var);
51632         return ret_arr;
51633 }
51634
51635 int64_t  CS_LDK_OpenChannel_read(int8_tArray ser) {
51636         LDKu8slice ser_ref;
51637         ser_ref.datalen = ser->arr_len;
51638         ser_ref.data = ser->elems;
51639         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
51640         *ret_conv = OpenChannel_read(ser_ref);
51641         FREE(ser);
51642         return tag_ptr(ret_conv, true);
51643 }
51644
51645 int8_tArray  CS_LDK_OpenChannelV2_write(int64_t obj) {
51646         LDKOpenChannelV2 obj_conv;
51647         obj_conv.inner = untag_ptr(obj);
51648         obj_conv.is_owned = ptr_is_owned(obj);
51649         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51650         obj_conv.is_owned = false;
51651         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
51652         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51653         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51654         CVec_u8Z_free(ret_var);
51655         return ret_arr;
51656 }
51657
51658 int64_t  CS_LDK_OpenChannelV2_read(int8_tArray ser) {
51659         LDKu8slice ser_ref;
51660         ser_ref.datalen = ser->arr_len;
51661         ser_ref.data = ser->elems;
51662         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
51663         *ret_conv = OpenChannelV2_read(ser_ref);
51664         FREE(ser);
51665         return tag_ptr(ret_conv, true);
51666 }
51667
51668 int8_tArray  CS_LDK_RevokeAndACK_write(int64_t obj) {
51669         LDKRevokeAndACK obj_conv;
51670         obj_conv.inner = untag_ptr(obj);
51671         obj_conv.is_owned = ptr_is_owned(obj);
51672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51673         obj_conv.is_owned = false;
51674         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
51675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51677         CVec_u8Z_free(ret_var);
51678         return ret_arr;
51679 }
51680
51681 int64_t  CS_LDK_RevokeAndACK_read(int8_tArray ser) {
51682         LDKu8slice ser_ref;
51683         ser_ref.datalen = ser->arr_len;
51684         ser_ref.data = ser->elems;
51685         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
51686         *ret_conv = RevokeAndACK_read(ser_ref);
51687         FREE(ser);
51688         return tag_ptr(ret_conv, true);
51689 }
51690
51691 int8_tArray  CS_LDK_Shutdown_write(int64_t obj) {
51692         LDKShutdown obj_conv;
51693         obj_conv.inner = untag_ptr(obj);
51694         obj_conv.is_owned = ptr_is_owned(obj);
51695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51696         obj_conv.is_owned = false;
51697         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
51698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51700         CVec_u8Z_free(ret_var);
51701         return ret_arr;
51702 }
51703
51704 int64_t  CS_LDK_Shutdown_read(int8_tArray ser) {
51705         LDKu8slice ser_ref;
51706         ser_ref.datalen = ser->arr_len;
51707         ser_ref.data = ser->elems;
51708         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
51709         *ret_conv = Shutdown_read(ser_ref);
51710         FREE(ser);
51711         return tag_ptr(ret_conv, true);
51712 }
51713
51714 int8_tArray  CS_LDK_UpdateFailHTLC_write(int64_t obj) {
51715         LDKUpdateFailHTLC obj_conv;
51716         obj_conv.inner = untag_ptr(obj);
51717         obj_conv.is_owned = ptr_is_owned(obj);
51718         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51719         obj_conv.is_owned = false;
51720         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
51721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51723         CVec_u8Z_free(ret_var);
51724         return ret_arr;
51725 }
51726
51727 int64_t  CS_LDK_UpdateFailHTLC_read(int8_tArray ser) {
51728         LDKu8slice ser_ref;
51729         ser_ref.datalen = ser->arr_len;
51730         ser_ref.data = ser->elems;
51731         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
51732         *ret_conv = UpdateFailHTLC_read(ser_ref);
51733         FREE(ser);
51734         return tag_ptr(ret_conv, true);
51735 }
51736
51737 int8_tArray  CS_LDK_UpdateFailMalformedHTLC_write(int64_t obj) {
51738         LDKUpdateFailMalformedHTLC obj_conv;
51739         obj_conv.inner = untag_ptr(obj);
51740         obj_conv.is_owned = ptr_is_owned(obj);
51741         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51742         obj_conv.is_owned = false;
51743         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
51744         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51745         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51746         CVec_u8Z_free(ret_var);
51747         return ret_arr;
51748 }
51749
51750 int64_t  CS_LDK_UpdateFailMalformedHTLC_read(int8_tArray ser) {
51751         LDKu8slice ser_ref;
51752         ser_ref.datalen = ser->arr_len;
51753         ser_ref.data = ser->elems;
51754         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
51755         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
51756         FREE(ser);
51757         return tag_ptr(ret_conv, true);
51758 }
51759
51760 int8_tArray  CS_LDK_UpdateFee_write(int64_t obj) {
51761         LDKUpdateFee obj_conv;
51762         obj_conv.inner = untag_ptr(obj);
51763         obj_conv.is_owned = ptr_is_owned(obj);
51764         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51765         obj_conv.is_owned = false;
51766         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
51767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51769         CVec_u8Z_free(ret_var);
51770         return ret_arr;
51771 }
51772
51773 int64_t  CS_LDK_UpdateFee_read(int8_tArray ser) {
51774         LDKu8slice ser_ref;
51775         ser_ref.datalen = ser->arr_len;
51776         ser_ref.data = ser->elems;
51777         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51778         *ret_conv = UpdateFee_read(ser_ref);
51779         FREE(ser);
51780         return tag_ptr(ret_conv, true);
51781 }
51782
51783 int8_tArray  CS_LDK_UpdateFulfillHTLC_write(int64_t obj) {
51784         LDKUpdateFulfillHTLC obj_conv;
51785         obj_conv.inner = untag_ptr(obj);
51786         obj_conv.is_owned = ptr_is_owned(obj);
51787         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51788         obj_conv.is_owned = false;
51789         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51790         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51791         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51792         CVec_u8Z_free(ret_var);
51793         return ret_arr;
51794 }
51795
51796 int64_t  CS_LDK_UpdateFulfillHTLC_read(int8_tArray ser) {
51797         LDKu8slice ser_ref;
51798         ser_ref.datalen = ser->arr_len;
51799         ser_ref.data = ser->elems;
51800         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51801         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51802         FREE(ser);
51803         return tag_ptr(ret_conv, true);
51804 }
51805
51806 int8_tArray  CS_LDK_OnionPacket_write(int64_t obj) {
51807         LDKOnionPacket obj_conv;
51808         obj_conv.inner = untag_ptr(obj);
51809         obj_conv.is_owned = ptr_is_owned(obj);
51810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51811         obj_conv.is_owned = false;
51812         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
51813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51815         CVec_u8Z_free(ret_var);
51816         return ret_arr;
51817 }
51818
51819 int64_t  CS_LDK_OnionPacket_read(int8_tArray ser) {
51820         LDKu8slice ser_ref;
51821         ser_ref.datalen = ser->arr_len;
51822         ser_ref.data = ser->elems;
51823         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
51824         *ret_conv = OnionPacket_read(ser_ref);
51825         FREE(ser);
51826         return tag_ptr(ret_conv, true);
51827 }
51828
51829 int8_tArray  CS_LDK_UpdateAddHTLC_write(int64_t obj) {
51830         LDKUpdateAddHTLC obj_conv;
51831         obj_conv.inner = untag_ptr(obj);
51832         obj_conv.is_owned = ptr_is_owned(obj);
51833         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51834         obj_conv.is_owned = false;
51835         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51836         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51837         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51838         CVec_u8Z_free(ret_var);
51839         return ret_arr;
51840 }
51841
51842 int64_t  CS_LDK_UpdateAddHTLC_read(int8_tArray ser) {
51843         LDKu8slice ser_ref;
51844         ser_ref.datalen = ser->arr_len;
51845         ser_ref.data = ser->elems;
51846         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51847         *ret_conv = UpdateAddHTLC_read(ser_ref);
51848         FREE(ser);
51849         return tag_ptr(ret_conv, true);
51850 }
51851
51852 int64_t  CS_LDK_OnionMessage_read(int8_tArray ser) {
51853         LDKu8slice ser_ref;
51854         ser_ref.datalen = ser->arr_len;
51855         ser_ref.data = ser->elems;
51856         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51857         *ret_conv = OnionMessage_read(ser_ref);
51858         FREE(ser);
51859         return tag_ptr(ret_conv, true);
51860 }
51861
51862 int8_tArray  CS_LDK_OnionMessage_write(int64_t obj) {
51863         LDKOnionMessage obj_conv;
51864         obj_conv.inner = untag_ptr(obj);
51865         obj_conv.is_owned = ptr_is_owned(obj);
51866         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51867         obj_conv.is_owned = false;
51868         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51869         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51870         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51871         CVec_u8Z_free(ret_var);
51872         return ret_arr;
51873 }
51874
51875 int8_tArray  CS_LDK_FinalOnionHopData_write(int64_t obj) {
51876         LDKFinalOnionHopData obj_conv;
51877         obj_conv.inner = untag_ptr(obj);
51878         obj_conv.is_owned = ptr_is_owned(obj);
51879         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51880         obj_conv.is_owned = false;
51881         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
51882         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51883         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51884         CVec_u8Z_free(ret_var);
51885         return ret_arr;
51886 }
51887
51888 int64_t  CS_LDK_FinalOnionHopData_read(int8_tArray ser) {
51889         LDKu8slice ser_ref;
51890         ser_ref.datalen = ser->arr_len;
51891         ser_ref.data = ser->elems;
51892         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
51893         *ret_conv = FinalOnionHopData_read(ser_ref);
51894         FREE(ser);
51895         return tag_ptr(ret_conv, true);
51896 }
51897
51898 int8_tArray  CS_LDK_Ping_write(int64_t obj) {
51899         LDKPing obj_conv;
51900         obj_conv.inner = untag_ptr(obj);
51901         obj_conv.is_owned = ptr_is_owned(obj);
51902         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51903         obj_conv.is_owned = false;
51904         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51905         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51906         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51907         CVec_u8Z_free(ret_var);
51908         return ret_arr;
51909 }
51910
51911 int64_t  CS_LDK_Ping_read(int8_tArray ser) {
51912         LDKu8slice ser_ref;
51913         ser_ref.datalen = ser->arr_len;
51914         ser_ref.data = ser->elems;
51915         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51916         *ret_conv = Ping_read(ser_ref);
51917         FREE(ser);
51918         return tag_ptr(ret_conv, true);
51919 }
51920
51921 int8_tArray  CS_LDK_Pong_write(int64_t obj) {
51922         LDKPong obj_conv;
51923         obj_conv.inner = untag_ptr(obj);
51924         obj_conv.is_owned = ptr_is_owned(obj);
51925         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51926         obj_conv.is_owned = false;
51927         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51928         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51929         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51930         CVec_u8Z_free(ret_var);
51931         return ret_arr;
51932 }
51933
51934 int64_t  CS_LDK_Pong_read(int8_tArray ser) {
51935         LDKu8slice ser_ref;
51936         ser_ref.datalen = ser->arr_len;
51937         ser_ref.data = ser->elems;
51938         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51939         *ret_conv = Pong_read(ser_ref);
51940         FREE(ser);
51941         return tag_ptr(ret_conv, true);
51942 }
51943
51944 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_write(int64_t obj) {
51945         LDKUnsignedChannelAnnouncement obj_conv;
51946         obj_conv.inner = untag_ptr(obj);
51947         obj_conv.is_owned = ptr_is_owned(obj);
51948         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51949         obj_conv.is_owned = false;
51950         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51951         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51952         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51953         CVec_u8Z_free(ret_var);
51954         return ret_arr;
51955 }
51956
51957 int64_t  CS_LDK_UnsignedChannelAnnouncement_read(int8_tArray ser) {
51958         LDKu8slice ser_ref;
51959         ser_ref.datalen = ser->arr_len;
51960         ser_ref.data = ser->elems;
51961         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51962         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51963         FREE(ser);
51964         return tag_ptr(ret_conv, true);
51965 }
51966
51967 int8_tArray  CS_LDK_ChannelAnnouncement_write(int64_t obj) {
51968         LDKChannelAnnouncement obj_conv;
51969         obj_conv.inner = untag_ptr(obj);
51970         obj_conv.is_owned = ptr_is_owned(obj);
51971         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51972         obj_conv.is_owned = false;
51973         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51976         CVec_u8Z_free(ret_var);
51977         return ret_arr;
51978 }
51979
51980 int64_t  CS_LDK_ChannelAnnouncement_read(int8_tArray ser) {
51981         LDKu8slice ser_ref;
51982         ser_ref.datalen = ser->arr_len;
51983         ser_ref.data = ser->elems;
51984         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51985         *ret_conv = ChannelAnnouncement_read(ser_ref);
51986         FREE(ser);
51987         return tag_ptr(ret_conv, true);
51988 }
51989
51990 int8_tArray  CS_LDK_UnsignedChannelUpdate_write(int64_t obj) {
51991         LDKUnsignedChannelUpdate obj_conv;
51992         obj_conv.inner = untag_ptr(obj);
51993         obj_conv.is_owned = ptr_is_owned(obj);
51994         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51995         obj_conv.is_owned = false;
51996         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51997         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51998         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51999         CVec_u8Z_free(ret_var);
52000         return ret_arr;
52001 }
52002
52003 int64_t  CS_LDK_UnsignedChannelUpdate_read(int8_tArray ser) {
52004         LDKu8slice ser_ref;
52005         ser_ref.datalen = ser->arr_len;
52006         ser_ref.data = ser->elems;
52007         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
52008         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
52009         FREE(ser);
52010         return tag_ptr(ret_conv, true);
52011 }
52012
52013 int8_tArray  CS_LDK_ChannelUpdate_write(int64_t obj) {
52014         LDKChannelUpdate obj_conv;
52015         obj_conv.inner = untag_ptr(obj);
52016         obj_conv.is_owned = ptr_is_owned(obj);
52017         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52018         obj_conv.is_owned = false;
52019         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
52020         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52021         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52022         CVec_u8Z_free(ret_var);
52023         return ret_arr;
52024 }
52025
52026 int64_t  CS_LDK_ChannelUpdate_read(int8_tArray ser) {
52027         LDKu8slice ser_ref;
52028         ser_ref.datalen = ser->arr_len;
52029         ser_ref.data = ser->elems;
52030         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
52031         *ret_conv = ChannelUpdate_read(ser_ref);
52032         FREE(ser);
52033         return tag_ptr(ret_conv, true);
52034 }
52035
52036 int8_tArray  CS_LDK_ErrorMessage_write(int64_t obj) {
52037         LDKErrorMessage obj_conv;
52038         obj_conv.inner = untag_ptr(obj);
52039         obj_conv.is_owned = ptr_is_owned(obj);
52040         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52041         obj_conv.is_owned = false;
52042         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
52043         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52044         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52045         CVec_u8Z_free(ret_var);
52046         return ret_arr;
52047 }
52048
52049 int64_t  CS_LDK_ErrorMessage_read(int8_tArray ser) {
52050         LDKu8slice ser_ref;
52051         ser_ref.datalen = ser->arr_len;
52052         ser_ref.data = ser->elems;
52053         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
52054         *ret_conv = ErrorMessage_read(ser_ref);
52055         FREE(ser);
52056         return tag_ptr(ret_conv, true);
52057 }
52058
52059 int8_tArray  CS_LDK_WarningMessage_write(int64_t obj) {
52060         LDKWarningMessage obj_conv;
52061         obj_conv.inner = untag_ptr(obj);
52062         obj_conv.is_owned = ptr_is_owned(obj);
52063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52064         obj_conv.is_owned = false;
52065         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
52066         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52067         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52068         CVec_u8Z_free(ret_var);
52069         return ret_arr;
52070 }
52071
52072 int64_t  CS_LDK_WarningMessage_read(int8_tArray ser) {
52073         LDKu8slice ser_ref;
52074         ser_ref.datalen = ser->arr_len;
52075         ser_ref.data = ser->elems;
52076         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
52077         *ret_conv = WarningMessage_read(ser_ref);
52078         FREE(ser);
52079         return tag_ptr(ret_conv, true);
52080 }
52081
52082 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_write(int64_t obj) {
52083         LDKUnsignedNodeAnnouncement obj_conv;
52084         obj_conv.inner = untag_ptr(obj);
52085         obj_conv.is_owned = ptr_is_owned(obj);
52086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52087         obj_conv.is_owned = false;
52088         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
52089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52091         CVec_u8Z_free(ret_var);
52092         return ret_arr;
52093 }
52094
52095 int64_t  CS_LDK_UnsignedNodeAnnouncement_read(int8_tArray ser) {
52096         LDKu8slice ser_ref;
52097         ser_ref.datalen = ser->arr_len;
52098         ser_ref.data = ser->elems;
52099         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
52100         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
52101         FREE(ser);
52102         return tag_ptr(ret_conv, true);
52103 }
52104
52105 int8_tArray  CS_LDK_NodeAnnouncement_write(int64_t obj) {
52106         LDKNodeAnnouncement obj_conv;
52107         obj_conv.inner = untag_ptr(obj);
52108         obj_conv.is_owned = ptr_is_owned(obj);
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52110         obj_conv.is_owned = false;
52111         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
52112         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52113         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52114         CVec_u8Z_free(ret_var);
52115         return ret_arr;
52116 }
52117
52118 int64_t  CS_LDK_NodeAnnouncement_read(int8_tArray ser) {
52119         LDKu8slice ser_ref;
52120         ser_ref.datalen = ser->arr_len;
52121         ser_ref.data = ser->elems;
52122         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
52123         *ret_conv = NodeAnnouncement_read(ser_ref);
52124         FREE(ser);
52125         return tag_ptr(ret_conv, true);
52126 }
52127
52128 int64_t  CS_LDK_QueryShortChannelIds_read(int8_tArray ser) {
52129         LDKu8slice ser_ref;
52130         ser_ref.datalen = ser->arr_len;
52131         ser_ref.data = ser->elems;
52132         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
52133         *ret_conv = QueryShortChannelIds_read(ser_ref);
52134         FREE(ser);
52135         return tag_ptr(ret_conv, true);
52136 }
52137
52138 int8_tArray  CS_LDK_QueryShortChannelIds_write(int64_t obj) {
52139         LDKQueryShortChannelIds obj_conv;
52140         obj_conv.inner = untag_ptr(obj);
52141         obj_conv.is_owned = ptr_is_owned(obj);
52142         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52143         obj_conv.is_owned = false;
52144         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
52145         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52146         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52147         CVec_u8Z_free(ret_var);
52148         return ret_arr;
52149 }
52150
52151 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_write(int64_t obj) {
52152         LDKReplyShortChannelIdsEnd obj_conv;
52153         obj_conv.inner = untag_ptr(obj);
52154         obj_conv.is_owned = ptr_is_owned(obj);
52155         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52156         obj_conv.is_owned = false;
52157         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
52158         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52159         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52160         CVec_u8Z_free(ret_var);
52161         return ret_arr;
52162 }
52163
52164 int64_t  CS_LDK_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
52165         LDKu8slice ser_ref;
52166         ser_ref.datalen = ser->arr_len;
52167         ser_ref.data = ser->elems;
52168         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
52169         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
52170         FREE(ser);
52171         return tag_ptr(ret_conv, true);
52172 }
52173
52174 int32_t  CS_LDK_QueryChannelRange_end_blocknum(int64_t this_arg) {
52175         LDKQueryChannelRange this_arg_conv;
52176         this_arg_conv.inner = untag_ptr(this_arg);
52177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52179         this_arg_conv.is_owned = false;
52180         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
52181         return ret_conv;
52182 }
52183
52184 int8_tArray  CS_LDK_QueryChannelRange_write(int64_t obj) {
52185         LDKQueryChannelRange obj_conv;
52186         obj_conv.inner = untag_ptr(obj);
52187         obj_conv.is_owned = ptr_is_owned(obj);
52188         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52189         obj_conv.is_owned = false;
52190         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
52191         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52192         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52193         CVec_u8Z_free(ret_var);
52194         return ret_arr;
52195 }
52196
52197 int64_t  CS_LDK_QueryChannelRange_read(int8_tArray ser) {
52198         LDKu8slice ser_ref;
52199         ser_ref.datalen = ser->arr_len;
52200         ser_ref.data = ser->elems;
52201         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
52202         *ret_conv = QueryChannelRange_read(ser_ref);
52203         FREE(ser);
52204         return tag_ptr(ret_conv, true);
52205 }
52206
52207 int64_t  CS_LDK_ReplyChannelRange_read(int8_tArray ser) {
52208         LDKu8slice ser_ref;
52209         ser_ref.datalen = ser->arr_len;
52210         ser_ref.data = ser->elems;
52211         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
52212         *ret_conv = ReplyChannelRange_read(ser_ref);
52213         FREE(ser);
52214         return tag_ptr(ret_conv, true);
52215 }
52216
52217 int8_tArray  CS_LDK_ReplyChannelRange_write(int64_t obj) {
52218         LDKReplyChannelRange obj_conv;
52219         obj_conv.inner = untag_ptr(obj);
52220         obj_conv.is_owned = ptr_is_owned(obj);
52221         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52222         obj_conv.is_owned = false;
52223         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
52224         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52225         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52226         CVec_u8Z_free(ret_var);
52227         return ret_arr;
52228 }
52229
52230 int8_tArray  CS_LDK_GossipTimestampFilter_write(int64_t obj) {
52231         LDKGossipTimestampFilter obj_conv;
52232         obj_conv.inner = untag_ptr(obj);
52233         obj_conv.is_owned = ptr_is_owned(obj);
52234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52235         obj_conv.is_owned = false;
52236         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
52237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52239         CVec_u8Z_free(ret_var);
52240         return ret_arr;
52241 }
52242
52243 int64_t  CS_LDK_GossipTimestampFilter_read(int8_tArray ser) {
52244         LDKu8slice ser_ref;
52245         ser_ref.datalen = ser->arr_len;
52246         ser_ref.data = ser->elems;
52247         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
52248         *ret_conv = GossipTimestampFilter_read(ser_ref);
52249         FREE(ser);
52250         return tag_ptr(ret_conv, true);
52251 }
52252
52253 void  CS_LDK_CustomMessageHandler_free(int64_t this_ptr) {
52254         if (!ptr_is_owned(this_ptr)) return;
52255         void* this_ptr_ptr = untag_ptr(this_ptr);
52256         CHECK_ACCESS(this_ptr_ptr);
52257         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
52258         FREE(untag_ptr(this_ptr));
52259         CustomMessageHandler_free(this_ptr_conv);
52260 }
52261
52262 void  CS_LDK_IgnoringMessageHandler_free(int64_t this_obj) {
52263         LDKIgnoringMessageHandler this_obj_conv;
52264         this_obj_conv.inner = untag_ptr(this_obj);
52265         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52267         IgnoringMessageHandler_free(this_obj_conv);
52268 }
52269
52270 int64_t  CS_LDK_IgnoringMessageHandler_new() {
52271         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
52272         int64_t ret_ref = 0;
52273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52275         return ret_ref;
52276 }
52277
52278 int64_t  CS_LDK_IgnoringMessageHandler_as_EventsProvider(int64_t this_arg) {
52279         LDKIgnoringMessageHandler this_arg_conv;
52280         this_arg_conv.inner = untag_ptr(this_arg);
52281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52283         this_arg_conv.is_owned = false;
52284         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
52285         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
52286         return tag_ptr(ret_ret, true);
52287 }
52288
52289 int64_t  CS_LDK_IgnoringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
52290         LDKIgnoringMessageHandler this_arg_conv;
52291         this_arg_conv.inner = untag_ptr(this_arg);
52292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52294         this_arg_conv.is_owned = false;
52295         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52296         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52297         return tag_ptr(ret_ret, true);
52298 }
52299
52300 int64_t  CS_LDK_IgnoringMessageHandler_as_RoutingMessageHandler(int64_t this_arg) {
52301         LDKIgnoringMessageHandler this_arg_conv;
52302         this_arg_conv.inner = untag_ptr(this_arg);
52303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52305         this_arg_conv.is_owned = false;
52306         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
52307         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
52308         return tag_ptr(ret_ret, true);
52309 }
52310
52311 int64_t  CS_LDK_IgnoringMessageHandler_as_OnionMessageHandler(int64_t this_arg) {
52312         LDKIgnoringMessageHandler this_arg_conv;
52313         this_arg_conv.inner = untag_ptr(this_arg);
52314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52316         this_arg_conv.is_owned = false;
52317         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
52318         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
52319         return tag_ptr(ret_ret, true);
52320 }
52321
52322 int64_t  CS_LDK_IgnoringMessageHandler_as_OffersMessageHandler(int64_t this_arg) {
52323         LDKIgnoringMessageHandler this_arg_conv;
52324         this_arg_conv.inner = untag_ptr(this_arg);
52325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52327         this_arg_conv.is_owned = false;
52328         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
52329         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
52330         return tag_ptr(ret_ret, true);
52331 }
52332
52333 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomOnionMessageHandler(int64_t this_arg) {
52334         LDKIgnoringMessageHandler this_arg_conv;
52335         this_arg_conv.inner = untag_ptr(this_arg);
52336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52338         this_arg_conv.is_owned = false;
52339         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
52340         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
52341         return tag_ptr(ret_ret, true);
52342 }
52343
52344 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageReader(int64_t this_arg) {
52345         LDKIgnoringMessageHandler this_arg_conv;
52346         this_arg_conv.inner = untag_ptr(this_arg);
52347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52349         this_arg_conv.is_owned = false;
52350         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
52351         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
52352         return tag_ptr(ret_ret, true);
52353 }
52354
52355 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageHandler(int64_t this_arg) {
52356         LDKIgnoringMessageHandler this_arg_conv;
52357         this_arg_conv.inner = untag_ptr(this_arg);
52358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52360         this_arg_conv.is_owned = false;
52361         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
52362         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
52363         return tag_ptr(ret_ret, true);
52364 }
52365
52366 void  CS_LDK_ErroringMessageHandler_free(int64_t this_obj) {
52367         LDKErroringMessageHandler this_obj_conv;
52368         this_obj_conv.inner = untag_ptr(this_obj);
52369         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52371         ErroringMessageHandler_free(this_obj_conv);
52372 }
52373
52374 int64_t  CS_LDK_ErroringMessageHandler_new() {
52375         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
52376         int64_t ret_ref = 0;
52377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52379         return ret_ref;
52380 }
52381
52382 int64_t  CS_LDK_ErroringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
52383         LDKErroringMessageHandler this_arg_conv;
52384         this_arg_conv.inner = untag_ptr(this_arg);
52385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52387         this_arg_conv.is_owned = false;
52388         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52389         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52390         return tag_ptr(ret_ret, true);
52391 }
52392
52393 int64_t  CS_LDK_ErroringMessageHandler_as_ChannelMessageHandler(int64_t this_arg) {
52394         LDKErroringMessageHandler this_arg_conv;
52395         this_arg_conv.inner = untag_ptr(this_arg);
52396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52398         this_arg_conv.is_owned = false;
52399         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
52400         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
52401         return tag_ptr(ret_ret, true);
52402 }
52403
52404 void  CS_LDK_MessageHandler_free(int64_t this_obj) {
52405         LDKMessageHandler this_obj_conv;
52406         this_obj_conv.inner = untag_ptr(this_obj);
52407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52409         MessageHandler_free(this_obj_conv);
52410 }
52411
52412 int64_t  CS_LDK_MessageHandler_get_chan_handler(int64_t this_ptr) {
52413         LDKMessageHandler this_ptr_conv;
52414         this_ptr_conv.inner = untag_ptr(this_ptr);
52415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52417         this_ptr_conv.is_owned = false;
52418         // WARNING: This object doesn't live past this scope, needs clone!
52419         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
52420         return ret_ret;
52421 }
52422
52423 void  CS_LDK_MessageHandler_set_chan_handler(int64_t this_ptr, int64_t val) {
52424         LDKMessageHandler this_ptr_conv;
52425         this_ptr_conv.inner = untag_ptr(this_ptr);
52426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52428         this_ptr_conv.is_owned = false;
52429         void* val_ptr = untag_ptr(val);
52430         CHECK_ACCESS(val_ptr);
52431         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
52432         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
52433                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52434                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
52435         }
52436         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
52437 }
52438
52439 int64_t  CS_LDK_MessageHandler_get_route_handler(int64_t this_ptr) {
52440         LDKMessageHandler this_ptr_conv;
52441         this_ptr_conv.inner = untag_ptr(this_ptr);
52442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52444         this_ptr_conv.is_owned = false;
52445         // WARNING: This object doesn't live past this scope, needs clone!
52446         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
52447         return ret_ret;
52448 }
52449
52450 void  CS_LDK_MessageHandler_set_route_handler(int64_t this_ptr, int64_t val) {
52451         LDKMessageHandler this_ptr_conv;
52452         this_ptr_conv.inner = untag_ptr(this_ptr);
52453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52455         this_ptr_conv.is_owned = false;
52456         void* val_ptr = untag_ptr(val);
52457         CHECK_ACCESS(val_ptr);
52458         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
52459         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52460                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52461                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
52462         }
52463         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
52464 }
52465
52466 int64_t  CS_LDK_MessageHandler_get_onion_message_handler(int64_t this_ptr) {
52467         LDKMessageHandler this_ptr_conv;
52468         this_ptr_conv.inner = untag_ptr(this_ptr);
52469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52471         this_ptr_conv.is_owned = false;
52472         // WARNING: This object doesn't live past this scope, needs clone!
52473         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
52474         return ret_ret;
52475 }
52476
52477 void  CS_LDK_MessageHandler_set_onion_message_handler(int64_t this_ptr, int64_t val) {
52478         LDKMessageHandler this_ptr_conv;
52479         this_ptr_conv.inner = untag_ptr(this_ptr);
52480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52482         this_ptr_conv.is_owned = false;
52483         void* val_ptr = untag_ptr(val);
52484         CHECK_ACCESS(val_ptr);
52485         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
52486         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
52487                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52488                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
52489         }
52490         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
52491 }
52492
52493 int64_t  CS_LDK_MessageHandler_get_custom_message_handler(int64_t this_ptr) {
52494         LDKMessageHandler this_ptr_conv;
52495         this_ptr_conv.inner = untag_ptr(this_ptr);
52496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52498         this_ptr_conv.is_owned = false;
52499         // WARNING: This object doesn't live past this scope, needs clone!
52500         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
52501         return ret_ret;
52502 }
52503
52504 void  CS_LDK_MessageHandler_set_custom_message_handler(int64_t this_ptr, int64_t val) {
52505         LDKMessageHandler this_ptr_conv;
52506         this_ptr_conv.inner = untag_ptr(this_ptr);
52507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52509         this_ptr_conv.is_owned = false;
52510         void* val_ptr = untag_ptr(val);
52511         CHECK_ACCESS(val_ptr);
52512         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
52513         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
52514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52515                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
52516         }
52517         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
52518 }
52519
52520 int64_t  CS_LDK_MessageHandler_new(int64_t chan_handler_arg, int64_t route_handler_arg, int64_t onion_message_handler_arg, int64_t custom_message_handler_arg) {
52521         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
52522         CHECK_ACCESS(chan_handler_arg_ptr);
52523         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
52524         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
52525                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52526                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
52527         }
52528         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
52529         CHECK_ACCESS(route_handler_arg_ptr);
52530         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
52531         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52532                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52533                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
52534         }
52535         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
52536         CHECK_ACCESS(onion_message_handler_arg_ptr);
52537         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
52538         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
52539                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52540                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
52541         }
52542         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
52543         CHECK_ACCESS(custom_message_handler_arg_ptr);
52544         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
52545         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
52546                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52547                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
52548         }
52549         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
52550         int64_t ret_ref = 0;
52551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52553         return ret_ref;
52554 }
52555
52556 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
52557         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52558         *ret_ret = SocketDescriptor_clone(arg);
52559         return tag_ptr(ret_ret, true);
52560 }
52561 int64_t  CS_LDK_SocketDescriptor_clone_ptr(int64_t arg) {
52562         void* arg_ptr = untag_ptr(arg);
52563         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52564         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
52565         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
52566         return ret_conv;
52567 }
52568
52569 int64_t  CS_LDK_SocketDescriptor_clone(int64_t orig) {
52570         void* orig_ptr = untag_ptr(orig);
52571         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52572         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
52573         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52574         *ret_ret = SocketDescriptor_clone(orig_conv);
52575         return tag_ptr(ret_ret, true);
52576 }
52577
52578 void  CS_LDK_SocketDescriptor_free(int64_t this_ptr) {
52579         if (!ptr_is_owned(this_ptr)) return;
52580         void* this_ptr_ptr = untag_ptr(this_ptr);
52581         CHECK_ACCESS(this_ptr_ptr);
52582         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
52583         FREE(untag_ptr(this_ptr));
52584         SocketDescriptor_free(this_ptr_conv);
52585 }
52586
52587 void  CS_LDK_PeerHandleError_free(int64_t this_obj) {
52588         LDKPeerHandleError this_obj_conv;
52589         this_obj_conv.inner = untag_ptr(this_obj);
52590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52592         PeerHandleError_free(this_obj_conv);
52593 }
52594
52595 int64_t  CS_LDK_PeerHandleError_new() {
52596         LDKPeerHandleError ret_var = PeerHandleError_new();
52597         int64_t ret_ref = 0;
52598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52600         return ret_ref;
52601 }
52602
52603 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
52604         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
52605         int64_t ret_ref = 0;
52606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52608         return ret_ref;
52609 }
52610 int64_t  CS_LDK_PeerHandleError_clone_ptr(int64_t arg) {
52611         LDKPeerHandleError arg_conv;
52612         arg_conv.inner = untag_ptr(arg);
52613         arg_conv.is_owned = ptr_is_owned(arg);
52614         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52615         arg_conv.is_owned = false;
52616         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
52617         return ret_conv;
52618 }
52619
52620 int64_t  CS_LDK_PeerHandleError_clone(int64_t orig) {
52621         LDKPeerHandleError orig_conv;
52622         orig_conv.inner = untag_ptr(orig);
52623         orig_conv.is_owned = ptr_is_owned(orig);
52624         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52625         orig_conv.is_owned = false;
52626         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
52627         int64_t ret_ref = 0;
52628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52630         return ret_ref;
52631 }
52632
52633 void  CS_LDK_PeerManager_free(int64_t this_obj) {
52634         LDKPeerManager this_obj_conv;
52635         this_obj_conv.inner = untag_ptr(this_obj);
52636         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52638         PeerManager_free(this_obj_conv);
52639 }
52640
52641 int64_t  CS_LDK_PeerManager_new(int64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t node_signer) {
52642         LDKMessageHandler message_handler_conv;
52643         message_handler_conv.inner = untag_ptr(message_handler);
52644         message_handler_conv.is_owned = ptr_is_owned(message_handler);
52645         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
52646         // WARNING: we need a move here but no clone is available for LDKMessageHandler
52647         
52648         uint8_t ephemeral_random_data_arr[32];
52649         CHECK(ephemeral_random_data->arr_len == 32);
52650         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
52651         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
52652         void* logger_ptr = untag_ptr(logger);
52653         CHECK_ACCESS(logger_ptr);
52654         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52655         if (logger_conv.free == LDKLogger_JCalls_free) {
52656                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52657                 LDKLogger_JCalls_cloned(&logger_conv);
52658         }
52659         void* node_signer_ptr = untag_ptr(node_signer);
52660         CHECK_ACCESS(node_signer_ptr);
52661         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52662         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52663                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52664                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52665         }
52666         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
52667         int64_t ret_ref = 0;
52668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52670         return ret_ref;
52671 }
52672
52673 int64_tArray  CS_LDK_PeerManager_get_peer_node_ids(int64_t this_arg) {
52674         LDKPeerManager this_arg_conv;
52675         this_arg_conv.inner = untag_ptr(this_arg);
52676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52678         this_arg_conv.is_owned = false;
52679         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
52680         int64_tArray ret_arr = NULL;
52681         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
52682         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
52683         for (size_t r = 0; r < ret_var.datalen; r++) {
52684                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
52685                 *ret_conv_43_conv = ret_var.data[r];
52686                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
52687         }
52688         
52689         FREE(ret_var.data);
52690         return ret_arr;
52691 }
52692
52693 int64_t  CS_LDK_PeerManager_new_outbound_connection(int64_t this_arg, int8_tArray their_node_id, int64_t descriptor, int64_t remote_network_address) {
52694         LDKPeerManager this_arg_conv;
52695         this_arg_conv.inner = untag_ptr(this_arg);
52696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52698         this_arg_conv.is_owned = false;
52699         LDKPublicKey their_node_id_ref;
52700         CHECK(their_node_id->arr_len == 33);
52701         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
52702         void* descriptor_ptr = untag_ptr(descriptor);
52703         CHECK_ACCESS(descriptor_ptr);
52704         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52705         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52706                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52707                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52708         }
52709         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52710         CHECK_ACCESS(remote_network_address_ptr);
52711         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52712         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
52713         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
52714         return tag_ptr(ret_conv, true);
52715 }
52716
52717 int64_t  CS_LDK_PeerManager_new_inbound_connection(int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
52718         LDKPeerManager this_arg_conv;
52719         this_arg_conv.inner = untag_ptr(this_arg);
52720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52722         this_arg_conv.is_owned = false;
52723         void* descriptor_ptr = untag_ptr(descriptor);
52724         CHECK_ACCESS(descriptor_ptr);
52725         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52726         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52727                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52728                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52729         }
52730         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52731         CHECK_ACCESS(remote_network_address_ptr);
52732         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52733         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52734         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
52735         return tag_ptr(ret_conv, true);
52736 }
52737
52738 int64_t  CS_LDK_PeerManager_write_buffer_space_avail(int64_t this_arg, int64_t descriptor) {
52739         LDKPeerManager this_arg_conv;
52740         this_arg_conv.inner = untag_ptr(this_arg);
52741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52743         this_arg_conv.is_owned = false;
52744         void* descriptor_ptr = untag_ptr(descriptor);
52745         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52746         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52747         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52748         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
52749         return tag_ptr(ret_conv, true);
52750 }
52751
52752 int64_t  CS_LDK_PeerManager_read_event(int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
52753         LDKPeerManager this_arg_conv;
52754         this_arg_conv.inner = untag_ptr(this_arg);
52755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52757         this_arg_conv.is_owned = false;
52758         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
52759         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
52760         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
52761         LDKu8slice data_ref;
52762         data_ref.datalen = data->arr_len;
52763         data_ref.data = data->elems;
52764         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
52765         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
52766         FREE(data);
52767         return tag_ptr(ret_conv, true);
52768 }
52769
52770 void  CS_LDK_PeerManager_process_events(int64_t this_arg) {
52771         LDKPeerManager this_arg_conv;
52772         this_arg_conv.inner = untag_ptr(this_arg);
52773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52775         this_arg_conv.is_owned = false;
52776         PeerManager_process_events(&this_arg_conv);
52777 }
52778
52779 void  CS_LDK_PeerManager_socket_disconnected(int64_t this_arg, int64_t descriptor) {
52780         LDKPeerManager this_arg_conv;
52781         this_arg_conv.inner = untag_ptr(this_arg);
52782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52784         this_arg_conv.is_owned = false;
52785         void* descriptor_ptr = untag_ptr(descriptor);
52786         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52787         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52788         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
52789 }
52790
52791 void  CS_LDK_PeerManager_disconnect_by_node_id(int64_t this_arg, int8_tArray node_id) {
52792         LDKPeerManager this_arg_conv;
52793         this_arg_conv.inner = untag_ptr(this_arg);
52794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52796         this_arg_conv.is_owned = false;
52797         LDKPublicKey node_id_ref;
52798         CHECK(node_id->arr_len == 33);
52799         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
52800         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
52801 }
52802
52803 void  CS_LDK_PeerManager_disconnect_all_peers(int64_t this_arg) {
52804         LDKPeerManager this_arg_conv;
52805         this_arg_conv.inner = untag_ptr(this_arg);
52806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52808         this_arg_conv.is_owned = false;
52809         PeerManager_disconnect_all_peers(&this_arg_conv);
52810 }
52811
52812 void  CS_LDK_PeerManager_timer_tick_occurred(int64_t this_arg) {
52813         LDKPeerManager this_arg_conv;
52814         this_arg_conv.inner = untag_ptr(this_arg);
52815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52817         this_arg_conv.is_owned = false;
52818         PeerManager_timer_tick_occurred(&this_arg_conv);
52819 }
52820
52821 void  CS_LDK_PeerManager_broadcast_node_announcement(int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
52822         LDKPeerManager this_arg_conv;
52823         this_arg_conv.inner = untag_ptr(this_arg);
52824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52826         this_arg_conv.is_owned = false;
52827         LDKThreeBytes rgb_ref;
52828         CHECK(rgb->arr_len == 3);
52829         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
52830         LDKThirtyTwoBytes alias_ref;
52831         CHECK(alias->arr_len == 32);
52832         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
52833         LDKCVec_SocketAddressZ addresses_constr;
52834         addresses_constr.datalen = addresses->arr_len;
52835         if (addresses_constr.datalen > 0)
52836                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52837         else
52838                 addresses_constr.data = NULL;
52839         int64_t* addresses_vals = addresses->elems;
52840         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52841                 int64_t addresses_conv_15 = addresses_vals[p];
52842                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52843                 CHECK_ACCESS(addresses_conv_15_ptr);
52844                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52845                 addresses_constr.data[p] = addresses_conv_15_conv;
52846         }
52847         FREE(addresses);
52848         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52849 }
52850
52851 int64_t  CS_LDK_htlc_success_tx_weight(int64_t channel_type_features) {
52852         LDKChannelTypeFeatures channel_type_features_conv;
52853         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52854         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52855         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52856         channel_type_features_conv.is_owned = false;
52857         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52858         return ret_conv;
52859 }
52860
52861 int64_t  CS_LDK_htlc_timeout_tx_weight(int64_t channel_type_features) {
52862         LDKChannelTypeFeatures channel_type_features_conv;
52863         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52864         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52865         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52866         channel_type_features_conv.is_owned = false;
52867         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52868         return ret_conv;
52869 }
52870
52871 int32_t  CS_LDK_HTLCClaim_clone(int64_t orig) {
52872         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52873         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_clone(orig_conv));
52874         return ret_conv;
52875 }
52876
52877 int32_t  CS_LDK_HTLCClaim_offered_timeout() {
52878         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_timeout());
52879         return ret_conv;
52880 }
52881
52882 int32_t  CS_LDK_HTLCClaim_offered_preimage() {
52883         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_preimage());
52884         return ret_conv;
52885 }
52886
52887 int32_t  CS_LDK_HTLCClaim_accepted_timeout() {
52888         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_timeout());
52889         return ret_conv;
52890 }
52891
52892 int32_t  CS_LDK_HTLCClaim_accepted_preimage() {
52893         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_preimage());
52894         return ret_conv;
52895 }
52896
52897 int32_t  CS_LDK_HTLCClaim_revocation() {
52898         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_revocation());
52899         return ret_conv;
52900 }
52901
52902 jboolean  CS_LDK_HTLCClaim_eq(int64_t a, int64_t b) {
52903         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52904         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52905         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52906         return ret_conv;
52907 }
52908
52909 int64_t  CS_LDK_HTLCClaim_from_witness(int8_tArray witness) {
52910         LDKWitness witness_ref;
52911         witness_ref.datalen = witness->arr_len;
52912         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52913         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
52914         witness_ref.data_is_owned = true;
52915         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52916         *ret_copy = HTLCClaim_from_witness(witness_ref);
52917         int64_t ret_ref = tag_ptr(ret_copy, true);
52918         return ret_ref;
52919 }
52920
52921 int8_tArray  CS_LDK_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
52922         uint8_t commitment_seed_arr[32];
52923         CHECK(commitment_seed->arr_len == 32);
52924         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
52925         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52926         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52927         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
52928         return ret_arr;
52929 }
52930
52931 int8_tArray  CS_LDK_build_closing_transaction(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) {
52932         LDKCVec_u8Z to_holder_script_ref;
52933         to_holder_script_ref.datalen = to_holder_script->arr_len;
52934         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52935         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
52936         LDKCVec_u8Z to_counterparty_script_ref;
52937         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
52938         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52939         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
52940         LDKOutPoint funding_outpoint_conv;
52941         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52942         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52943         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52944         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52945         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);
52946         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52947         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52948         Transaction_free(ret_var);
52949         return ret_arr;
52950 }
52951
52952 void  CS_LDK_CounterpartyCommitmentSecrets_free(int64_t this_obj) {
52953         LDKCounterpartyCommitmentSecrets this_obj_conv;
52954         this_obj_conv.inner = untag_ptr(this_obj);
52955         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52957         CounterpartyCommitmentSecrets_free(this_obj_conv);
52958 }
52959
52960 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52961         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52962         int64_t ret_ref = 0;
52963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52965         return ret_ref;
52966 }
52967 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone_ptr(int64_t arg) {
52968         LDKCounterpartyCommitmentSecrets arg_conv;
52969         arg_conv.inner = untag_ptr(arg);
52970         arg_conv.is_owned = ptr_is_owned(arg);
52971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52972         arg_conv.is_owned = false;
52973         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52974         return ret_conv;
52975 }
52976
52977 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone(int64_t orig) {
52978         LDKCounterpartyCommitmentSecrets orig_conv;
52979         orig_conv.inner = untag_ptr(orig);
52980         orig_conv.is_owned = ptr_is_owned(orig);
52981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52982         orig_conv.is_owned = false;
52983         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52984         int64_t ret_ref = 0;
52985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52987         return ret_ref;
52988 }
52989
52990 int64_t  CS_LDK_CounterpartyCommitmentSecrets_new() {
52991         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52992         int64_t ret_ref = 0;
52993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52995         return ret_ref;
52996 }
52997
52998 int64_t  CS_LDK_CounterpartyCommitmentSecrets_get_min_seen_secret(int64_t this_arg) {
52999         LDKCounterpartyCommitmentSecrets this_arg_conv;
53000         this_arg_conv.inner = untag_ptr(this_arg);
53001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53003         this_arg_conv.is_owned = false;
53004         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
53005         return ret_conv;
53006 }
53007
53008 int64_t  CS_LDK_CounterpartyCommitmentSecrets_provide_secret(int64_t this_arg, int64_t idx, int8_tArray secret) {
53009         LDKCounterpartyCommitmentSecrets this_arg_conv;
53010         this_arg_conv.inner = untag_ptr(this_arg);
53011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53013         this_arg_conv.is_owned = false;
53014         LDKThirtyTwoBytes secret_ref;
53015         CHECK(secret->arr_len == 32);
53016         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
53017         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
53018         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
53019         return tag_ptr(ret_conv, true);
53020 }
53021
53022 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_get_secret(int64_t this_arg, int64_t idx) {
53023         LDKCounterpartyCommitmentSecrets this_arg_conv;
53024         this_arg_conv.inner = untag_ptr(this_arg);
53025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53027         this_arg_conv.is_owned = false;
53028         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53029         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
53030         return ret_arr;
53031 }
53032
53033 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_write(int64_t obj) {
53034         LDKCounterpartyCommitmentSecrets obj_conv;
53035         obj_conv.inner = untag_ptr(obj);
53036         obj_conv.is_owned = ptr_is_owned(obj);
53037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53038         obj_conv.is_owned = false;
53039         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
53040         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53041         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53042         CVec_u8Z_free(ret_var);
53043         return ret_arr;
53044 }
53045
53046 int64_t  CS_LDK_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
53047         LDKu8slice ser_ref;
53048         ser_ref.datalen = ser->arr_len;
53049         ser_ref.data = ser->elems;
53050         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
53051         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
53052         FREE(ser);
53053         return tag_ptr(ret_conv, true);
53054 }
53055
53056 int8_tArray  CS_LDK_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
53057         LDKPublicKey per_commitment_point_ref;
53058         CHECK(per_commitment_point->arr_len == 33);
53059         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53060         uint8_t base_secret_arr[32];
53061         CHECK(base_secret->arr_len == 32);
53062         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
53063         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
53064         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53065         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
53066         return ret_arr;
53067 }
53068
53069 int8_tArray  CS_LDK_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
53070         uint8_t per_commitment_secret_arr[32];
53071         CHECK(per_commitment_secret->arr_len == 32);
53072         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
53073         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
53074         uint8_t countersignatory_revocation_base_secret_arr[32];
53075         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
53076         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
53077         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
53078         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53079         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
53080         return ret_arr;
53081 }
53082
53083 void  CS_LDK_TxCreationKeys_free(int64_t this_obj) {
53084         LDKTxCreationKeys this_obj_conv;
53085         this_obj_conv.inner = untag_ptr(this_obj);
53086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53088         TxCreationKeys_free(this_obj_conv);
53089 }
53090
53091 int8_tArray  CS_LDK_TxCreationKeys_get_per_commitment_point(int64_t this_ptr) {
53092         LDKTxCreationKeys this_ptr_conv;
53093         this_ptr_conv.inner = untag_ptr(this_ptr);
53094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53096         this_ptr_conv.is_owned = false;
53097         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53098         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
53099         return ret_arr;
53100 }
53101
53102 void  CS_LDK_TxCreationKeys_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
53103         LDKTxCreationKeys this_ptr_conv;
53104         this_ptr_conv.inner = untag_ptr(this_ptr);
53105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53107         this_ptr_conv.is_owned = false;
53108         LDKPublicKey val_ref;
53109         CHECK(val->arr_len == 33);
53110         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
53111         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
53112 }
53113
53114 int64_t  CS_LDK_TxCreationKeys_get_revocation_key(int64_t this_ptr) {
53115         LDKTxCreationKeys this_ptr_conv;
53116         this_ptr_conv.inner = untag_ptr(this_ptr);
53117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53119         this_ptr_conv.is_owned = false;
53120         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
53121         int64_t ret_ref = 0;
53122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53124         return ret_ref;
53125 }
53126
53127 void  CS_LDK_TxCreationKeys_set_revocation_key(int64_t this_ptr, int64_t val) {
53128         LDKTxCreationKeys this_ptr_conv;
53129         this_ptr_conv.inner = untag_ptr(this_ptr);
53130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53132         this_ptr_conv.is_owned = false;
53133         LDKRevocationKey val_conv;
53134         val_conv.inner = untag_ptr(val);
53135         val_conv.is_owned = ptr_is_owned(val);
53136         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53137         val_conv = RevocationKey_clone(&val_conv);
53138         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
53139 }
53140
53141 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_htlc_key(int64_t this_ptr) {
53142         LDKTxCreationKeys this_ptr_conv;
53143         this_ptr_conv.inner = untag_ptr(this_ptr);
53144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53146         this_ptr_conv.is_owned = false;
53147         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
53148         int64_t ret_ref = 0;
53149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53151         return ret_ref;
53152 }
53153
53154 void  CS_LDK_TxCreationKeys_set_broadcaster_htlc_key(int64_t this_ptr, int64_t val) {
53155         LDKTxCreationKeys this_ptr_conv;
53156         this_ptr_conv.inner = untag_ptr(this_ptr);
53157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53159         this_ptr_conv.is_owned = false;
53160         LDKHtlcKey val_conv;
53161         val_conv.inner = untag_ptr(val);
53162         val_conv.is_owned = ptr_is_owned(val);
53163         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53164         val_conv = HtlcKey_clone(&val_conv);
53165         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
53166 }
53167
53168 int64_t  CS_LDK_TxCreationKeys_get_countersignatory_htlc_key(int64_t this_ptr) {
53169         LDKTxCreationKeys this_ptr_conv;
53170         this_ptr_conv.inner = untag_ptr(this_ptr);
53171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53173         this_ptr_conv.is_owned = false;
53174         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
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
53181 void  CS_LDK_TxCreationKeys_set_countersignatory_htlc_key(int64_t this_ptr, int64_t val) {
53182         LDKTxCreationKeys this_ptr_conv;
53183         this_ptr_conv.inner = untag_ptr(this_ptr);
53184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53186         this_ptr_conv.is_owned = false;
53187         LDKHtlcKey val_conv;
53188         val_conv.inner = untag_ptr(val);
53189         val_conv.is_owned = ptr_is_owned(val);
53190         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53191         val_conv = HtlcKey_clone(&val_conv);
53192         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
53193 }
53194
53195 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_delayed_payment_key(int64_t this_ptr) {
53196         LDKTxCreationKeys this_ptr_conv;
53197         this_ptr_conv.inner = untag_ptr(this_ptr);
53198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53200         this_ptr_conv.is_owned = false;
53201         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
53202         int64_t ret_ref = 0;
53203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53205         return ret_ref;
53206 }
53207
53208 void  CS_LDK_TxCreationKeys_set_broadcaster_delayed_payment_key(int64_t this_ptr, int64_t val) {
53209         LDKTxCreationKeys this_ptr_conv;
53210         this_ptr_conv.inner = untag_ptr(this_ptr);
53211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53213         this_ptr_conv.is_owned = false;
53214         LDKDelayedPaymentKey val_conv;
53215         val_conv.inner = untag_ptr(val);
53216         val_conv.is_owned = ptr_is_owned(val);
53217         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53218         val_conv = DelayedPaymentKey_clone(&val_conv);
53219         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
53220 }
53221
53222 int64_t  CS_LDK_TxCreationKeys_new(int8_tArray per_commitment_point_arg, int64_t revocation_key_arg, int64_t broadcaster_htlc_key_arg, int64_t countersignatory_htlc_key_arg, int64_t broadcaster_delayed_payment_key_arg) {
53223         LDKPublicKey per_commitment_point_arg_ref;
53224         CHECK(per_commitment_point_arg->arr_len == 33);
53225         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
53226         LDKRevocationKey revocation_key_arg_conv;
53227         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
53228         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
53229         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
53230         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
53231         LDKHtlcKey broadcaster_htlc_key_arg_conv;
53232         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
53233         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
53234         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
53235         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
53236         LDKHtlcKey countersignatory_htlc_key_arg_conv;
53237         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
53238         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
53239         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
53240         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
53241         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
53242         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
53243         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
53244         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
53245         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
53246         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
53247         int64_t ret_ref = 0;
53248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53250         return ret_ref;
53251 }
53252
53253 jboolean  CS_LDK_TxCreationKeys_eq(int64_t a, int64_t b) {
53254         LDKTxCreationKeys a_conv;
53255         a_conv.inner = untag_ptr(a);
53256         a_conv.is_owned = ptr_is_owned(a);
53257         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53258         a_conv.is_owned = false;
53259         LDKTxCreationKeys b_conv;
53260         b_conv.inner = untag_ptr(b);
53261         b_conv.is_owned = ptr_is_owned(b);
53262         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53263         b_conv.is_owned = false;
53264         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
53265         return ret_conv;
53266 }
53267
53268 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
53269         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
53270         int64_t ret_ref = 0;
53271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53273         return ret_ref;
53274 }
53275 int64_t  CS_LDK_TxCreationKeys_clone_ptr(int64_t arg) {
53276         LDKTxCreationKeys arg_conv;
53277         arg_conv.inner = untag_ptr(arg);
53278         arg_conv.is_owned = ptr_is_owned(arg);
53279         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53280         arg_conv.is_owned = false;
53281         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
53282         return ret_conv;
53283 }
53284
53285 int64_t  CS_LDK_TxCreationKeys_clone(int64_t orig) {
53286         LDKTxCreationKeys orig_conv;
53287         orig_conv.inner = untag_ptr(orig);
53288         orig_conv.is_owned = ptr_is_owned(orig);
53289         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53290         orig_conv.is_owned = false;
53291         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
53292         int64_t ret_ref = 0;
53293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53295         return ret_ref;
53296 }
53297
53298 int8_tArray  CS_LDK_TxCreationKeys_write(int64_t obj) {
53299         LDKTxCreationKeys obj_conv;
53300         obj_conv.inner = untag_ptr(obj);
53301         obj_conv.is_owned = ptr_is_owned(obj);
53302         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53303         obj_conv.is_owned = false;
53304         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
53305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53307         CVec_u8Z_free(ret_var);
53308         return ret_arr;
53309 }
53310
53311 int64_t  CS_LDK_TxCreationKeys_read(int8_tArray ser) {
53312         LDKu8slice ser_ref;
53313         ser_ref.datalen = ser->arr_len;
53314         ser_ref.data = ser->elems;
53315         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
53316         *ret_conv = TxCreationKeys_read(ser_ref);
53317         FREE(ser);
53318         return tag_ptr(ret_conv, true);
53319 }
53320
53321 void  CS_LDK_ChannelPublicKeys_free(int64_t this_obj) {
53322         LDKChannelPublicKeys this_obj_conv;
53323         this_obj_conv.inner = untag_ptr(this_obj);
53324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53326         ChannelPublicKeys_free(this_obj_conv);
53327 }
53328
53329 int8_tArray  CS_LDK_ChannelPublicKeys_get_funding_pubkey(int64_t this_ptr) {
53330         LDKChannelPublicKeys this_ptr_conv;
53331         this_ptr_conv.inner = untag_ptr(this_ptr);
53332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53334         this_ptr_conv.is_owned = false;
53335         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53336         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
53337         return ret_arr;
53338 }
53339
53340 void  CS_LDK_ChannelPublicKeys_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
53341         LDKChannelPublicKeys this_ptr_conv;
53342         this_ptr_conv.inner = untag_ptr(this_ptr);
53343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53345         this_ptr_conv.is_owned = false;
53346         LDKPublicKey val_ref;
53347         CHECK(val->arr_len == 33);
53348         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
53349         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
53350 }
53351
53352 int64_t  CS_LDK_ChannelPublicKeys_get_revocation_basepoint(int64_t this_ptr) {
53353         LDKChannelPublicKeys this_ptr_conv;
53354         this_ptr_conv.inner = untag_ptr(this_ptr);
53355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53357         this_ptr_conv.is_owned = false;
53358         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
53359         int64_t ret_ref = 0;
53360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53362         return ret_ref;
53363 }
53364
53365 void  CS_LDK_ChannelPublicKeys_set_revocation_basepoint(int64_t this_ptr, int64_t val) {
53366         LDKChannelPublicKeys this_ptr_conv;
53367         this_ptr_conv.inner = untag_ptr(this_ptr);
53368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53370         this_ptr_conv.is_owned = false;
53371         LDKRevocationBasepoint val_conv;
53372         val_conv.inner = untag_ptr(val);
53373         val_conv.is_owned = ptr_is_owned(val);
53374         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53375         val_conv = RevocationBasepoint_clone(&val_conv);
53376         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
53377 }
53378
53379 int8_tArray  CS_LDK_ChannelPublicKeys_get_payment_point(int64_t this_ptr) {
53380         LDKChannelPublicKeys this_ptr_conv;
53381         this_ptr_conv.inner = untag_ptr(this_ptr);
53382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53384         this_ptr_conv.is_owned = false;
53385         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53386         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
53387         return ret_arr;
53388 }
53389
53390 void  CS_LDK_ChannelPublicKeys_set_payment_point(int64_t this_ptr, int8_tArray val) {
53391         LDKChannelPublicKeys this_ptr_conv;
53392         this_ptr_conv.inner = untag_ptr(this_ptr);
53393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53395         this_ptr_conv.is_owned = false;
53396         LDKPublicKey val_ref;
53397         CHECK(val->arr_len == 33);
53398         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
53399         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
53400 }
53401
53402 int64_t  CS_LDK_ChannelPublicKeys_get_delayed_payment_basepoint(int64_t this_ptr) {
53403         LDKChannelPublicKeys this_ptr_conv;
53404         this_ptr_conv.inner = untag_ptr(this_ptr);
53405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53407         this_ptr_conv.is_owned = false;
53408         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
53409         int64_t ret_ref = 0;
53410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53412         return ret_ref;
53413 }
53414
53415 void  CS_LDK_ChannelPublicKeys_set_delayed_payment_basepoint(int64_t this_ptr, int64_t val) {
53416         LDKChannelPublicKeys this_ptr_conv;
53417         this_ptr_conv.inner = untag_ptr(this_ptr);
53418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53420         this_ptr_conv.is_owned = false;
53421         LDKDelayedPaymentBasepoint val_conv;
53422         val_conv.inner = untag_ptr(val);
53423         val_conv.is_owned = ptr_is_owned(val);
53424         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53425         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
53426         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
53427 }
53428
53429 int64_t  CS_LDK_ChannelPublicKeys_get_htlc_basepoint(int64_t this_ptr) {
53430         LDKChannelPublicKeys this_ptr_conv;
53431         this_ptr_conv.inner = untag_ptr(this_ptr);
53432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53434         this_ptr_conv.is_owned = false;
53435         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
53436         int64_t ret_ref = 0;
53437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53439         return ret_ref;
53440 }
53441
53442 void  CS_LDK_ChannelPublicKeys_set_htlc_basepoint(int64_t this_ptr, int64_t val) {
53443         LDKChannelPublicKeys this_ptr_conv;
53444         this_ptr_conv.inner = untag_ptr(this_ptr);
53445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53447         this_ptr_conv.is_owned = false;
53448         LDKHtlcBasepoint val_conv;
53449         val_conv.inner = untag_ptr(val);
53450         val_conv.is_owned = ptr_is_owned(val);
53451         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53452         val_conv = HtlcBasepoint_clone(&val_conv);
53453         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
53454 }
53455
53456 int64_t  CS_LDK_ChannelPublicKeys_new(int8_tArray funding_pubkey_arg, int64_t revocation_basepoint_arg, int8_tArray payment_point_arg, int64_t delayed_payment_basepoint_arg, int64_t htlc_basepoint_arg) {
53457         LDKPublicKey funding_pubkey_arg_ref;
53458         CHECK(funding_pubkey_arg->arr_len == 33);
53459         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
53460         LDKRevocationBasepoint revocation_basepoint_arg_conv;
53461         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
53462         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
53463         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
53464         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
53465         LDKPublicKey payment_point_arg_ref;
53466         CHECK(payment_point_arg->arr_len == 33);
53467         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
53468         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
53469         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
53470         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
53471         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
53472         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
53473         LDKHtlcBasepoint htlc_basepoint_arg_conv;
53474         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
53475         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
53476         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
53477         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
53478         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_conv, payment_point_arg_ref, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
53479         int64_t ret_ref = 0;
53480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53482         return ret_ref;
53483 }
53484
53485 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
53486         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
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 int64_t  CS_LDK_ChannelPublicKeys_clone_ptr(int64_t arg) {
53493         LDKChannelPublicKeys arg_conv;
53494         arg_conv.inner = untag_ptr(arg);
53495         arg_conv.is_owned = ptr_is_owned(arg);
53496         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53497         arg_conv.is_owned = false;
53498         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
53499         return ret_conv;
53500 }
53501
53502 int64_t  CS_LDK_ChannelPublicKeys_clone(int64_t orig) {
53503         LDKChannelPublicKeys orig_conv;
53504         orig_conv.inner = untag_ptr(orig);
53505         orig_conv.is_owned = ptr_is_owned(orig);
53506         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53507         orig_conv.is_owned = false;
53508         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
53509         int64_t ret_ref = 0;
53510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53512         return ret_ref;
53513 }
53514
53515 int64_t  CS_LDK_ChannelPublicKeys_hash(int64_t o) {
53516         LDKChannelPublicKeys o_conv;
53517         o_conv.inner = untag_ptr(o);
53518         o_conv.is_owned = ptr_is_owned(o);
53519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53520         o_conv.is_owned = false;
53521         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
53522         return ret_conv;
53523 }
53524
53525 jboolean  CS_LDK_ChannelPublicKeys_eq(int64_t a, int64_t b) {
53526         LDKChannelPublicKeys a_conv;
53527         a_conv.inner = untag_ptr(a);
53528         a_conv.is_owned = ptr_is_owned(a);
53529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53530         a_conv.is_owned = false;
53531         LDKChannelPublicKeys b_conv;
53532         b_conv.inner = untag_ptr(b);
53533         b_conv.is_owned = ptr_is_owned(b);
53534         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53535         b_conv.is_owned = false;
53536         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
53537         return ret_conv;
53538 }
53539
53540 int8_tArray  CS_LDK_ChannelPublicKeys_write(int64_t obj) {
53541         LDKChannelPublicKeys obj_conv;
53542         obj_conv.inner = untag_ptr(obj);
53543         obj_conv.is_owned = ptr_is_owned(obj);
53544         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53545         obj_conv.is_owned = false;
53546         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
53547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53549         CVec_u8Z_free(ret_var);
53550         return ret_arr;
53551 }
53552
53553 int64_t  CS_LDK_ChannelPublicKeys_read(int8_tArray ser) {
53554         LDKu8slice ser_ref;
53555         ser_ref.datalen = ser->arr_len;
53556         ser_ref.data = ser->elems;
53557         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
53558         *ret_conv = ChannelPublicKeys_read(ser_ref);
53559         FREE(ser);
53560         return tag_ptr(ret_conv, true);
53561 }
53562
53563 int64_t  CS_LDK_TxCreationKeys_derive_new(int8_tArray per_commitment_point, int64_t broadcaster_delayed_payment_base, int64_t broadcaster_htlc_base, int64_t countersignatory_revocation_base, int64_t countersignatory_htlc_base) {
53564         LDKPublicKey per_commitment_point_ref;
53565         CHECK(per_commitment_point->arr_len == 33);
53566         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53567         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
53568         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
53569         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
53570         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
53571         broadcaster_delayed_payment_base_conv.is_owned = false;
53572         LDKHtlcBasepoint broadcaster_htlc_base_conv;
53573         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
53574         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
53575         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
53576         broadcaster_htlc_base_conv.is_owned = false;
53577         LDKRevocationBasepoint countersignatory_revocation_base_conv;
53578         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
53579         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
53580         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
53581         countersignatory_revocation_base_conv.is_owned = false;
53582         LDKHtlcBasepoint countersignatory_htlc_base_conv;
53583         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
53584         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
53585         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
53586         countersignatory_htlc_base_conv.is_owned = false;
53587         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, &broadcaster_delayed_payment_base_conv, &broadcaster_htlc_base_conv, &countersignatory_revocation_base_conv, &countersignatory_htlc_base_conv);
53588         int64_t ret_ref = 0;
53589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53591         return ret_ref;
53592 }
53593
53594 int64_t  CS_LDK_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
53595         LDKPublicKey per_commitment_point_ref;
53596         CHECK(per_commitment_point->arr_len == 33);
53597         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53598         LDKChannelPublicKeys broadcaster_keys_conv;
53599         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
53600         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
53601         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
53602         broadcaster_keys_conv.is_owned = false;
53603         LDKChannelPublicKeys countersignatory_keys_conv;
53604         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
53605         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
53606         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
53607         countersignatory_keys_conv.is_owned = false;
53608         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
53609         int64_t ret_ref = 0;
53610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53612         return ret_ref;
53613 }
53614
53615 int8_tArray  CS_LDK_get_revokeable_redeemscript(int64_t revocation_key, int16_t contest_delay, int64_t broadcaster_delayed_payment_key) {
53616         LDKRevocationKey revocation_key_conv;
53617         revocation_key_conv.inner = untag_ptr(revocation_key);
53618         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53619         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53620         revocation_key_conv.is_owned = false;
53621         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53622         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53623         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53624         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53625         broadcaster_delayed_payment_key_conv.is_owned = false;
53626         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
53627         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53628         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53629         CVec_u8Z_free(ret_var);
53630         return ret_arr;
53631 }
53632
53633 int8_tArray  CS_LDK_get_counterparty_payment_script(int64_t channel_type_features, int8_tArray payment_key) {
53634         LDKChannelTypeFeatures channel_type_features_conv;
53635         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53636         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53637         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53638         channel_type_features_conv.is_owned = false;
53639         LDKPublicKey payment_key_ref;
53640         CHECK(payment_key->arr_len == 33);
53641         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
53642         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
53643         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53644         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53645         CVec_u8Z_free(ret_var);
53646         return ret_arr;
53647 }
53648
53649 void  CS_LDK_HTLCOutputInCommitment_free(int64_t this_obj) {
53650         LDKHTLCOutputInCommitment this_obj_conv;
53651         this_obj_conv.inner = untag_ptr(this_obj);
53652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53654         HTLCOutputInCommitment_free(this_obj_conv);
53655 }
53656
53657 jboolean  CS_LDK_HTLCOutputInCommitment_get_offered(int64_t this_ptr) {
53658         LDKHTLCOutputInCommitment this_ptr_conv;
53659         this_ptr_conv.inner = untag_ptr(this_ptr);
53660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53662         this_ptr_conv.is_owned = false;
53663         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
53664         return ret_conv;
53665 }
53666
53667 void  CS_LDK_HTLCOutputInCommitment_set_offered(int64_t this_ptr, jboolean val) {
53668         LDKHTLCOutputInCommitment this_ptr_conv;
53669         this_ptr_conv.inner = untag_ptr(this_ptr);
53670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53672         this_ptr_conv.is_owned = false;
53673         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
53674 }
53675
53676 int64_t  CS_LDK_HTLCOutputInCommitment_get_amount_msat(int64_t this_ptr) {
53677         LDKHTLCOutputInCommitment this_ptr_conv;
53678         this_ptr_conv.inner = untag_ptr(this_ptr);
53679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53681         this_ptr_conv.is_owned = false;
53682         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
53683         return ret_conv;
53684 }
53685
53686 void  CS_LDK_HTLCOutputInCommitment_set_amount_msat(int64_t this_ptr, int64_t val) {
53687         LDKHTLCOutputInCommitment this_ptr_conv;
53688         this_ptr_conv.inner = untag_ptr(this_ptr);
53689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53691         this_ptr_conv.is_owned = false;
53692         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
53693 }
53694
53695 int32_t  CS_LDK_HTLCOutputInCommitment_get_cltv_expiry(int64_t this_ptr) {
53696         LDKHTLCOutputInCommitment this_ptr_conv;
53697         this_ptr_conv.inner = untag_ptr(this_ptr);
53698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53700         this_ptr_conv.is_owned = false;
53701         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
53702         return ret_conv;
53703 }
53704
53705 void  CS_LDK_HTLCOutputInCommitment_set_cltv_expiry(int64_t this_ptr, int32_t val) {
53706         LDKHTLCOutputInCommitment this_ptr_conv;
53707         this_ptr_conv.inner = untag_ptr(this_ptr);
53708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53710         this_ptr_conv.is_owned = false;
53711         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
53712 }
53713
53714 int8_tArray  CS_LDK_HTLCOutputInCommitment_get_payment_hash(int64_t this_ptr) {
53715         LDKHTLCOutputInCommitment this_ptr_conv;
53716         this_ptr_conv.inner = untag_ptr(this_ptr);
53717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53719         this_ptr_conv.is_owned = false;
53720         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53721         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
53722         return ret_arr;
53723 }
53724
53725 void  CS_LDK_HTLCOutputInCommitment_set_payment_hash(int64_t this_ptr, int8_tArray val) {
53726         LDKHTLCOutputInCommitment this_ptr_conv;
53727         this_ptr_conv.inner = untag_ptr(this_ptr);
53728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53730         this_ptr_conv.is_owned = false;
53731         LDKThirtyTwoBytes val_ref;
53732         CHECK(val->arr_len == 32);
53733         memcpy(val_ref.data, val->elems, 32); FREE(val);
53734         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
53735 }
53736
53737 int64_t  CS_LDK_HTLCOutputInCommitment_get_transaction_output_index(int64_t this_ptr) {
53738         LDKHTLCOutputInCommitment this_ptr_conv;
53739         this_ptr_conv.inner = untag_ptr(this_ptr);
53740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53742         this_ptr_conv.is_owned = false;
53743         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53744         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
53745         int64_t ret_ref = tag_ptr(ret_copy, true);
53746         return ret_ref;
53747 }
53748
53749 void  CS_LDK_HTLCOutputInCommitment_set_transaction_output_index(int64_t this_ptr, int64_t val) {
53750         LDKHTLCOutputInCommitment this_ptr_conv;
53751         this_ptr_conv.inner = untag_ptr(this_ptr);
53752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53754         this_ptr_conv.is_owned = false;
53755         void* val_ptr = untag_ptr(val);
53756         CHECK_ACCESS(val_ptr);
53757         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
53758         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
53759         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
53760 }
53761
53762 int64_t  CS_LDK_HTLCOutputInCommitment_new(jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
53763         LDKThirtyTwoBytes payment_hash_arg_ref;
53764         CHECK(payment_hash_arg->arr_len == 32);
53765         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
53766         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
53767         CHECK_ACCESS(transaction_output_index_arg_ptr);
53768         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
53769         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
53770         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
53771         int64_t ret_ref = 0;
53772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53774         return ret_ref;
53775 }
53776
53777 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
53778         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
53779         int64_t ret_ref = 0;
53780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53782         return ret_ref;
53783 }
53784 int64_t  CS_LDK_HTLCOutputInCommitment_clone_ptr(int64_t arg) {
53785         LDKHTLCOutputInCommitment arg_conv;
53786         arg_conv.inner = untag_ptr(arg);
53787         arg_conv.is_owned = ptr_is_owned(arg);
53788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53789         arg_conv.is_owned = false;
53790         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
53791         return ret_conv;
53792 }
53793
53794 int64_t  CS_LDK_HTLCOutputInCommitment_clone(int64_t orig) {
53795         LDKHTLCOutputInCommitment orig_conv;
53796         orig_conv.inner = untag_ptr(orig);
53797         orig_conv.is_owned = ptr_is_owned(orig);
53798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53799         orig_conv.is_owned = false;
53800         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
53801         int64_t ret_ref = 0;
53802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53804         return ret_ref;
53805 }
53806
53807 jboolean  CS_LDK_HTLCOutputInCommitment_eq(int64_t a, int64_t b) {
53808         LDKHTLCOutputInCommitment a_conv;
53809         a_conv.inner = untag_ptr(a);
53810         a_conv.is_owned = ptr_is_owned(a);
53811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53812         a_conv.is_owned = false;
53813         LDKHTLCOutputInCommitment b_conv;
53814         b_conv.inner = untag_ptr(b);
53815         b_conv.is_owned = ptr_is_owned(b);
53816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53817         b_conv.is_owned = false;
53818         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
53819         return ret_conv;
53820 }
53821
53822 int8_tArray  CS_LDK_HTLCOutputInCommitment_write(int64_t obj) {
53823         LDKHTLCOutputInCommitment obj_conv;
53824         obj_conv.inner = untag_ptr(obj);
53825         obj_conv.is_owned = ptr_is_owned(obj);
53826         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53827         obj_conv.is_owned = false;
53828         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
53829         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53830         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53831         CVec_u8Z_free(ret_var);
53832         return ret_arr;
53833 }
53834
53835 int64_t  CS_LDK_HTLCOutputInCommitment_read(int8_tArray ser) {
53836         LDKu8slice ser_ref;
53837         ser_ref.datalen = ser->arr_len;
53838         ser_ref.data = ser->elems;
53839         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
53840         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
53841         FREE(ser);
53842         return tag_ptr(ret_conv, true);
53843 }
53844
53845 int8_tArray  CS_LDK_get_htlc_redeemscript(int64_t htlc, int64_t channel_type_features, int64_t keys) {
53846         LDKHTLCOutputInCommitment htlc_conv;
53847         htlc_conv.inner = untag_ptr(htlc);
53848         htlc_conv.is_owned = ptr_is_owned(htlc);
53849         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53850         htlc_conv.is_owned = false;
53851         LDKChannelTypeFeatures channel_type_features_conv;
53852         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53853         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53854         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53855         channel_type_features_conv.is_owned = false;
53856         LDKTxCreationKeys keys_conv;
53857         keys_conv.inner = untag_ptr(keys);
53858         keys_conv.is_owned = ptr_is_owned(keys);
53859         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53860         keys_conv.is_owned = false;
53861         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53862         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53863         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53864         CVec_u8Z_free(ret_var);
53865         return ret_arr;
53866 }
53867
53868 int8_tArray  CS_LDK_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
53869         LDKPublicKey broadcaster_ref;
53870         CHECK(broadcaster->arr_len == 33);
53871         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
53872         LDKPublicKey countersignatory_ref;
53873         CHECK(countersignatory->arr_len == 33);
53874         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
53875         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53878         CVec_u8Z_free(ret_var);
53879         return ret_arr;
53880 }
53881
53882 int8_tArray  CS_LDK_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int64_t channel_type_features, int64_t broadcaster_delayed_payment_key, int64_t revocation_key) {
53883         uint8_t commitment_txid_arr[32];
53884         CHECK(commitment_txid->arr_len == 32);
53885         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
53886         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53887         LDKHTLCOutputInCommitment htlc_conv;
53888         htlc_conv.inner = untag_ptr(htlc);
53889         htlc_conv.is_owned = ptr_is_owned(htlc);
53890         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53891         htlc_conv.is_owned = false;
53892         LDKChannelTypeFeatures channel_type_features_conv;
53893         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53894         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53895         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53896         channel_type_features_conv.is_owned = false;
53897         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53898         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53899         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53900         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53901         broadcaster_delayed_payment_key_conv.is_owned = false;
53902         LDKRevocationKey revocation_key_conv;
53903         revocation_key_conv.inner = untag_ptr(revocation_key);
53904         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53905         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53906         revocation_key_conv.is_owned = false;
53907         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, &broadcaster_delayed_payment_key_conv, &revocation_key_conv);
53908         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53909         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53910         Transaction_free(ret_var);
53911         return ret_arr;
53912 }
53913
53914 int8_tArray  CS_LDK_build_htlc_input_witness(int8_tArray local_sig, int8_tArray remote_sig, int64_t preimage, int8_tArray redeem_script, int64_t channel_type_features) {
53915         LDKECDSASignature local_sig_ref;
53916         CHECK(local_sig->arr_len == 64);
53917         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
53918         LDKECDSASignature remote_sig_ref;
53919         CHECK(remote_sig->arr_len == 64);
53920         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
53921         void* preimage_ptr = untag_ptr(preimage);
53922         CHECK_ACCESS(preimage_ptr);
53923         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53924         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53925         LDKu8slice redeem_script_ref;
53926         redeem_script_ref.datalen = redeem_script->arr_len;
53927         redeem_script_ref.data = redeem_script->elems;
53928         LDKChannelTypeFeatures channel_type_features_conv;
53929         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53930         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53931         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53932         channel_type_features_conv.is_owned = false;
53933         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53936         Witness_free(ret_var);
53937         FREE(redeem_script);
53938         return ret_arr;
53939 }
53940
53941 int8_tArray  CS_LDK_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
53942         LDKPublicKey payment_point_ref;
53943         CHECK(payment_point->arr_len == 33);
53944         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
53945         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53946         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53947         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53948         CVec_u8Z_free(ret_var);
53949         return ret_arr;
53950 }
53951
53952 int8_tArray  CS_LDK_get_anchor_redeemscript(int8_tArray funding_pubkey) {
53953         LDKPublicKey funding_pubkey_ref;
53954         CHECK(funding_pubkey->arr_len == 33);
53955         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
53956         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53957         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53958         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53959         CVec_u8Z_free(ret_var);
53960         return ret_arr;
53961 }
53962
53963 int8_tArray  CS_LDK_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
53964         LDKPublicKey funding_key_ref;
53965         CHECK(funding_key->arr_len == 33);
53966         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
53967         LDKECDSASignature funding_sig_ref;
53968         CHECK(funding_sig->arr_len == 64);
53969         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
53970         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53971         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53972         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53973         Witness_free(ret_var);
53974         return ret_arr;
53975 }
53976
53977 void  CS_LDK_ChannelTransactionParameters_free(int64_t this_obj) {
53978         LDKChannelTransactionParameters this_obj_conv;
53979         this_obj_conv.inner = untag_ptr(this_obj);
53980         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53982         ChannelTransactionParameters_free(this_obj_conv);
53983 }
53984
53985 int64_t  CS_LDK_ChannelTransactionParameters_get_holder_pubkeys(int64_t this_ptr) {
53986         LDKChannelTransactionParameters this_ptr_conv;
53987         this_ptr_conv.inner = untag_ptr(this_ptr);
53988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53990         this_ptr_conv.is_owned = false;
53991         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53992         int64_t ret_ref = 0;
53993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53995         return ret_ref;
53996 }
53997
53998 void  CS_LDK_ChannelTransactionParameters_set_holder_pubkeys(int64_t this_ptr, int64_t val) {
53999         LDKChannelTransactionParameters this_ptr_conv;
54000         this_ptr_conv.inner = untag_ptr(this_ptr);
54001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54003         this_ptr_conv.is_owned = false;
54004         LDKChannelPublicKeys val_conv;
54005         val_conv.inner = untag_ptr(val);
54006         val_conv.is_owned = ptr_is_owned(val);
54007         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54008         val_conv = ChannelPublicKeys_clone(&val_conv);
54009         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
54010 }
54011
54012 int16_t  CS_LDK_ChannelTransactionParameters_get_holder_selected_contest_delay(int64_t this_ptr) {
54013         LDKChannelTransactionParameters this_ptr_conv;
54014         this_ptr_conv.inner = untag_ptr(this_ptr);
54015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54017         this_ptr_conv.is_owned = false;
54018         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
54019         return ret_conv;
54020 }
54021
54022 void  CS_LDK_ChannelTransactionParameters_set_holder_selected_contest_delay(int64_t this_ptr, int16_t val) {
54023         LDKChannelTransactionParameters this_ptr_conv;
54024         this_ptr_conv.inner = untag_ptr(this_ptr);
54025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54027         this_ptr_conv.is_owned = false;
54028         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
54029 }
54030
54031 jboolean  CS_LDK_ChannelTransactionParameters_get_is_outbound_from_holder(int64_t this_ptr) {
54032         LDKChannelTransactionParameters this_ptr_conv;
54033         this_ptr_conv.inner = untag_ptr(this_ptr);
54034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54036         this_ptr_conv.is_owned = false;
54037         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
54038         return ret_conv;
54039 }
54040
54041 void  CS_LDK_ChannelTransactionParameters_set_is_outbound_from_holder(int64_t this_ptr, jboolean val) {
54042         LDKChannelTransactionParameters this_ptr_conv;
54043         this_ptr_conv.inner = untag_ptr(this_ptr);
54044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54046         this_ptr_conv.is_owned = false;
54047         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
54048 }
54049
54050 int64_t  CS_LDK_ChannelTransactionParameters_get_counterparty_parameters(int64_t this_ptr) {
54051         LDKChannelTransactionParameters this_ptr_conv;
54052         this_ptr_conv.inner = untag_ptr(this_ptr);
54053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54055         this_ptr_conv.is_owned = false;
54056         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
54057         int64_t ret_ref = 0;
54058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54060         return ret_ref;
54061 }
54062
54063 void  CS_LDK_ChannelTransactionParameters_set_counterparty_parameters(int64_t this_ptr, int64_t val) {
54064         LDKChannelTransactionParameters this_ptr_conv;
54065         this_ptr_conv.inner = untag_ptr(this_ptr);
54066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54068         this_ptr_conv.is_owned = false;
54069         LDKCounterpartyChannelTransactionParameters val_conv;
54070         val_conv.inner = untag_ptr(val);
54071         val_conv.is_owned = ptr_is_owned(val);
54072         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54073         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
54074         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
54075 }
54076
54077 int64_t  CS_LDK_ChannelTransactionParameters_get_funding_outpoint(int64_t this_ptr) {
54078         LDKChannelTransactionParameters this_ptr_conv;
54079         this_ptr_conv.inner = untag_ptr(this_ptr);
54080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54082         this_ptr_conv.is_owned = false;
54083         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
54084         int64_t ret_ref = 0;
54085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54087         return ret_ref;
54088 }
54089
54090 void  CS_LDK_ChannelTransactionParameters_set_funding_outpoint(int64_t this_ptr, int64_t val) {
54091         LDKChannelTransactionParameters this_ptr_conv;
54092         this_ptr_conv.inner = untag_ptr(this_ptr);
54093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54095         this_ptr_conv.is_owned = false;
54096         LDKOutPoint val_conv;
54097         val_conv.inner = untag_ptr(val);
54098         val_conv.is_owned = ptr_is_owned(val);
54099         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54100         val_conv = OutPoint_clone(&val_conv);
54101         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
54102 }
54103
54104 int64_t  CS_LDK_ChannelTransactionParameters_get_channel_type_features(int64_t this_ptr) {
54105         LDKChannelTransactionParameters this_ptr_conv;
54106         this_ptr_conv.inner = untag_ptr(this_ptr);
54107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54109         this_ptr_conv.is_owned = false;
54110         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
54111         int64_t ret_ref = 0;
54112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54114         return ret_ref;
54115 }
54116
54117 void  CS_LDK_ChannelTransactionParameters_set_channel_type_features(int64_t this_ptr, int64_t val) {
54118         LDKChannelTransactionParameters this_ptr_conv;
54119         this_ptr_conv.inner = untag_ptr(this_ptr);
54120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54122         this_ptr_conv.is_owned = false;
54123         LDKChannelTypeFeatures val_conv;
54124         val_conv.inner = untag_ptr(val);
54125         val_conv.is_owned = ptr_is_owned(val);
54126         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54127         val_conv = ChannelTypeFeatures_clone(&val_conv);
54128         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
54129 }
54130
54131 int64_t  CS_LDK_ChannelTransactionParameters_new(int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg, int64_t channel_type_features_arg) {
54132         LDKChannelPublicKeys holder_pubkeys_arg_conv;
54133         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
54134         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
54135         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
54136         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
54137         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
54138         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
54139         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
54140         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
54141         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
54142         LDKOutPoint funding_outpoint_arg_conv;
54143         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
54144         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
54145         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
54146         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
54147         LDKChannelTypeFeatures channel_type_features_arg_conv;
54148         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
54149         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
54150         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
54151         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
54152         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, channel_type_features_arg_conv);
54153         int64_t ret_ref = 0;
54154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54156         return ret_ref;
54157 }
54158
54159 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
54160         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
54161         int64_t ret_ref = 0;
54162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54164         return ret_ref;
54165 }
54166 int64_t  CS_LDK_ChannelTransactionParameters_clone_ptr(int64_t arg) {
54167         LDKChannelTransactionParameters arg_conv;
54168         arg_conv.inner = untag_ptr(arg);
54169         arg_conv.is_owned = ptr_is_owned(arg);
54170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54171         arg_conv.is_owned = false;
54172         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
54173         return ret_conv;
54174 }
54175
54176 int64_t  CS_LDK_ChannelTransactionParameters_clone(int64_t orig) {
54177         LDKChannelTransactionParameters orig_conv;
54178         orig_conv.inner = untag_ptr(orig);
54179         orig_conv.is_owned = ptr_is_owned(orig);
54180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54181         orig_conv.is_owned = false;
54182         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
54183         int64_t ret_ref = 0;
54184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54186         return ret_ref;
54187 }
54188
54189 int64_t  CS_LDK_ChannelTransactionParameters_hash(int64_t o) {
54190         LDKChannelTransactionParameters o_conv;
54191         o_conv.inner = untag_ptr(o);
54192         o_conv.is_owned = ptr_is_owned(o);
54193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54194         o_conv.is_owned = false;
54195         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
54196         return ret_conv;
54197 }
54198
54199 jboolean  CS_LDK_ChannelTransactionParameters_eq(int64_t a, int64_t b) {
54200         LDKChannelTransactionParameters a_conv;
54201         a_conv.inner = untag_ptr(a);
54202         a_conv.is_owned = ptr_is_owned(a);
54203         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54204         a_conv.is_owned = false;
54205         LDKChannelTransactionParameters b_conv;
54206         b_conv.inner = untag_ptr(b);
54207         b_conv.is_owned = ptr_is_owned(b);
54208         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54209         b_conv.is_owned = false;
54210         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
54211         return ret_conv;
54212 }
54213
54214 void  CS_LDK_CounterpartyChannelTransactionParameters_free(int64_t this_obj) {
54215         LDKCounterpartyChannelTransactionParameters this_obj_conv;
54216         this_obj_conv.inner = untag_ptr(this_obj);
54217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54219         CounterpartyChannelTransactionParameters_free(this_obj_conv);
54220 }
54221
54222 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_get_pubkeys(int64_t this_ptr) {
54223         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54224         this_ptr_conv.inner = untag_ptr(this_ptr);
54225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54227         this_ptr_conv.is_owned = false;
54228         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
54229         int64_t ret_ref = 0;
54230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54232         return ret_ref;
54233 }
54234
54235 void  CS_LDK_CounterpartyChannelTransactionParameters_set_pubkeys(int64_t this_ptr, int64_t val) {
54236         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54237         this_ptr_conv.inner = untag_ptr(this_ptr);
54238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54240         this_ptr_conv.is_owned = false;
54241         LDKChannelPublicKeys val_conv;
54242         val_conv.inner = untag_ptr(val);
54243         val_conv.is_owned = ptr_is_owned(val);
54244         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54245         val_conv = ChannelPublicKeys_clone(&val_conv);
54246         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
54247 }
54248
54249 int16_t  CS_LDK_CounterpartyChannelTransactionParameters_get_selected_contest_delay(int64_t this_ptr) {
54250         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54251         this_ptr_conv.inner = untag_ptr(this_ptr);
54252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54254         this_ptr_conv.is_owned = false;
54255         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
54256         return ret_conv;
54257 }
54258
54259 void  CS_LDK_CounterpartyChannelTransactionParameters_set_selected_contest_delay(int64_t this_ptr, int16_t val) {
54260         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54261         this_ptr_conv.inner = untag_ptr(this_ptr);
54262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54264         this_ptr_conv.is_owned = false;
54265         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
54266 }
54267
54268 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_new(int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
54269         LDKChannelPublicKeys pubkeys_arg_conv;
54270         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
54271         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
54272         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
54273         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
54274         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
54275         int64_t ret_ref = 0;
54276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54278         return ret_ref;
54279 }
54280
54281 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
54282         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
54283         int64_t ret_ref = 0;
54284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54286         return ret_ref;
54287 }
54288 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone_ptr(int64_t arg) {
54289         LDKCounterpartyChannelTransactionParameters arg_conv;
54290         arg_conv.inner = untag_ptr(arg);
54291         arg_conv.is_owned = ptr_is_owned(arg);
54292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54293         arg_conv.is_owned = false;
54294         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
54295         return ret_conv;
54296 }
54297
54298 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone(int64_t orig) {
54299         LDKCounterpartyChannelTransactionParameters orig_conv;
54300         orig_conv.inner = untag_ptr(orig);
54301         orig_conv.is_owned = ptr_is_owned(orig);
54302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54303         orig_conv.is_owned = false;
54304         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
54305         int64_t ret_ref = 0;
54306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54308         return ret_ref;
54309 }
54310
54311 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_hash(int64_t o) {
54312         LDKCounterpartyChannelTransactionParameters o_conv;
54313         o_conv.inner = untag_ptr(o);
54314         o_conv.is_owned = ptr_is_owned(o);
54315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54316         o_conv.is_owned = false;
54317         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
54318         return ret_conv;
54319 }
54320
54321 jboolean  CS_LDK_CounterpartyChannelTransactionParameters_eq(int64_t a, int64_t b) {
54322         LDKCounterpartyChannelTransactionParameters a_conv;
54323         a_conv.inner = untag_ptr(a);
54324         a_conv.is_owned = ptr_is_owned(a);
54325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54326         a_conv.is_owned = false;
54327         LDKCounterpartyChannelTransactionParameters b_conv;
54328         b_conv.inner = untag_ptr(b);
54329         b_conv.is_owned = ptr_is_owned(b);
54330         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54331         b_conv.is_owned = false;
54332         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
54333         return ret_conv;
54334 }
54335
54336 jboolean  CS_LDK_ChannelTransactionParameters_is_populated(int64_t this_arg) {
54337         LDKChannelTransactionParameters this_arg_conv;
54338         this_arg_conv.inner = untag_ptr(this_arg);
54339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54341         this_arg_conv.is_owned = false;
54342         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
54343         return ret_conv;
54344 }
54345
54346 int64_t  CS_LDK_ChannelTransactionParameters_as_holder_broadcastable(int64_t this_arg) {
54347         LDKChannelTransactionParameters this_arg_conv;
54348         this_arg_conv.inner = untag_ptr(this_arg);
54349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54351         this_arg_conv.is_owned = false;
54352         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
54353         int64_t ret_ref = 0;
54354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54356         return ret_ref;
54357 }
54358
54359 int64_t  CS_LDK_ChannelTransactionParameters_as_counterparty_broadcastable(int64_t this_arg) {
54360         LDKChannelTransactionParameters this_arg_conv;
54361         this_arg_conv.inner = untag_ptr(this_arg);
54362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54364         this_arg_conv.is_owned = false;
54365         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
54366         int64_t ret_ref = 0;
54367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54369         return ret_ref;
54370 }
54371
54372 int8_tArray  CS_LDK_CounterpartyChannelTransactionParameters_write(int64_t obj) {
54373         LDKCounterpartyChannelTransactionParameters obj_conv;
54374         obj_conv.inner = untag_ptr(obj);
54375         obj_conv.is_owned = ptr_is_owned(obj);
54376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54377         obj_conv.is_owned = false;
54378         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
54379         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54380         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54381         CVec_u8Z_free(ret_var);
54382         return ret_arr;
54383 }
54384
54385 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
54386         LDKu8slice ser_ref;
54387         ser_ref.datalen = ser->arr_len;
54388         ser_ref.data = ser->elems;
54389         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
54390         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
54391         FREE(ser);
54392         return tag_ptr(ret_conv, true);
54393 }
54394
54395 int8_tArray  CS_LDK_ChannelTransactionParameters_write(int64_t obj) {
54396         LDKChannelTransactionParameters obj_conv;
54397         obj_conv.inner = untag_ptr(obj);
54398         obj_conv.is_owned = ptr_is_owned(obj);
54399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54400         obj_conv.is_owned = false;
54401         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
54402         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54403         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54404         CVec_u8Z_free(ret_var);
54405         return ret_arr;
54406 }
54407
54408 int64_t  CS_LDK_ChannelTransactionParameters_read(int8_tArray ser) {
54409         LDKu8slice ser_ref;
54410         ser_ref.datalen = ser->arr_len;
54411         ser_ref.data = ser->elems;
54412         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
54413         *ret_conv = ChannelTransactionParameters_read(ser_ref);
54414         FREE(ser);
54415         return tag_ptr(ret_conv, true);
54416 }
54417
54418 void  CS_LDK_DirectedChannelTransactionParameters_free(int64_t this_obj) {
54419         LDKDirectedChannelTransactionParameters this_obj_conv;
54420         this_obj_conv.inner = untag_ptr(this_obj);
54421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54423         DirectedChannelTransactionParameters_free(this_obj_conv);
54424 }
54425
54426 int64_t  CS_LDK_DirectedChannelTransactionParameters_broadcaster_pubkeys(int64_t this_arg) {
54427         LDKDirectedChannelTransactionParameters this_arg_conv;
54428         this_arg_conv.inner = untag_ptr(this_arg);
54429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54431         this_arg_conv.is_owned = false;
54432         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
54433         int64_t ret_ref = 0;
54434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54436         return ret_ref;
54437 }
54438
54439 int64_t  CS_LDK_DirectedChannelTransactionParameters_countersignatory_pubkeys(int64_t this_arg) {
54440         LDKDirectedChannelTransactionParameters this_arg_conv;
54441         this_arg_conv.inner = untag_ptr(this_arg);
54442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54444         this_arg_conv.is_owned = false;
54445         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
54446         int64_t ret_ref = 0;
54447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54449         return ret_ref;
54450 }
54451
54452 int16_t  CS_LDK_DirectedChannelTransactionParameters_contest_delay(int64_t this_arg) {
54453         LDKDirectedChannelTransactionParameters this_arg_conv;
54454         this_arg_conv.inner = untag_ptr(this_arg);
54455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54457         this_arg_conv.is_owned = false;
54458         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
54459         return ret_conv;
54460 }
54461
54462 jboolean  CS_LDK_DirectedChannelTransactionParameters_is_outbound(int64_t this_arg) {
54463         LDKDirectedChannelTransactionParameters this_arg_conv;
54464         this_arg_conv.inner = untag_ptr(this_arg);
54465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54467         this_arg_conv.is_owned = false;
54468         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
54469         return ret_conv;
54470 }
54471
54472 int64_t  CS_LDK_DirectedChannelTransactionParameters_funding_outpoint(int64_t this_arg) {
54473         LDKDirectedChannelTransactionParameters this_arg_conv;
54474         this_arg_conv.inner = untag_ptr(this_arg);
54475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54477         this_arg_conv.is_owned = false;
54478         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
54479         int64_t ret_ref = 0;
54480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54482         return ret_ref;
54483 }
54484
54485 int64_t  CS_LDK_DirectedChannelTransactionParameters_channel_type_features(int64_t this_arg) {
54486         LDKDirectedChannelTransactionParameters this_arg_conv;
54487         this_arg_conv.inner = untag_ptr(this_arg);
54488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54490         this_arg_conv.is_owned = false;
54491         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
54492         int64_t ret_ref = 0;
54493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54495         return ret_ref;
54496 }
54497
54498 void  CS_LDK_HolderCommitmentTransaction_free(int64_t this_obj) {
54499         LDKHolderCommitmentTransaction this_obj_conv;
54500         this_obj_conv.inner = untag_ptr(this_obj);
54501         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54503         HolderCommitmentTransaction_free(this_obj_conv);
54504 }
54505
54506 int8_tArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_sig(int64_t this_ptr) {
54507         LDKHolderCommitmentTransaction this_ptr_conv;
54508         this_ptr_conv.inner = untag_ptr(this_ptr);
54509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54511         this_ptr_conv.is_owned = false;
54512         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54513         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
54514         return ret_arr;
54515 }
54516
54517 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
54518         LDKHolderCommitmentTransaction this_ptr_conv;
54519         this_ptr_conv.inner = untag_ptr(this_ptr);
54520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54522         this_ptr_conv.is_owned = false;
54523         LDKECDSASignature val_ref;
54524         CHECK(val->arr_len == 64);
54525         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54526         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
54527 }
54528
54529 ptrArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_htlc_sigs(int64_t this_ptr) {
54530         LDKHolderCommitmentTransaction this_ptr_conv;
54531         this_ptr_conv.inner = untag_ptr(this_ptr);
54532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54534         this_ptr_conv.is_owned = false;
54535         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
54536         ptrArray ret_arr = NULL;
54537         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54538         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54539         for (size_t i = 0; i < ret_var.datalen; i++) {
54540                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
54541                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
54542                 ret_arr_ptr[i] = ret_conv_8_arr;
54543         }
54544         
54545         FREE(ret_var.data);
54546         return ret_arr;
54547 }
54548
54549 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_htlc_sigs(int64_t this_ptr, ptrArray val) {
54550         LDKHolderCommitmentTransaction this_ptr_conv;
54551         this_ptr_conv.inner = untag_ptr(this_ptr);
54552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54554         this_ptr_conv.is_owned = false;
54555         LDKCVec_ECDSASignatureZ val_constr;
54556         val_constr.datalen = val->arr_len;
54557         if (val_constr.datalen > 0)
54558                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54559         else
54560                 val_constr.data = NULL;
54561         int8_tArray* val_vals = (void*) val->elems;
54562         for (size_t i = 0; i < val_constr.datalen; i++) {
54563                 int8_tArray val_conv_8 = val_vals[i];
54564                 LDKECDSASignature val_conv_8_ref;
54565                 CHECK(val_conv_8->arr_len == 64);
54566                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
54567                 val_constr.data[i] = val_conv_8_ref;
54568         }
54569         FREE(val);
54570         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
54571 }
54572
54573 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
54574         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
54575         int64_t ret_ref = 0;
54576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54578         return ret_ref;
54579 }
54580 int64_t  CS_LDK_HolderCommitmentTransaction_clone_ptr(int64_t arg) {
54581         LDKHolderCommitmentTransaction arg_conv;
54582         arg_conv.inner = untag_ptr(arg);
54583         arg_conv.is_owned = ptr_is_owned(arg);
54584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54585         arg_conv.is_owned = false;
54586         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
54587         return ret_conv;
54588 }
54589
54590 int64_t  CS_LDK_HolderCommitmentTransaction_clone(int64_t orig) {
54591         LDKHolderCommitmentTransaction orig_conv;
54592         orig_conv.inner = untag_ptr(orig);
54593         orig_conv.is_owned = ptr_is_owned(orig);
54594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54595         orig_conv.is_owned = false;
54596         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
54597         int64_t ret_ref = 0;
54598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54600         return ret_ref;
54601 }
54602
54603 int8_tArray  CS_LDK_HolderCommitmentTransaction_write(int64_t obj) {
54604         LDKHolderCommitmentTransaction obj_conv;
54605         obj_conv.inner = untag_ptr(obj);
54606         obj_conv.is_owned = ptr_is_owned(obj);
54607         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54608         obj_conv.is_owned = false;
54609         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
54610         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54611         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54612         CVec_u8Z_free(ret_var);
54613         return ret_arr;
54614 }
54615
54616 int64_t  CS_LDK_HolderCommitmentTransaction_read(int8_tArray ser) {
54617         LDKu8slice ser_ref;
54618         ser_ref.datalen = ser->arr_len;
54619         ser_ref.data = ser->elems;
54620         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
54621         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
54622         FREE(ser);
54623         return tag_ptr(ret_conv, true);
54624 }
54625
54626 int64_t  CS_LDK_HolderCommitmentTransaction_new(int64_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
54627         LDKCommitmentTransaction commitment_tx_conv;
54628         commitment_tx_conv.inner = untag_ptr(commitment_tx);
54629         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
54630         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
54631         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
54632         LDKECDSASignature counterparty_sig_ref;
54633         CHECK(counterparty_sig->arr_len == 64);
54634         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
54635         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
54636         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
54637         if (counterparty_htlc_sigs_constr.datalen > 0)
54638                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54639         else
54640                 counterparty_htlc_sigs_constr.data = NULL;
54641         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
54642         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
54643                 int8_tArray counterparty_htlc_sigs_conv_8 = counterparty_htlc_sigs_vals[i];
54644                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
54645                 CHECK(counterparty_htlc_sigs_conv_8->arr_len == 64);
54646                 memcpy(counterparty_htlc_sigs_conv_8_ref.compact_form, counterparty_htlc_sigs_conv_8->elems, 64); FREE(counterparty_htlc_sigs_conv_8);
54647                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
54648         }
54649         FREE(counterparty_htlc_sigs);
54650         LDKPublicKey holder_funding_key_ref;
54651         CHECK(holder_funding_key->arr_len == 33);
54652         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
54653         LDKPublicKey counterparty_funding_key_ref;
54654         CHECK(counterparty_funding_key->arr_len == 33);
54655         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
54656         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
54657         int64_t ret_ref = 0;
54658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54660         return ret_ref;
54661 }
54662
54663 void  CS_LDK_BuiltCommitmentTransaction_free(int64_t this_obj) {
54664         LDKBuiltCommitmentTransaction this_obj_conv;
54665         this_obj_conv.inner = untag_ptr(this_obj);
54666         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54668         BuiltCommitmentTransaction_free(this_obj_conv);
54669 }
54670
54671 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_transaction(int64_t this_ptr) {
54672         LDKBuiltCommitmentTransaction this_ptr_conv;
54673         this_ptr_conv.inner = untag_ptr(this_ptr);
54674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54676         this_ptr_conv.is_owned = false;
54677         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
54678         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54679         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54680         Transaction_free(ret_var);
54681         return ret_arr;
54682 }
54683
54684 void  CS_LDK_BuiltCommitmentTransaction_set_transaction(int64_t this_ptr, int8_tArray val) {
54685         LDKBuiltCommitmentTransaction this_ptr_conv;
54686         this_ptr_conv.inner = untag_ptr(this_ptr);
54687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54689         this_ptr_conv.is_owned = false;
54690         LDKTransaction val_ref;
54691         val_ref.datalen = val->arr_len;
54692         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
54693         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54694         val_ref.data_is_owned = true;
54695         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
54696 }
54697
54698 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_txid(int64_t this_ptr) {
54699         LDKBuiltCommitmentTransaction this_ptr_conv;
54700         this_ptr_conv.inner = untag_ptr(this_ptr);
54701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54703         this_ptr_conv.is_owned = false;
54704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54705         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
54706         return ret_arr;
54707 }
54708
54709 void  CS_LDK_BuiltCommitmentTransaction_set_txid(int64_t this_ptr, int8_tArray val) {
54710         LDKBuiltCommitmentTransaction this_ptr_conv;
54711         this_ptr_conv.inner = untag_ptr(this_ptr);
54712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54714         this_ptr_conv.is_owned = false;
54715         LDKThirtyTwoBytes val_ref;
54716         CHECK(val->arr_len == 32);
54717         memcpy(val_ref.data, val->elems, 32); FREE(val);
54718         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
54719 }
54720
54721 int64_t  CS_LDK_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
54722         LDKTransaction transaction_arg_ref;
54723         transaction_arg_ref.datalen = transaction_arg->arr_len;
54724         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
54725         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
54726         transaction_arg_ref.data_is_owned = true;
54727         LDKThirtyTwoBytes txid_arg_ref;
54728         CHECK(txid_arg->arr_len == 32);
54729         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
54730         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
54731         int64_t ret_ref = 0;
54732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54734         return ret_ref;
54735 }
54736
54737 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
54738         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
54739         int64_t ret_ref = 0;
54740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54742         return ret_ref;
54743 }
54744 int64_t  CS_LDK_BuiltCommitmentTransaction_clone_ptr(int64_t arg) {
54745         LDKBuiltCommitmentTransaction arg_conv;
54746         arg_conv.inner = untag_ptr(arg);
54747         arg_conv.is_owned = ptr_is_owned(arg);
54748         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54749         arg_conv.is_owned = false;
54750         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
54751         return ret_conv;
54752 }
54753
54754 int64_t  CS_LDK_BuiltCommitmentTransaction_clone(int64_t orig) {
54755         LDKBuiltCommitmentTransaction orig_conv;
54756         orig_conv.inner = untag_ptr(orig);
54757         orig_conv.is_owned = ptr_is_owned(orig);
54758         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54759         orig_conv.is_owned = false;
54760         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
54761         int64_t ret_ref = 0;
54762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54764         return ret_ref;
54765 }
54766
54767 int8_tArray  CS_LDK_BuiltCommitmentTransaction_write(int64_t obj) {
54768         LDKBuiltCommitmentTransaction obj_conv;
54769         obj_conv.inner = untag_ptr(obj);
54770         obj_conv.is_owned = ptr_is_owned(obj);
54771         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54772         obj_conv.is_owned = false;
54773         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
54774         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54775         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54776         CVec_u8Z_free(ret_var);
54777         return ret_arr;
54778 }
54779
54780 int64_t  CS_LDK_BuiltCommitmentTransaction_read(int8_tArray ser) {
54781         LDKu8slice ser_ref;
54782         ser_ref.datalen = ser->arr_len;
54783         ser_ref.data = ser->elems;
54784         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
54785         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
54786         FREE(ser);
54787         return tag_ptr(ret_conv, true);
54788 }
54789
54790 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
54791         LDKBuiltCommitmentTransaction this_arg_conv;
54792         this_arg_conv.inner = untag_ptr(this_arg);
54793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54795         this_arg_conv.is_owned = false;
54796         LDKu8slice funding_redeemscript_ref;
54797         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54798         funding_redeemscript_ref.data = funding_redeemscript->elems;
54799         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54800         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
54801         FREE(funding_redeemscript);
54802         return ret_arr;
54803 }
54804
54805 int8_tArray  CS_LDK_BuiltCommitmentTransaction_sign_counterparty_commitment(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
54806         LDKBuiltCommitmentTransaction this_arg_conv;
54807         this_arg_conv.inner = untag_ptr(this_arg);
54808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54810         this_arg_conv.is_owned = false;
54811         uint8_t funding_key_arr[32];
54812         CHECK(funding_key->arr_len == 32);
54813         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54814         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54815         LDKu8slice funding_redeemscript_ref;
54816         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54817         funding_redeemscript_ref.data = funding_redeemscript->elems;
54818         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54819         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
54820         FREE(funding_redeemscript);
54821         return ret_arr;
54822 }
54823
54824 int8_tArray  CS_LDK_BuiltCommitmentTransaction_sign_holder_commitment(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis, int64_t entropy_source) {
54825         LDKBuiltCommitmentTransaction this_arg_conv;
54826         this_arg_conv.inner = untag_ptr(this_arg);
54827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54829         this_arg_conv.is_owned = false;
54830         uint8_t funding_key_arr[32];
54831         CHECK(funding_key->arr_len == 32);
54832         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54833         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54834         LDKu8slice funding_redeemscript_ref;
54835         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54836         funding_redeemscript_ref.data = funding_redeemscript->elems;
54837         void* entropy_source_ptr = untag_ptr(entropy_source);
54838         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54839         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54840         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54841         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_holder_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis, entropy_source_conv).compact_form, 64);
54842         FREE(funding_redeemscript);
54843         return ret_arr;
54844 }
54845
54846 void  CS_LDK_ClosingTransaction_free(int64_t this_obj) {
54847         LDKClosingTransaction this_obj_conv;
54848         this_obj_conv.inner = untag_ptr(this_obj);
54849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54851         ClosingTransaction_free(this_obj_conv);
54852 }
54853
54854 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
54855         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
54856         int64_t ret_ref = 0;
54857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54859         return ret_ref;
54860 }
54861 int64_t  CS_LDK_ClosingTransaction_clone_ptr(int64_t arg) {
54862         LDKClosingTransaction arg_conv;
54863         arg_conv.inner = untag_ptr(arg);
54864         arg_conv.is_owned = ptr_is_owned(arg);
54865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54866         arg_conv.is_owned = false;
54867         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54868         return ret_conv;
54869 }
54870
54871 int64_t  CS_LDK_ClosingTransaction_clone(int64_t orig) {
54872         LDKClosingTransaction orig_conv;
54873         orig_conv.inner = untag_ptr(orig);
54874         orig_conv.is_owned = ptr_is_owned(orig);
54875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54876         orig_conv.is_owned = false;
54877         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
54878         int64_t ret_ref = 0;
54879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54881         return ret_ref;
54882 }
54883
54884 int64_t  CS_LDK_ClosingTransaction_hash(int64_t o) {
54885         LDKClosingTransaction o_conv;
54886         o_conv.inner = untag_ptr(o);
54887         o_conv.is_owned = ptr_is_owned(o);
54888         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54889         o_conv.is_owned = false;
54890         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54891         return ret_conv;
54892 }
54893
54894 jboolean  CS_LDK_ClosingTransaction_eq(int64_t a, int64_t b) {
54895         LDKClosingTransaction a_conv;
54896         a_conv.inner = untag_ptr(a);
54897         a_conv.is_owned = ptr_is_owned(a);
54898         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54899         a_conv.is_owned = false;
54900         LDKClosingTransaction b_conv;
54901         b_conv.inner = untag_ptr(b);
54902         b_conv.is_owned = ptr_is_owned(b);
54903         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54904         b_conv.is_owned = false;
54905         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54906         return ret_conv;
54907 }
54908
54909 int64_t  CS_LDK_ClosingTransaction_new(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) {
54910         LDKCVec_u8Z to_holder_script_ref;
54911         to_holder_script_ref.datalen = to_holder_script->arr_len;
54912         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54913         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
54914         LDKCVec_u8Z to_counterparty_script_ref;
54915         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
54916         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54917         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
54918         LDKOutPoint funding_outpoint_conv;
54919         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54920         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54921         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54922         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54923         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54924         int64_t ret_ref = 0;
54925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54927         return ret_ref;
54928 }
54929
54930 int64_t  CS_LDK_ClosingTransaction_trust(int64_t this_arg) {
54931         LDKClosingTransaction this_arg_conv;
54932         this_arg_conv.inner = untag_ptr(this_arg);
54933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54935         this_arg_conv.is_owned = false;
54936         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54937         int64_t ret_ref = 0;
54938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54940         return ret_ref;
54941 }
54942
54943 int64_t  CS_LDK_ClosingTransaction_verify(int64_t this_arg, int64_t funding_outpoint) {
54944         LDKClosingTransaction this_arg_conv;
54945         this_arg_conv.inner = untag_ptr(this_arg);
54946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54948         this_arg_conv.is_owned = false;
54949         LDKOutPoint funding_outpoint_conv;
54950         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54951         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54952         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54953         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54954         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54955         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54956         return tag_ptr(ret_conv, true);
54957 }
54958
54959 int64_t  CS_LDK_ClosingTransaction_to_holder_value_sat(int64_t this_arg) {
54960         LDKClosingTransaction this_arg_conv;
54961         this_arg_conv.inner = untag_ptr(this_arg);
54962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54964         this_arg_conv.is_owned = false;
54965         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54966         return ret_conv;
54967 }
54968
54969 int64_t  CS_LDK_ClosingTransaction_to_counterparty_value_sat(int64_t this_arg) {
54970         LDKClosingTransaction this_arg_conv;
54971         this_arg_conv.inner = untag_ptr(this_arg);
54972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54974         this_arg_conv.is_owned = false;
54975         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54976         return ret_conv;
54977 }
54978
54979 int8_tArray  CS_LDK_ClosingTransaction_to_holder_script(int64_t this_arg) {
54980         LDKClosingTransaction this_arg_conv;
54981         this_arg_conv.inner = untag_ptr(this_arg);
54982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54984         this_arg_conv.is_owned = false;
54985         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54986         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54987         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54988         return ret_arr;
54989 }
54990
54991 int8_tArray  CS_LDK_ClosingTransaction_to_counterparty_script(int64_t this_arg) {
54992         LDKClosingTransaction this_arg_conv;
54993         this_arg_conv.inner = untag_ptr(this_arg);
54994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54996         this_arg_conv.is_owned = false;
54997         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54998         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54999         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55000         return ret_arr;
55001 }
55002
55003 void  CS_LDK_TrustedClosingTransaction_free(int64_t this_obj) {
55004         LDKTrustedClosingTransaction this_obj_conv;
55005         this_obj_conv.inner = untag_ptr(this_obj);
55006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55008         TrustedClosingTransaction_free(this_obj_conv);
55009 }
55010
55011 int8_tArray  CS_LDK_TrustedClosingTransaction_built_transaction(int64_t this_arg) {
55012         LDKTrustedClosingTransaction this_arg_conv;
55013         this_arg_conv.inner = untag_ptr(this_arg);
55014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55016         this_arg_conv.is_owned = false;
55017         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
55018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55020         Transaction_free(ret_var);
55021         return ret_arr;
55022 }
55023
55024 int8_tArray  CS_LDK_TrustedClosingTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
55025         LDKTrustedClosingTransaction this_arg_conv;
55026         this_arg_conv.inner = untag_ptr(this_arg);
55027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55029         this_arg_conv.is_owned = false;
55030         LDKu8slice funding_redeemscript_ref;
55031         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
55032         funding_redeemscript_ref.data = funding_redeemscript->elems;
55033         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55034         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
55035         FREE(funding_redeemscript);
55036         return ret_arr;
55037 }
55038
55039 int8_tArray  CS_LDK_TrustedClosingTransaction_sign(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
55040         LDKTrustedClosingTransaction this_arg_conv;
55041         this_arg_conv.inner = untag_ptr(this_arg);
55042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55044         this_arg_conv.is_owned = false;
55045         uint8_t funding_key_arr[32];
55046         CHECK(funding_key->arr_len == 32);
55047         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
55048         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
55049         LDKu8slice funding_redeemscript_ref;
55050         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
55051         funding_redeemscript_ref.data = funding_redeemscript->elems;
55052         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
55053         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
55054         FREE(funding_redeemscript);
55055         return ret_arr;
55056 }
55057
55058 void  CS_LDK_CommitmentTransaction_free(int64_t this_obj) {
55059         LDKCommitmentTransaction this_obj_conv;
55060         this_obj_conv.inner = untag_ptr(this_obj);
55061         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55063         CommitmentTransaction_free(this_obj_conv);
55064 }
55065
55066 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
55067         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
55068         int64_t ret_ref = 0;
55069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55071         return ret_ref;
55072 }
55073 int64_t  CS_LDK_CommitmentTransaction_clone_ptr(int64_t arg) {
55074         LDKCommitmentTransaction arg_conv;
55075         arg_conv.inner = untag_ptr(arg);
55076         arg_conv.is_owned = ptr_is_owned(arg);
55077         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55078         arg_conv.is_owned = false;
55079         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
55080         return ret_conv;
55081 }
55082
55083 int64_t  CS_LDK_CommitmentTransaction_clone(int64_t orig) {
55084         LDKCommitmentTransaction orig_conv;
55085         orig_conv.inner = untag_ptr(orig);
55086         orig_conv.is_owned = ptr_is_owned(orig);
55087         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55088         orig_conv.is_owned = false;
55089         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
55090         int64_t ret_ref = 0;
55091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55093         return ret_ref;
55094 }
55095
55096 int8_tArray  CS_LDK_CommitmentTransaction_write(int64_t obj) {
55097         LDKCommitmentTransaction obj_conv;
55098         obj_conv.inner = untag_ptr(obj);
55099         obj_conv.is_owned = ptr_is_owned(obj);
55100         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55101         obj_conv.is_owned = false;
55102         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
55103         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55104         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55105         CVec_u8Z_free(ret_var);
55106         return ret_arr;
55107 }
55108
55109 int64_t  CS_LDK_CommitmentTransaction_read(int8_tArray ser) {
55110         LDKu8slice ser_ref;
55111         ser_ref.datalen = ser->arr_len;
55112         ser_ref.data = ser->elems;
55113         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
55114         *ret_conv = CommitmentTransaction_read(ser_ref);
55115         FREE(ser);
55116         return tag_ptr(ret_conv, true);
55117 }
55118
55119 int64_t  CS_LDK_CommitmentTransaction_commitment_number(int64_t this_arg) {
55120         LDKCommitmentTransaction this_arg_conv;
55121         this_arg_conv.inner = untag_ptr(this_arg);
55122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55124         this_arg_conv.is_owned = false;
55125         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
55126         return ret_conv;
55127 }
55128
55129 int8_tArray  CS_LDK_CommitmentTransaction_per_commitment_point(int64_t this_arg) {
55130         LDKCommitmentTransaction this_arg_conv;
55131         this_arg_conv.inner = untag_ptr(this_arg);
55132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55134         this_arg_conv.is_owned = false;
55135         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55136         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
55137         return ret_arr;
55138 }
55139
55140 int64_t  CS_LDK_CommitmentTransaction_to_broadcaster_value_sat(int64_t this_arg) {
55141         LDKCommitmentTransaction this_arg_conv;
55142         this_arg_conv.inner = untag_ptr(this_arg);
55143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55145         this_arg_conv.is_owned = false;
55146         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
55147         return ret_conv;
55148 }
55149
55150 int64_t  CS_LDK_CommitmentTransaction_to_countersignatory_value_sat(int64_t this_arg) {
55151         LDKCommitmentTransaction this_arg_conv;
55152         this_arg_conv.inner = untag_ptr(this_arg);
55153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55155         this_arg_conv.is_owned = false;
55156         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
55157         return ret_conv;
55158 }
55159
55160 int32_t  CS_LDK_CommitmentTransaction_feerate_per_kw(int64_t this_arg) {
55161         LDKCommitmentTransaction this_arg_conv;
55162         this_arg_conv.inner = untag_ptr(this_arg);
55163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55165         this_arg_conv.is_owned = false;
55166         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
55167         return ret_conv;
55168 }
55169
55170 int64_t  CS_LDK_CommitmentTransaction_trust(int64_t this_arg) {
55171         LDKCommitmentTransaction this_arg_conv;
55172         this_arg_conv.inner = untag_ptr(this_arg);
55173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55175         this_arg_conv.is_owned = false;
55176         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
55177         int64_t ret_ref = 0;
55178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55180         return ret_ref;
55181 }
55182
55183 int64_t  CS_LDK_CommitmentTransaction_verify(int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
55184         LDKCommitmentTransaction this_arg_conv;
55185         this_arg_conv.inner = untag_ptr(this_arg);
55186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55188         this_arg_conv.is_owned = false;
55189         LDKDirectedChannelTransactionParameters channel_parameters_conv;
55190         channel_parameters_conv.inner = untag_ptr(channel_parameters);
55191         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
55192         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
55193         channel_parameters_conv.is_owned = false;
55194         LDKChannelPublicKeys broadcaster_keys_conv;
55195         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
55196         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
55197         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
55198         broadcaster_keys_conv.is_owned = false;
55199         LDKChannelPublicKeys countersignatory_keys_conv;
55200         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
55201         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
55202         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
55203         countersignatory_keys_conv.is_owned = false;
55204         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
55205         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
55206         return tag_ptr(ret_conv, true);
55207 }
55208
55209 void  CS_LDK_TrustedCommitmentTransaction_free(int64_t this_obj) {
55210         LDKTrustedCommitmentTransaction this_obj_conv;
55211         this_obj_conv.inner = untag_ptr(this_obj);
55212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55214         TrustedCommitmentTransaction_free(this_obj_conv);
55215 }
55216
55217 int8_tArray  CS_LDK_TrustedCommitmentTransaction_txid(int64_t this_arg) {
55218         LDKTrustedCommitmentTransaction this_arg_conv;
55219         this_arg_conv.inner = untag_ptr(this_arg);
55220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55222         this_arg_conv.is_owned = false;
55223         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55224         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
55225         return ret_arr;
55226 }
55227
55228 int64_t  CS_LDK_TrustedCommitmentTransaction_built_transaction(int64_t this_arg) {
55229         LDKTrustedCommitmentTransaction this_arg_conv;
55230         this_arg_conv.inner = untag_ptr(this_arg);
55231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55233         this_arg_conv.is_owned = false;
55234         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
55235         int64_t ret_ref = 0;
55236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55238         return ret_ref;
55239 }
55240
55241 int64_t  CS_LDK_TrustedCommitmentTransaction_keys(int64_t this_arg) {
55242         LDKTrustedCommitmentTransaction this_arg_conv;
55243         this_arg_conv.inner = untag_ptr(this_arg);
55244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55246         this_arg_conv.is_owned = false;
55247         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
55248         int64_t ret_ref = 0;
55249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55251         return ret_ref;
55252 }
55253
55254 int64_t  CS_LDK_TrustedCommitmentTransaction_channel_type_features(int64_t this_arg) {
55255         LDKTrustedCommitmentTransaction this_arg_conv;
55256         this_arg_conv.inner = untag_ptr(this_arg);
55257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55259         this_arg_conv.is_owned = false;
55260         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
55261         int64_t ret_ref = 0;
55262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55264         return ret_ref;
55265 }
55266
55267 int64_t  CS_LDK_TrustedCommitmentTransaction_get_htlc_sigs(int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters, int64_t entropy_source) {
55268         LDKTrustedCommitmentTransaction this_arg_conv;
55269         this_arg_conv.inner = untag_ptr(this_arg);
55270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55272         this_arg_conv.is_owned = false;
55273         uint8_t htlc_base_key_arr[32];
55274         CHECK(htlc_base_key->arr_len == 32);
55275         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
55276         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
55277         LDKDirectedChannelTransactionParameters channel_parameters_conv;
55278         channel_parameters_conv.inner = untag_ptr(channel_parameters);
55279         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
55280         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
55281         channel_parameters_conv.is_owned = false;
55282         void* entropy_source_ptr = untag_ptr(entropy_source);
55283         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
55284         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
55285         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
55286         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
55287         return tag_ptr(ret_conv, true);
55288 }
55289
55290 int64_t  CS_LDK_TrustedCommitmentTransaction_revokeable_output_index(int64_t this_arg) {
55291         LDKTrustedCommitmentTransaction this_arg_conv;
55292         this_arg_conv.inner = untag_ptr(this_arg);
55293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55295         this_arg_conv.is_owned = false;
55296         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
55297         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
55298         int64_t ret_ref = tag_ptr(ret_copy, true);
55299         return ret_ref;
55300 }
55301
55302 int64_t  CS_LDK_TrustedCommitmentTransaction_build_to_local_justice_tx(int64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
55303         LDKTrustedCommitmentTransaction this_arg_conv;
55304         this_arg_conv.inner = untag_ptr(this_arg);
55305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55307         this_arg_conv.is_owned = false;
55308         LDKCVec_u8Z destination_script_ref;
55309         destination_script_ref.datalen = destination_script->arr_len;
55310         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
55311         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
55312         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
55313         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
55314         return tag_ptr(ret_conv, true);
55315 }
55316
55317 int64_t  CS_LDK_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
55318         LDKPublicKey broadcaster_payment_basepoint_ref;
55319         CHECK(broadcaster_payment_basepoint->arr_len == 33);
55320         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
55321         LDKPublicKey countersignatory_payment_basepoint_ref;
55322         CHECK(countersignatory_payment_basepoint->arr_len == 33);
55323         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
55324         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
55325         return ret_conv;
55326 }
55327
55328 jboolean  CS_LDK_InitFeatures_eq(int64_t a, int64_t b) {
55329         LDKInitFeatures a_conv;
55330         a_conv.inner = untag_ptr(a);
55331         a_conv.is_owned = ptr_is_owned(a);
55332         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55333         a_conv.is_owned = false;
55334         LDKInitFeatures b_conv;
55335         b_conv.inner = untag_ptr(b);
55336         b_conv.is_owned = ptr_is_owned(b);
55337         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55338         b_conv.is_owned = false;
55339         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
55340         return ret_conv;
55341 }
55342
55343 jboolean  CS_LDK_NodeFeatures_eq(int64_t a, int64_t b) {
55344         LDKNodeFeatures a_conv;
55345         a_conv.inner = untag_ptr(a);
55346         a_conv.is_owned = ptr_is_owned(a);
55347         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55348         a_conv.is_owned = false;
55349         LDKNodeFeatures b_conv;
55350         b_conv.inner = untag_ptr(b);
55351         b_conv.is_owned = ptr_is_owned(b);
55352         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55353         b_conv.is_owned = false;
55354         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
55355         return ret_conv;
55356 }
55357
55358 jboolean  CS_LDK_ChannelFeatures_eq(int64_t a, int64_t b) {
55359         LDKChannelFeatures a_conv;
55360         a_conv.inner = untag_ptr(a);
55361         a_conv.is_owned = ptr_is_owned(a);
55362         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55363         a_conv.is_owned = false;
55364         LDKChannelFeatures b_conv;
55365         b_conv.inner = untag_ptr(b);
55366         b_conv.is_owned = ptr_is_owned(b);
55367         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55368         b_conv.is_owned = false;
55369         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
55370         return ret_conv;
55371 }
55372
55373 jboolean  CS_LDK_Bolt11InvoiceFeatures_eq(int64_t a, int64_t b) {
55374         LDKBolt11InvoiceFeatures a_conv;
55375         a_conv.inner = untag_ptr(a);
55376         a_conv.is_owned = ptr_is_owned(a);
55377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55378         a_conv.is_owned = false;
55379         LDKBolt11InvoiceFeatures b_conv;
55380         b_conv.inner = untag_ptr(b);
55381         b_conv.is_owned = ptr_is_owned(b);
55382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55383         b_conv.is_owned = false;
55384         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
55385         return ret_conv;
55386 }
55387
55388 jboolean  CS_LDK_OfferFeatures_eq(int64_t a, int64_t b) {
55389         LDKOfferFeatures a_conv;
55390         a_conv.inner = untag_ptr(a);
55391         a_conv.is_owned = ptr_is_owned(a);
55392         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55393         a_conv.is_owned = false;
55394         LDKOfferFeatures b_conv;
55395         b_conv.inner = untag_ptr(b);
55396         b_conv.is_owned = ptr_is_owned(b);
55397         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55398         b_conv.is_owned = false;
55399         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
55400         return ret_conv;
55401 }
55402
55403 jboolean  CS_LDK_InvoiceRequestFeatures_eq(int64_t a, int64_t b) {
55404         LDKInvoiceRequestFeatures a_conv;
55405         a_conv.inner = untag_ptr(a);
55406         a_conv.is_owned = ptr_is_owned(a);
55407         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55408         a_conv.is_owned = false;
55409         LDKInvoiceRequestFeatures b_conv;
55410         b_conv.inner = untag_ptr(b);
55411         b_conv.is_owned = ptr_is_owned(b);
55412         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55413         b_conv.is_owned = false;
55414         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
55415         return ret_conv;
55416 }
55417
55418 jboolean  CS_LDK_Bolt12InvoiceFeatures_eq(int64_t a, int64_t b) {
55419         LDKBolt12InvoiceFeatures a_conv;
55420         a_conv.inner = untag_ptr(a);
55421         a_conv.is_owned = ptr_is_owned(a);
55422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55423         a_conv.is_owned = false;
55424         LDKBolt12InvoiceFeatures b_conv;
55425         b_conv.inner = untag_ptr(b);
55426         b_conv.is_owned = ptr_is_owned(b);
55427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55428         b_conv.is_owned = false;
55429         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
55430         return ret_conv;
55431 }
55432
55433 jboolean  CS_LDK_BlindedHopFeatures_eq(int64_t a, int64_t b) {
55434         LDKBlindedHopFeatures a_conv;
55435         a_conv.inner = untag_ptr(a);
55436         a_conv.is_owned = ptr_is_owned(a);
55437         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55438         a_conv.is_owned = false;
55439         LDKBlindedHopFeatures b_conv;
55440         b_conv.inner = untag_ptr(b);
55441         b_conv.is_owned = ptr_is_owned(b);
55442         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55443         b_conv.is_owned = false;
55444         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
55445         return ret_conv;
55446 }
55447
55448 jboolean  CS_LDK_ChannelTypeFeatures_eq(int64_t a, int64_t b) {
55449         LDKChannelTypeFeatures a_conv;
55450         a_conv.inner = untag_ptr(a);
55451         a_conv.is_owned = ptr_is_owned(a);
55452         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55453         a_conv.is_owned = false;
55454         LDKChannelTypeFeatures b_conv;
55455         b_conv.inner = untag_ptr(b);
55456         b_conv.is_owned = ptr_is_owned(b);
55457         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55458         b_conv.is_owned = false;
55459         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
55460         return ret_conv;
55461 }
55462
55463 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
55464         LDKInitFeatures ret_var = InitFeatures_clone(arg);
55465         int64_t ret_ref = 0;
55466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55468         return ret_ref;
55469 }
55470 int64_t  CS_LDK_InitFeatures_clone_ptr(int64_t arg) {
55471         LDKInitFeatures arg_conv;
55472         arg_conv.inner = untag_ptr(arg);
55473         arg_conv.is_owned = ptr_is_owned(arg);
55474         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55475         arg_conv.is_owned = false;
55476         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
55477         return ret_conv;
55478 }
55479
55480 int64_t  CS_LDK_InitFeatures_clone(int64_t orig) {
55481         LDKInitFeatures orig_conv;
55482         orig_conv.inner = untag_ptr(orig);
55483         orig_conv.is_owned = ptr_is_owned(orig);
55484         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55485         orig_conv.is_owned = false;
55486         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
55487         int64_t ret_ref = 0;
55488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55490         return ret_ref;
55491 }
55492
55493 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
55494         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
55495         int64_t ret_ref = 0;
55496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55498         return ret_ref;
55499 }
55500 int64_t  CS_LDK_NodeFeatures_clone_ptr(int64_t arg) {
55501         LDKNodeFeatures arg_conv;
55502         arg_conv.inner = untag_ptr(arg);
55503         arg_conv.is_owned = ptr_is_owned(arg);
55504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55505         arg_conv.is_owned = false;
55506         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
55507         return ret_conv;
55508 }
55509
55510 int64_t  CS_LDK_NodeFeatures_clone(int64_t orig) {
55511         LDKNodeFeatures orig_conv;
55512         orig_conv.inner = untag_ptr(orig);
55513         orig_conv.is_owned = ptr_is_owned(orig);
55514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55515         orig_conv.is_owned = false;
55516         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
55517         int64_t ret_ref = 0;
55518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55520         return ret_ref;
55521 }
55522
55523 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
55524         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
55525         int64_t ret_ref = 0;
55526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55528         return ret_ref;
55529 }
55530 int64_t  CS_LDK_ChannelFeatures_clone_ptr(int64_t arg) {
55531         LDKChannelFeatures arg_conv;
55532         arg_conv.inner = untag_ptr(arg);
55533         arg_conv.is_owned = ptr_is_owned(arg);
55534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55535         arg_conv.is_owned = false;
55536         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
55537         return ret_conv;
55538 }
55539
55540 int64_t  CS_LDK_ChannelFeatures_clone(int64_t orig) {
55541         LDKChannelFeatures orig_conv;
55542         orig_conv.inner = untag_ptr(orig);
55543         orig_conv.is_owned = ptr_is_owned(orig);
55544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55545         orig_conv.is_owned = false;
55546         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
55547         int64_t ret_ref = 0;
55548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55550         return ret_ref;
55551 }
55552
55553 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
55554         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
55555         int64_t ret_ref = 0;
55556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55558         return ret_ref;
55559 }
55560 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone_ptr(int64_t arg) {
55561         LDKBolt11InvoiceFeatures arg_conv;
55562         arg_conv.inner = untag_ptr(arg);
55563         arg_conv.is_owned = ptr_is_owned(arg);
55564         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55565         arg_conv.is_owned = false;
55566         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
55567         return ret_conv;
55568 }
55569
55570 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone(int64_t orig) {
55571         LDKBolt11InvoiceFeatures orig_conv;
55572         orig_conv.inner = untag_ptr(orig);
55573         orig_conv.is_owned = ptr_is_owned(orig);
55574         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55575         orig_conv.is_owned = false;
55576         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
55577         int64_t ret_ref = 0;
55578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55580         return ret_ref;
55581 }
55582
55583 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
55584         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
55585         int64_t ret_ref = 0;
55586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55588         return ret_ref;
55589 }
55590 int64_t  CS_LDK_OfferFeatures_clone_ptr(int64_t arg) {
55591         LDKOfferFeatures arg_conv;
55592         arg_conv.inner = untag_ptr(arg);
55593         arg_conv.is_owned = ptr_is_owned(arg);
55594         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55595         arg_conv.is_owned = false;
55596         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
55597         return ret_conv;
55598 }
55599
55600 int64_t  CS_LDK_OfferFeatures_clone(int64_t orig) {
55601         LDKOfferFeatures orig_conv;
55602         orig_conv.inner = untag_ptr(orig);
55603         orig_conv.is_owned = ptr_is_owned(orig);
55604         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55605         orig_conv.is_owned = false;
55606         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
55607         int64_t ret_ref = 0;
55608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55610         return ret_ref;
55611 }
55612
55613 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
55614         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
55615         int64_t ret_ref = 0;
55616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55618         return ret_ref;
55619 }
55620 int64_t  CS_LDK_InvoiceRequestFeatures_clone_ptr(int64_t arg) {
55621         LDKInvoiceRequestFeatures arg_conv;
55622         arg_conv.inner = untag_ptr(arg);
55623         arg_conv.is_owned = ptr_is_owned(arg);
55624         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55625         arg_conv.is_owned = false;
55626         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
55627         return ret_conv;
55628 }
55629
55630 int64_t  CS_LDK_InvoiceRequestFeatures_clone(int64_t orig) {
55631         LDKInvoiceRequestFeatures orig_conv;
55632         orig_conv.inner = untag_ptr(orig);
55633         orig_conv.is_owned = ptr_is_owned(orig);
55634         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55635         orig_conv.is_owned = false;
55636         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
55637         int64_t ret_ref = 0;
55638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55640         return ret_ref;
55641 }
55642
55643 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
55644         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
55645         int64_t ret_ref = 0;
55646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55648         return ret_ref;
55649 }
55650 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone_ptr(int64_t arg) {
55651         LDKBolt12InvoiceFeatures arg_conv;
55652         arg_conv.inner = untag_ptr(arg);
55653         arg_conv.is_owned = ptr_is_owned(arg);
55654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55655         arg_conv.is_owned = false;
55656         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
55657         return ret_conv;
55658 }
55659
55660 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone(int64_t orig) {
55661         LDKBolt12InvoiceFeatures orig_conv;
55662         orig_conv.inner = untag_ptr(orig);
55663         orig_conv.is_owned = ptr_is_owned(orig);
55664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55665         orig_conv.is_owned = false;
55666         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
55667         int64_t ret_ref = 0;
55668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55670         return ret_ref;
55671 }
55672
55673 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
55674         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
55675         int64_t ret_ref = 0;
55676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55678         return ret_ref;
55679 }
55680 int64_t  CS_LDK_BlindedHopFeatures_clone_ptr(int64_t arg) {
55681         LDKBlindedHopFeatures arg_conv;
55682         arg_conv.inner = untag_ptr(arg);
55683         arg_conv.is_owned = ptr_is_owned(arg);
55684         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55685         arg_conv.is_owned = false;
55686         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
55687         return ret_conv;
55688 }
55689
55690 int64_t  CS_LDK_BlindedHopFeatures_clone(int64_t orig) {
55691         LDKBlindedHopFeatures orig_conv;
55692         orig_conv.inner = untag_ptr(orig);
55693         orig_conv.is_owned = ptr_is_owned(orig);
55694         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55695         orig_conv.is_owned = false;
55696         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
55697         int64_t ret_ref = 0;
55698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55700         return ret_ref;
55701 }
55702
55703 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
55704         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
55705         int64_t ret_ref = 0;
55706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55708         return ret_ref;
55709 }
55710 int64_t  CS_LDK_ChannelTypeFeatures_clone_ptr(int64_t arg) {
55711         LDKChannelTypeFeatures arg_conv;
55712         arg_conv.inner = untag_ptr(arg);
55713         arg_conv.is_owned = ptr_is_owned(arg);
55714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55715         arg_conv.is_owned = false;
55716         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
55717         return ret_conv;
55718 }
55719
55720 int64_t  CS_LDK_ChannelTypeFeatures_clone(int64_t orig) {
55721         LDKChannelTypeFeatures orig_conv;
55722         orig_conv.inner = untag_ptr(orig);
55723         orig_conv.is_owned = ptr_is_owned(orig);
55724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55725         orig_conv.is_owned = false;
55726         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
55727         int64_t ret_ref = 0;
55728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55730         return ret_ref;
55731 }
55732
55733 int64_t  CS_LDK_InitFeatures_hash(int64_t o) {
55734         LDKInitFeatures o_conv;
55735         o_conv.inner = untag_ptr(o);
55736         o_conv.is_owned = ptr_is_owned(o);
55737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55738         o_conv.is_owned = false;
55739         int64_t ret_conv = InitFeatures_hash(&o_conv);
55740         return ret_conv;
55741 }
55742
55743 int64_t  CS_LDK_NodeFeatures_hash(int64_t o) {
55744         LDKNodeFeatures o_conv;
55745         o_conv.inner = untag_ptr(o);
55746         o_conv.is_owned = ptr_is_owned(o);
55747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55748         o_conv.is_owned = false;
55749         int64_t ret_conv = NodeFeatures_hash(&o_conv);
55750         return ret_conv;
55751 }
55752
55753 int64_t  CS_LDK_ChannelFeatures_hash(int64_t o) {
55754         LDKChannelFeatures o_conv;
55755         o_conv.inner = untag_ptr(o);
55756         o_conv.is_owned = ptr_is_owned(o);
55757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55758         o_conv.is_owned = false;
55759         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
55760         return ret_conv;
55761 }
55762
55763 int64_t  CS_LDK_Bolt11InvoiceFeatures_hash(int64_t o) {
55764         LDKBolt11InvoiceFeatures o_conv;
55765         o_conv.inner = untag_ptr(o);
55766         o_conv.is_owned = ptr_is_owned(o);
55767         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55768         o_conv.is_owned = false;
55769         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
55770         return ret_conv;
55771 }
55772
55773 int64_t  CS_LDK_OfferFeatures_hash(int64_t o) {
55774         LDKOfferFeatures o_conv;
55775         o_conv.inner = untag_ptr(o);
55776         o_conv.is_owned = ptr_is_owned(o);
55777         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55778         o_conv.is_owned = false;
55779         int64_t ret_conv = OfferFeatures_hash(&o_conv);
55780         return ret_conv;
55781 }
55782
55783 int64_t  CS_LDK_InvoiceRequestFeatures_hash(int64_t o) {
55784         LDKInvoiceRequestFeatures o_conv;
55785         o_conv.inner = untag_ptr(o);
55786         o_conv.is_owned = ptr_is_owned(o);
55787         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55788         o_conv.is_owned = false;
55789         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
55790         return ret_conv;
55791 }
55792
55793 int64_t  CS_LDK_Bolt12InvoiceFeatures_hash(int64_t o) {
55794         LDKBolt12InvoiceFeatures o_conv;
55795         o_conv.inner = untag_ptr(o);
55796         o_conv.is_owned = ptr_is_owned(o);
55797         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55798         o_conv.is_owned = false;
55799         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
55800         return ret_conv;
55801 }
55802
55803 int64_t  CS_LDK_BlindedHopFeatures_hash(int64_t o) {
55804         LDKBlindedHopFeatures o_conv;
55805         o_conv.inner = untag_ptr(o);
55806         o_conv.is_owned = ptr_is_owned(o);
55807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55808         o_conv.is_owned = false;
55809         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
55810         return ret_conv;
55811 }
55812
55813 int64_t  CS_LDK_ChannelTypeFeatures_hash(int64_t o) {
55814         LDKChannelTypeFeatures o_conv;
55815         o_conv.inner = untag_ptr(o);
55816         o_conv.is_owned = ptr_is_owned(o);
55817         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55818         o_conv.is_owned = false;
55819         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
55820         return ret_conv;
55821 }
55822
55823 void  CS_LDK_InitFeatures_free(int64_t this_obj) {
55824         LDKInitFeatures this_obj_conv;
55825         this_obj_conv.inner = untag_ptr(this_obj);
55826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55828         InitFeatures_free(this_obj_conv);
55829 }
55830
55831 void  CS_LDK_NodeFeatures_free(int64_t this_obj) {
55832         LDKNodeFeatures this_obj_conv;
55833         this_obj_conv.inner = untag_ptr(this_obj);
55834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55836         NodeFeatures_free(this_obj_conv);
55837 }
55838
55839 void  CS_LDK_ChannelFeatures_free(int64_t this_obj) {
55840         LDKChannelFeatures this_obj_conv;
55841         this_obj_conv.inner = untag_ptr(this_obj);
55842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55844         ChannelFeatures_free(this_obj_conv);
55845 }
55846
55847 void  CS_LDK_Bolt11InvoiceFeatures_free(int64_t this_obj) {
55848         LDKBolt11InvoiceFeatures this_obj_conv;
55849         this_obj_conv.inner = untag_ptr(this_obj);
55850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55852         Bolt11InvoiceFeatures_free(this_obj_conv);
55853 }
55854
55855 void  CS_LDK_OfferFeatures_free(int64_t this_obj) {
55856         LDKOfferFeatures this_obj_conv;
55857         this_obj_conv.inner = untag_ptr(this_obj);
55858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55860         OfferFeatures_free(this_obj_conv);
55861 }
55862
55863 void  CS_LDK_InvoiceRequestFeatures_free(int64_t this_obj) {
55864         LDKInvoiceRequestFeatures this_obj_conv;
55865         this_obj_conv.inner = untag_ptr(this_obj);
55866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55868         InvoiceRequestFeatures_free(this_obj_conv);
55869 }
55870
55871 void  CS_LDK_Bolt12InvoiceFeatures_free(int64_t this_obj) {
55872         LDKBolt12InvoiceFeatures this_obj_conv;
55873         this_obj_conv.inner = untag_ptr(this_obj);
55874         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55876         Bolt12InvoiceFeatures_free(this_obj_conv);
55877 }
55878
55879 void  CS_LDK_BlindedHopFeatures_free(int64_t this_obj) {
55880         LDKBlindedHopFeatures this_obj_conv;
55881         this_obj_conv.inner = untag_ptr(this_obj);
55882         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55884         BlindedHopFeatures_free(this_obj_conv);
55885 }
55886
55887 void  CS_LDK_ChannelTypeFeatures_free(int64_t this_obj) {
55888         LDKChannelTypeFeatures this_obj_conv;
55889         this_obj_conv.inner = untag_ptr(this_obj);
55890         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55892         ChannelTypeFeatures_free(this_obj_conv);
55893 }
55894
55895 int64_t  CS_LDK_InitFeatures_empty() {
55896         LDKInitFeatures ret_var = InitFeatures_empty();
55897         int64_t ret_ref = 0;
55898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55900         return ret_ref;
55901 }
55902
55903 jboolean  CS_LDK_InitFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
55904         LDKInitFeatures this_arg_conv;
55905         this_arg_conv.inner = untag_ptr(this_arg);
55906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55908         this_arg_conv.is_owned = false;
55909         LDKInitFeatures other_conv;
55910         other_conv.inner = untag_ptr(other);
55911         other_conv.is_owned = ptr_is_owned(other);
55912         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55913         other_conv.is_owned = false;
55914         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55915         return ret_conv;
55916 }
55917
55918 jboolean  CS_LDK_InitFeatures_requires_unknown_bits(int64_t this_arg) {
55919         LDKInitFeatures this_arg_conv;
55920         this_arg_conv.inner = untag_ptr(this_arg);
55921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55923         this_arg_conv.is_owned = false;
55924         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
55925         return ret_conv;
55926 }
55927
55928 int64_t  CS_LDK_InitFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
55929         LDKInitFeatures this_arg_conv;
55930         this_arg_conv.inner = untag_ptr(this_arg);
55931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55933         this_arg_conv.is_owned = false;
55934         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55935         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
55936         return tag_ptr(ret_conv, true);
55937 }
55938
55939 int64_t  CS_LDK_InitFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
55940         LDKInitFeatures this_arg_conv;
55941         this_arg_conv.inner = untag_ptr(this_arg);
55942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55944         this_arg_conv.is_owned = false;
55945         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55946         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55947         return tag_ptr(ret_conv, true);
55948 }
55949
55950 int64_t  CS_LDK_InitFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
55951         LDKInitFeatures this_arg_conv;
55952         this_arg_conv.inner = untag_ptr(this_arg);
55953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55955         this_arg_conv.is_owned = false;
55956         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55957         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55958         return tag_ptr(ret_conv, true);
55959 }
55960
55961 int64_t  CS_LDK_InitFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
55962         LDKInitFeatures this_arg_conv;
55963         this_arg_conv.inner = untag_ptr(this_arg);
55964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55966         this_arg_conv.is_owned = false;
55967         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55968         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55969         return tag_ptr(ret_conv, true);
55970 }
55971
55972 int64_t  CS_LDK_NodeFeatures_empty() {
55973         LDKNodeFeatures ret_var = NodeFeatures_empty();
55974         int64_t ret_ref = 0;
55975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55977         return ret_ref;
55978 }
55979
55980 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
55981         LDKNodeFeatures this_arg_conv;
55982         this_arg_conv.inner = untag_ptr(this_arg);
55983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55985         this_arg_conv.is_owned = false;
55986         LDKNodeFeatures other_conv;
55987         other_conv.inner = untag_ptr(other);
55988         other_conv.is_owned = ptr_is_owned(other);
55989         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55990         other_conv.is_owned = false;
55991         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55992         return ret_conv;
55993 }
55994
55995 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits(int64_t this_arg) {
55996         LDKNodeFeatures this_arg_conv;
55997         this_arg_conv.inner = untag_ptr(this_arg);
55998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56000         this_arg_conv.is_owned = false;
56001         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
56002         return ret_conv;
56003 }
56004
56005 int64_t  CS_LDK_NodeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56006         LDKNodeFeatures this_arg_conv;
56007         this_arg_conv.inner = untag_ptr(this_arg);
56008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56010         this_arg_conv.is_owned = false;
56011         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56012         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56013         return tag_ptr(ret_conv, true);
56014 }
56015
56016 int64_t  CS_LDK_NodeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56017         LDKNodeFeatures this_arg_conv;
56018         this_arg_conv.inner = untag_ptr(this_arg);
56019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56021         this_arg_conv.is_owned = false;
56022         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56023         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56024         return tag_ptr(ret_conv, true);
56025 }
56026
56027 int64_t  CS_LDK_NodeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56028         LDKNodeFeatures this_arg_conv;
56029         this_arg_conv.inner = untag_ptr(this_arg);
56030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56032         this_arg_conv.is_owned = false;
56033         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56034         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56035         return tag_ptr(ret_conv, true);
56036 }
56037
56038 int64_t  CS_LDK_NodeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56039         LDKNodeFeatures this_arg_conv;
56040         this_arg_conv.inner = untag_ptr(this_arg);
56041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56043         this_arg_conv.is_owned = false;
56044         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56045         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56046         return tag_ptr(ret_conv, true);
56047 }
56048
56049 int64_t  CS_LDK_ChannelFeatures_empty() {
56050         LDKChannelFeatures ret_var = ChannelFeatures_empty();
56051         int64_t ret_ref = 0;
56052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56054         return ret_ref;
56055 }
56056
56057 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56058         LDKChannelFeatures this_arg_conv;
56059         this_arg_conv.inner = untag_ptr(this_arg);
56060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56062         this_arg_conv.is_owned = false;
56063         LDKChannelFeatures other_conv;
56064         other_conv.inner = untag_ptr(other);
56065         other_conv.is_owned = ptr_is_owned(other);
56066         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56067         other_conv.is_owned = false;
56068         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56069         return ret_conv;
56070 }
56071
56072 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits(int64_t this_arg) {
56073         LDKChannelFeatures this_arg_conv;
56074         this_arg_conv.inner = untag_ptr(this_arg);
56075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56077         this_arg_conv.is_owned = false;
56078         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
56079         return ret_conv;
56080 }
56081
56082 int64_t  CS_LDK_ChannelFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56083         LDKChannelFeatures this_arg_conv;
56084         this_arg_conv.inner = untag_ptr(this_arg);
56085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56087         this_arg_conv.is_owned = false;
56088         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56089         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
56090         return tag_ptr(ret_conv, true);
56091 }
56092
56093 int64_t  CS_LDK_ChannelFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56094         LDKChannelFeatures this_arg_conv;
56095         this_arg_conv.inner = untag_ptr(this_arg);
56096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56098         this_arg_conv.is_owned = false;
56099         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56100         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56101         return tag_ptr(ret_conv, true);
56102 }
56103
56104 int64_t  CS_LDK_ChannelFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56105         LDKChannelFeatures this_arg_conv;
56106         this_arg_conv.inner = untag_ptr(this_arg);
56107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56109         this_arg_conv.is_owned = false;
56110         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56111         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
56112         return tag_ptr(ret_conv, true);
56113 }
56114
56115 int64_t  CS_LDK_ChannelFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56116         LDKChannelFeatures this_arg_conv;
56117         this_arg_conv.inner = untag_ptr(this_arg);
56118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56120         this_arg_conv.is_owned = false;
56121         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56122         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56123         return tag_ptr(ret_conv, true);
56124 }
56125
56126 int64_t  CS_LDK_Bolt11InvoiceFeatures_empty() {
56127         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
56128         int64_t ret_ref = 0;
56129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56131         return ret_ref;
56132 }
56133
56134 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56135         LDKBolt11InvoiceFeatures this_arg_conv;
56136         this_arg_conv.inner = untag_ptr(this_arg);
56137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56139         this_arg_conv.is_owned = false;
56140         LDKBolt11InvoiceFeatures other_conv;
56141         other_conv.inner = untag_ptr(other);
56142         other_conv.is_owned = ptr_is_owned(other);
56143         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56144         other_conv.is_owned = false;
56145         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56146         return ret_conv;
56147 }
56148
56149 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
56150         LDKBolt11InvoiceFeatures this_arg_conv;
56151         this_arg_conv.inner = untag_ptr(this_arg);
56152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56154         this_arg_conv.is_owned = false;
56155         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
56156         return ret_conv;
56157 }
56158
56159 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56160         LDKBolt11InvoiceFeatures this_arg_conv;
56161         this_arg_conv.inner = untag_ptr(this_arg);
56162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56164         this_arg_conv.is_owned = false;
56165         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56166         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
56167         return tag_ptr(ret_conv, true);
56168 }
56169
56170 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56171         LDKBolt11InvoiceFeatures this_arg_conv;
56172         this_arg_conv.inner = untag_ptr(this_arg);
56173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56175         this_arg_conv.is_owned = false;
56176         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56177         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56178         return tag_ptr(ret_conv, true);
56179 }
56180
56181 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56182         LDKBolt11InvoiceFeatures this_arg_conv;
56183         this_arg_conv.inner = untag_ptr(this_arg);
56184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56186         this_arg_conv.is_owned = false;
56187         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56188         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56189         return tag_ptr(ret_conv, true);
56190 }
56191
56192 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56193         LDKBolt11InvoiceFeatures this_arg_conv;
56194         this_arg_conv.inner = untag_ptr(this_arg);
56195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56197         this_arg_conv.is_owned = false;
56198         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56199         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56200         return tag_ptr(ret_conv, true);
56201 }
56202
56203 int64_t  CS_LDK_OfferFeatures_empty() {
56204         LDKOfferFeatures ret_var = OfferFeatures_empty();
56205         int64_t ret_ref = 0;
56206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56208         return ret_ref;
56209 }
56210
56211 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56212         LDKOfferFeatures this_arg_conv;
56213         this_arg_conv.inner = untag_ptr(this_arg);
56214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56216         this_arg_conv.is_owned = false;
56217         LDKOfferFeatures other_conv;
56218         other_conv.inner = untag_ptr(other);
56219         other_conv.is_owned = ptr_is_owned(other);
56220         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56221         other_conv.is_owned = false;
56222         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56223         return ret_conv;
56224 }
56225
56226 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits(int64_t this_arg) {
56227         LDKOfferFeatures this_arg_conv;
56228         this_arg_conv.inner = untag_ptr(this_arg);
56229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56231         this_arg_conv.is_owned = false;
56232         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
56233         return ret_conv;
56234 }
56235
56236 int64_t  CS_LDK_OfferFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56237         LDKOfferFeatures this_arg_conv;
56238         this_arg_conv.inner = untag_ptr(this_arg);
56239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56241         this_arg_conv.is_owned = false;
56242         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56243         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
56244         return tag_ptr(ret_conv, true);
56245 }
56246
56247 int64_t  CS_LDK_OfferFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56248         LDKOfferFeatures this_arg_conv;
56249         this_arg_conv.inner = untag_ptr(this_arg);
56250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56252         this_arg_conv.is_owned = false;
56253         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56254         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56255         return tag_ptr(ret_conv, true);
56256 }
56257
56258 int64_t  CS_LDK_OfferFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56259         LDKOfferFeatures this_arg_conv;
56260         this_arg_conv.inner = untag_ptr(this_arg);
56261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56263         this_arg_conv.is_owned = false;
56264         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56265         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
56266         return tag_ptr(ret_conv, true);
56267 }
56268
56269 int64_t  CS_LDK_OfferFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56270         LDKOfferFeatures this_arg_conv;
56271         this_arg_conv.inner = untag_ptr(this_arg);
56272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56274         this_arg_conv.is_owned = false;
56275         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56276         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56277         return tag_ptr(ret_conv, true);
56278 }
56279
56280 int64_t  CS_LDK_InvoiceRequestFeatures_empty() {
56281         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
56282         int64_t ret_ref = 0;
56283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56285         return ret_ref;
56286 }
56287
56288 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56289         LDKInvoiceRequestFeatures this_arg_conv;
56290         this_arg_conv.inner = untag_ptr(this_arg);
56291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56293         this_arg_conv.is_owned = false;
56294         LDKInvoiceRequestFeatures other_conv;
56295         other_conv.inner = untag_ptr(other);
56296         other_conv.is_owned = ptr_is_owned(other);
56297         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56298         other_conv.is_owned = false;
56299         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56300         return ret_conv;
56301 }
56302
56303 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits(int64_t this_arg) {
56304         LDKInvoiceRequestFeatures this_arg_conv;
56305         this_arg_conv.inner = untag_ptr(this_arg);
56306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56308         this_arg_conv.is_owned = false;
56309         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
56310         return ret_conv;
56311 }
56312
56313 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56314         LDKInvoiceRequestFeatures this_arg_conv;
56315         this_arg_conv.inner = untag_ptr(this_arg);
56316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56318         this_arg_conv.is_owned = false;
56319         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56320         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
56321         return tag_ptr(ret_conv, true);
56322 }
56323
56324 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56325         LDKInvoiceRequestFeatures this_arg_conv;
56326         this_arg_conv.inner = untag_ptr(this_arg);
56327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56329         this_arg_conv.is_owned = false;
56330         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56331         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56332         return tag_ptr(ret_conv, true);
56333 }
56334
56335 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56336         LDKInvoiceRequestFeatures this_arg_conv;
56337         this_arg_conv.inner = untag_ptr(this_arg);
56338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56340         this_arg_conv.is_owned = false;
56341         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56342         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
56343         return tag_ptr(ret_conv, true);
56344 }
56345
56346 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56347         LDKInvoiceRequestFeatures this_arg_conv;
56348         this_arg_conv.inner = untag_ptr(this_arg);
56349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56351         this_arg_conv.is_owned = false;
56352         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56353         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56354         return tag_ptr(ret_conv, true);
56355 }
56356
56357 int64_t  CS_LDK_Bolt12InvoiceFeatures_empty() {
56358         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
56359         int64_t ret_ref = 0;
56360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56362         return ret_ref;
56363 }
56364
56365 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56366         LDKBolt12InvoiceFeatures this_arg_conv;
56367         this_arg_conv.inner = untag_ptr(this_arg);
56368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56370         this_arg_conv.is_owned = false;
56371         LDKBolt12InvoiceFeatures other_conv;
56372         other_conv.inner = untag_ptr(other);
56373         other_conv.is_owned = ptr_is_owned(other);
56374         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56375         other_conv.is_owned = false;
56376         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56377         return ret_conv;
56378 }
56379
56380 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
56381         LDKBolt12InvoiceFeatures this_arg_conv;
56382         this_arg_conv.inner = untag_ptr(this_arg);
56383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56385         this_arg_conv.is_owned = false;
56386         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
56387         return ret_conv;
56388 }
56389
56390 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56391         LDKBolt12InvoiceFeatures this_arg_conv;
56392         this_arg_conv.inner = untag_ptr(this_arg);
56393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56395         this_arg_conv.is_owned = false;
56396         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56397         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
56398         return tag_ptr(ret_conv, true);
56399 }
56400
56401 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56402         LDKBolt12InvoiceFeatures this_arg_conv;
56403         this_arg_conv.inner = untag_ptr(this_arg);
56404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56406         this_arg_conv.is_owned = false;
56407         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56408         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56409         return tag_ptr(ret_conv, true);
56410 }
56411
56412 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56413         LDKBolt12InvoiceFeatures this_arg_conv;
56414         this_arg_conv.inner = untag_ptr(this_arg);
56415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56417         this_arg_conv.is_owned = false;
56418         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56419         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56420         return tag_ptr(ret_conv, true);
56421 }
56422
56423 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56424         LDKBolt12InvoiceFeatures this_arg_conv;
56425         this_arg_conv.inner = untag_ptr(this_arg);
56426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56428         this_arg_conv.is_owned = false;
56429         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56430         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56431         return tag_ptr(ret_conv, true);
56432 }
56433
56434 int64_t  CS_LDK_BlindedHopFeatures_empty() {
56435         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
56436         int64_t ret_ref = 0;
56437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56439         return ret_ref;
56440 }
56441
56442 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56443         LDKBlindedHopFeatures this_arg_conv;
56444         this_arg_conv.inner = untag_ptr(this_arg);
56445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56447         this_arg_conv.is_owned = false;
56448         LDKBlindedHopFeatures other_conv;
56449         other_conv.inner = untag_ptr(other);
56450         other_conv.is_owned = ptr_is_owned(other);
56451         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56452         other_conv.is_owned = false;
56453         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56454         return ret_conv;
56455 }
56456
56457 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits(int64_t this_arg) {
56458         LDKBlindedHopFeatures this_arg_conv;
56459         this_arg_conv.inner = untag_ptr(this_arg);
56460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56462         this_arg_conv.is_owned = false;
56463         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
56464         return ret_conv;
56465 }
56466
56467 int64_t  CS_LDK_BlindedHopFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56468         LDKBlindedHopFeatures this_arg_conv;
56469         this_arg_conv.inner = untag_ptr(this_arg);
56470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56472         this_arg_conv.is_owned = false;
56473         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56474         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
56475         return tag_ptr(ret_conv, true);
56476 }
56477
56478 int64_t  CS_LDK_BlindedHopFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56479         LDKBlindedHopFeatures this_arg_conv;
56480         this_arg_conv.inner = untag_ptr(this_arg);
56481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56483         this_arg_conv.is_owned = false;
56484         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56485         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56486         return tag_ptr(ret_conv, true);
56487 }
56488
56489 int64_t  CS_LDK_BlindedHopFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56490         LDKBlindedHopFeatures this_arg_conv;
56491         this_arg_conv.inner = untag_ptr(this_arg);
56492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56494         this_arg_conv.is_owned = false;
56495         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56496         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
56497         return tag_ptr(ret_conv, true);
56498 }
56499
56500 int64_t  CS_LDK_BlindedHopFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56501         LDKBlindedHopFeatures this_arg_conv;
56502         this_arg_conv.inner = untag_ptr(this_arg);
56503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56505         this_arg_conv.is_owned = false;
56506         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56507         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56508         return tag_ptr(ret_conv, true);
56509 }
56510
56511 int64_t  CS_LDK_ChannelTypeFeatures_empty() {
56512         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
56513         int64_t ret_ref = 0;
56514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56516         return ret_ref;
56517 }
56518
56519 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56520         LDKChannelTypeFeatures this_arg_conv;
56521         this_arg_conv.inner = untag_ptr(this_arg);
56522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56524         this_arg_conv.is_owned = false;
56525         LDKChannelTypeFeatures other_conv;
56526         other_conv.inner = untag_ptr(other);
56527         other_conv.is_owned = ptr_is_owned(other);
56528         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56529         other_conv.is_owned = false;
56530         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56531         return ret_conv;
56532 }
56533
56534 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits(int64_t this_arg) {
56535         LDKChannelTypeFeatures this_arg_conv;
56536         this_arg_conv.inner = untag_ptr(this_arg);
56537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56539         this_arg_conv.is_owned = false;
56540         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
56541         return ret_conv;
56542 }
56543
56544 int64_t  CS_LDK_ChannelTypeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56545         LDKChannelTypeFeatures this_arg_conv;
56546         this_arg_conv.inner = untag_ptr(this_arg);
56547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56549         this_arg_conv.is_owned = false;
56550         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56551         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56552         return tag_ptr(ret_conv, true);
56553 }
56554
56555 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56556         LDKChannelTypeFeatures this_arg_conv;
56557         this_arg_conv.inner = untag_ptr(this_arg);
56558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56560         this_arg_conv.is_owned = false;
56561         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56562         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56563         return tag_ptr(ret_conv, true);
56564 }
56565
56566 int64_t  CS_LDK_ChannelTypeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56567         LDKChannelTypeFeatures this_arg_conv;
56568         this_arg_conv.inner = untag_ptr(this_arg);
56569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56571         this_arg_conv.is_owned = false;
56572         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56573         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56574         return tag_ptr(ret_conv, true);
56575 }
56576
56577 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56578         LDKChannelTypeFeatures this_arg_conv;
56579         this_arg_conv.inner = untag_ptr(this_arg);
56580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56582         this_arg_conv.is_owned = false;
56583         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56584         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56585         return tag_ptr(ret_conv, true);
56586 }
56587
56588 int8_tArray  CS_LDK_InitFeatures_write(int64_t obj) {
56589         LDKInitFeatures obj_conv;
56590         obj_conv.inner = untag_ptr(obj);
56591         obj_conv.is_owned = ptr_is_owned(obj);
56592         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56593         obj_conv.is_owned = false;
56594         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
56595         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56596         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56597         CVec_u8Z_free(ret_var);
56598         return ret_arr;
56599 }
56600
56601 int64_t  CS_LDK_InitFeatures_read(int8_tArray ser) {
56602         LDKu8slice ser_ref;
56603         ser_ref.datalen = ser->arr_len;
56604         ser_ref.data = ser->elems;
56605         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
56606         *ret_conv = InitFeatures_read(ser_ref);
56607         FREE(ser);
56608         return tag_ptr(ret_conv, true);
56609 }
56610
56611 int8_tArray  CS_LDK_ChannelFeatures_write(int64_t obj) {
56612         LDKChannelFeatures obj_conv;
56613         obj_conv.inner = untag_ptr(obj);
56614         obj_conv.is_owned = ptr_is_owned(obj);
56615         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56616         obj_conv.is_owned = false;
56617         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
56618         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56619         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56620         CVec_u8Z_free(ret_var);
56621         return ret_arr;
56622 }
56623
56624 int64_t  CS_LDK_ChannelFeatures_read(int8_tArray ser) {
56625         LDKu8slice ser_ref;
56626         ser_ref.datalen = ser->arr_len;
56627         ser_ref.data = ser->elems;
56628         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
56629         *ret_conv = ChannelFeatures_read(ser_ref);
56630         FREE(ser);
56631         return tag_ptr(ret_conv, true);
56632 }
56633
56634 int8_tArray  CS_LDK_NodeFeatures_write(int64_t obj) {
56635         LDKNodeFeatures obj_conv;
56636         obj_conv.inner = untag_ptr(obj);
56637         obj_conv.is_owned = ptr_is_owned(obj);
56638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56639         obj_conv.is_owned = false;
56640         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
56641         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56642         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56643         CVec_u8Z_free(ret_var);
56644         return ret_arr;
56645 }
56646
56647 int64_t  CS_LDK_NodeFeatures_read(int8_tArray ser) {
56648         LDKu8slice ser_ref;
56649         ser_ref.datalen = ser->arr_len;
56650         ser_ref.data = ser->elems;
56651         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
56652         *ret_conv = NodeFeatures_read(ser_ref);
56653         FREE(ser);
56654         return tag_ptr(ret_conv, true);
56655 }
56656
56657 int8_tArray  CS_LDK_Bolt11InvoiceFeatures_write(int64_t obj) {
56658         LDKBolt11InvoiceFeatures obj_conv;
56659         obj_conv.inner = untag_ptr(obj);
56660         obj_conv.is_owned = ptr_is_owned(obj);
56661         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56662         obj_conv.is_owned = false;
56663         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
56664         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56665         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56666         CVec_u8Z_free(ret_var);
56667         return ret_arr;
56668 }
56669
56670 int64_t  CS_LDK_Bolt11InvoiceFeatures_read(int8_tArray ser) {
56671         LDKu8slice ser_ref;
56672         ser_ref.datalen = ser->arr_len;
56673         ser_ref.data = ser->elems;
56674         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
56675         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
56676         FREE(ser);
56677         return tag_ptr(ret_conv, true);
56678 }
56679
56680 int8_tArray  CS_LDK_Bolt12InvoiceFeatures_write(int64_t obj) {
56681         LDKBolt12InvoiceFeatures obj_conv;
56682         obj_conv.inner = untag_ptr(obj);
56683         obj_conv.is_owned = ptr_is_owned(obj);
56684         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56685         obj_conv.is_owned = false;
56686         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
56687         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56688         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56689         CVec_u8Z_free(ret_var);
56690         return ret_arr;
56691 }
56692
56693 int64_t  CS_LDK_Bolt12InvoiceFeatures_read(int8_tArray ser) {
56694         LDKu8slice ser_ref;
56695         ser_ref.datalen = ser->arr_len;
56696         ser_ref.data = ser->elems;
56697         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
56698         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
56699         FREE(ser);
56700         return tag_ptr(ret_conv, true);
56701 }
56702
56703 int8_tArray  CS_LDK_BlindedHopFeatures_write(int64_t obj) {
56704         LDKBlindedHopFeatures obj_conv;
56705         obj_conv.inner = untag_ptr(obj);
56706         obj_conv.is_owned = ptr_is_owned(obj);
56707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56708         obj_conv.is_owned = false;
56709         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
56710         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56711         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56712         CVec_u8Z_free(ret_var);
56713         return ret_arr;
56714 }
56715
56716 int64_t  CS_LDK_BlindedHopFeatures_read(int8_tArray ser) {
56717         LDKu8slice ser_ref;
56718         ser_ref.datalen = ser->arr_len;
56719         ser_ref.data = ser->elems;
56720         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
56721         *ret_conv = BlindedHopFeatures_read(ser_ref);
56722         FREE(ser);
56723         return tag_ptr(ret_conv, true);
56724 }
56725
56726 int8_tArray  CS_LDK_ChannelTypeFeatures_write(int64_t obj) {
56727         LDKChannelTypeFeatures obj_conv;
56728         obj_conv.inner = untag_ptr(obj);
56729         obj_conv.is_owned = ptr_is_owned(obj);
56730         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56731         obj_conv.is_owned = false;
56732         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
56733         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56734         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56735         CVec_u8Z_free(ret_var);
56736         return ret_arr;
56737 }
56738
56739 int64_t  CS_LDK_ChannelTypeFeatures_read(int8_tArray ser) {
56740         LDKu8slice ser_ref;
56741         ser_ref.datalen = ser->arr_len;
56742         ser_ref.data = ser->elems;
56743         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
56744         *ret_conv = ChannelTypeFeatures_read(ser_ref);
56745         FREE(ser);
56746         return tag_ptr(ret_conv, true);
56747 }
56748
56749 void  CS_LDK_InitFeatures_set_data_loss_protect_optional(int64_t this_arg) {
56750         LDKInitFeatures this_arg_conv;
56751         this_arg_conv.inner = untag_ptr(this_arg);
56752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56754         this_arg_conv.is_owned = false;
56755         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
56756 }
56757
56758 void  CS_LDK_InitFeatures_set_data_loss_protect_required(int64_t this_arg) {
56759         LDKInitFeatures this_arg_conv;
56760         this_arg_conv.inner = untag_ptr(this_arg);
56761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56763         this_arg_conv.is_owned = false;
56764         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
56765 }
56766
56767 jboolean  CS_LDK_InitFeatures_supports_data_loss_protect(int64_t this_arg) {
56768         LDKInitFeatures this_arg_conv;
56769         this_arg_conv.inner = untag_ptr(this_arg);
56770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56772         this_arg_conv.is_owned = false;
56773         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
56774         return ret_conv;
56775 }
56776
56777 void  CS_LDK_NodeFeatures_set_data_loss_protect_optional(int64_t this_arg) {
56778         LDKNodeFeatures this_arg_conv;
56779         this_arg_conv.inner = untag_ptr(this_arg);
56780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56782         this_arg_conv.is_owned = false;
56783         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
56784 }
56785
56786 void  CS_LDK_NodeFeatures_set_data_loss_protect_required(int64_t this_arg) {
56787         LDKNodeFeatures this_arg_conv;
56788         this_arg_conv.inner = untag_ptr(this_arg);
56789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56791         this_arg_conv.is_owned = false;
56792         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
56793 }
56794
56795 jboolean  CS_LDK_NodeFeatures_supports_data_loss_protect(int64_t this_arg) {
56796         LDKNodeFeatures this_arg_conv;
56797         this_arg_conv.inner = untag_ptr(this_arg);
56798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56800         this_arg_conv.is_owned = false;
56801         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
56802         return ret_conv;
56803 }
56804
56805 jboolean  CS_LDK_InitFeatures_requires_data_loss_protect(int64_t this_arg) {
56806         LDKInitFeatures this_arg_conv;
56807         this_arg_conv.inner = untag_ptr(this_arg);
56808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56810         this_arg_conv.is_owned = false;
56811         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
56812         return ret_conv;
56813 }
56814
56815 jboolean  CS_LDK_NodeFeatures_requires_data_loss_protect(int64_t this_arg) {
56816         LDKNodeFeatures this_arg_conv;
56817         this_arg_conv.inner = untag_ptr(this_arg);
56818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56820         this_arg_conv.is_owned = false;
56821         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
56822         return ret_conv;
56823 }
56824
56825 void  CS_LDK_InitFeatures_set_initial_routing_sync_optional(int64_t this_arg) {
56826         LDKInitFeatures this_arg_conv;
56827         this_arg_conv.inner = untag_ptr(this_arg);
56828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56830         this_arg_conv.is_owned = false;
56831         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
56832 }
56833
56834 void  CS_LDK_InitFeatures_set_initial_routing_sync_required(int64_t this_arg) {
56835         LDKInitFeatures this_arg_conv;
56836         this_arg_conv.inner = untag_ptr(this_arg);
56837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56839         this_arg_conv.is_owned = false;
56840         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
56841 }
56842
56843 jboolean  CS_LDK_InitFeatures_initial_routing_sync(int64_t this_arg) {
56844         LDKInitFeatures this_arg_conv;
56845         this_arg_conv.inner = untag_ptr(this_arg);
56846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56848         this_arg_conv.is_owned = false;
56849         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
56850         return ret_conv;
56851 }
56852
56853 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
56854         LDKInitFeatures this_arg_conv;
56855         this_arg_conv.inner = untag_ptr(this_arg);
56856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56858         this_arg_conv.is_owned = false;
56859         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56860 }
56861
56862 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
56863         LDKInitFeatures this_arg_conv;
56864         this_arg_conv.inner = untag_ptr(this_arg);
56865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56867         this_arg_conv.is_owned = false;
56868         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56869 }
56870
56871 jboolean  CS_LDK_InitFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
56872         LDKInitFeatures this_arg_conv;
56873         this_arg_conv.inner = untag_ptr(this_arg);
56874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56876         this_arg_conv.is_owned = false;
56877         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56878         return ret_conv;
56879 }
56880
56881 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
56882         LDKNodeFeatures this_arg_conv;
56883         this_arg_conv.inner = untag_ptr(this_arg);
56884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56886         this_arg_conv.is_owned = false;
56887         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56888 }
56889
56890 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
56891         LDKNodeFeatures this_arg_conv;
56892         this_arg_conv.inner = untag_ptr(this_arg);
56893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56895         this_arg_conv.is_owned = false;
56896         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56897 }
56898
56899 jboolean  CS_LDK_NodeFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
56900         LDKNodeFeatures this_arg_conv;
56901         this_arg_conv.inner = untag_ptr(this_arg);
56902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56904         this_arg_conv.is_owned = false;
56905         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56906         return ret_conv;
56907 }
56908
56909 jboolean  CS_LDK_InitFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
56910         LDKInitFeatures this_arg_conv;
56911         this_arg_conv.inner = untag_ptr(this_arg);
56912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56914         this_arg_conv.is_owned = false;
56915         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56916         return ret_conv;
56917 }
56918
56919 jboolean  CS_LDK_NodeFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
56920         LDKNodeFeatures this_arg_conv;
56921         this_arg_conv.inner = untag_ptr(this_arg);
56922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56924         this_arg_conv.is_owned = false;
56925         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56926         return ret_conv;
56927 }
56928
56929 void  CS_LDK_InitFeatures_set_gossip_queries_optional(int64_t this_arg) {
56930         LDKInitFeatures this_arg_conv;
56931         this_arg_conv.inner = untag_ptr(this_arg);
56932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56934         this_arg_conv.is_owned = false;
56935         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
56936 }
56937
56938 void  CS_LDK_InitFeatures_set_gossip_queries_required(int64_t this_arg) {
56939         LDKInitFeatures this_arg_conv;
56940         this_arg_conv.inner = untag_ptr(this_arg);
56941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56943         this_arg_conv.is_owned = false;
56944         InitFeatures_set_gossip_queries_required(&this_arg_conv);
56945 }
56946
56947 jboolean  CS_LDK_InitFeatures_supports_gossip_queries(int64_t this_arg) {
56948         LDKInitFeatures this_arg_conv;
56949         this_arg_conv.inner = untag_ptr(this_arg);
56950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56952         this_arg_conv.is_owned = false;
56953         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
56954         return ret_conv;
56955 }
56956
56957 void  CS_LDK_NodeFeatures_set_gossip_queries_optional(int64_t this_arg) {
56958         LDKNodeFeatures this_arg_conv;
56959         this_arg_conv.inner = untag_ptr(this_arg);
56960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56962         this_arg_conv.is_owned = false;
56963         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56964 }
56965
56966 void  CS_LDK_NodeFeatures_set_gossip_queries_required(int64_t this_arg) {
56967         LDKNodeFeatures this_arg_conv;
56968         this_arg_conv.inner = untag_ptr(this_arg);
56969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56971         this_arg_conv.is_owned = false;
56972         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56973 }
56974
56975 jboolean  CS_LDK_NodeFeatures_supports_gossip_queries(int64_t this_arg) {
56976         LDKNodeFeatures this_arg_conv;
56977         this_arg_conv.inner = untag_ptr(this_arg);
56978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56980         this_arg_conv.is_owned = false;
56981         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56982         return ret_conv;
56983 }
56984
56985 jboolean  CS_LDK_InitFeatures_requires_gossip_queries(int64_t this_arg) {
56986         LDKInitFeatures this_arg_conv;
56987         this_arg_conv.inner = untag_ptr(this_arg);
56988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56990         this_arg_conv.is_owned = false;
56991         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56992         return ret_conv;
56993 }
56994
56995 jboolean  CS_LDK_NodeFeatures_requires_gossip_queries(int64_t this_arg) {
56996         LDKNodeFeatures this_arg_conv;
56997         this_arg_conv.inner = untag_ptr(this_arg);
56998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57000         this_arg_conv.is_owned = false;
57001         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
57002         return ret_conv;
57003 }
57004
57005 void  CS_LDK_InitFeatures_set_variable_length_onion_optional(int64_t this_arg) {
57006         LDKInitFeatures this_arg_conv;
57007         this_arg_conv.inner = untag_ptr(this_arg);
57008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57010         this_arg_conv.is_owned = false;
57011         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
57012 }
57013
57014 void  CS_LDK_InitFeatures_set_variable_length_onion_required(int64_t this_arg) {
57015         LDKInitFeatures this_arg_conv;
57016         this_arg_conv.inner = untag_ptr(this_arg);
57017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57019         this_arg_conv.is_owned = false;
57020         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
57021 }
57022
57023 jboolean  CS_LDK_InitFeatures_supports_variable_length_onion(int64_t this_arg) {
57024         LDKInitFeatures this_arg_conv;
57025         this_arg_conv.inner = untag_ptr(this_arg);
57026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57028         this_arg_conv.is_owned = false;
57029         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
57030         return ret_conv;
57031 }
57032
57033 void  CS_LDK_NodeFeatures_set_variable_length_onion_optional(int64_t this_arg) {
57034         LDKNodeFeatures this_arg_conv;
57035         this_arg_conv.inner = untag_ptr(this_arg);
57036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57038         this_arg_conv.is_owned = false;
57039         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
57040 }
57041
57042 void  CS_LDK_NodeFeatures_set_variable_length_onion_required(int64_t this_arg) {
57043         LDKNodeFeatures this_arg_conv;
57044         this_arg_conv.inner = untag_ptr(this_arg);
57045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57047         this_arg_conv.is_owned = false;
57048         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
57049 }
57050
57051 jboolean  CS_LDK_NodeFeatures_supports_variable_length_onion(int64_t this_arg) {
57052         LDKNodeFeatures this_arg_conv;
57053         this_arg_conv.inner = untag_ptr(this_arg);
57054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57056         this_arg_conv.is_owned = false;
57057         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
57058         return ret_conv;
57059 }
57060
57061 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_optional(int64_t this_arg) {
57062         LDKBolt11InvoiceFeatures this_arg_conv;
57063         this_arg_conv.inner = untag_ptr(this_arg);
57064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57066         this_arg_conv.is_owned = false;
57067         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
57068 }
57069
57070 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_required(int64_t this_arg) {
57071         LDKBolt11InvoiceFeatures this_arg_conv;
57072         this_arg_conv.inner = untag_ptr(this_arg);
57073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57075         this_arg_conv.is_owned = false;
57076         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
57077 }
57078
57079 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_variable_length_onion(int64_t this_arg) {
57080         LDKBolt11InvoiceFeatures this_arg_conv;
57081         this_arg_conv.inner = untag_ptr(this_arg);
57082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57084         this_arg_conv.is_owned = false;
57085         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
57086         return ret_conv;
57087 }
57088
57089 jboolean  CS_LDK_InitFeatures_requires_variable_length_onion(int64_t this_arg) {
57090         LDKInitFeatures this_arg_conv;
57091         this_arg_conv.inner = untag_ptr(this_arg);
57092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57094         this_arg_conv.is_owned = false;
57095         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
57096         return ret_conv;
57097 }
57098
57099 jboolean  CS_LDK_NodeFeatures_requires_variable_length_onion(int64_t this_arg) {
57100         LDKNodeFeatures this_arg_conv;
57101         this_arg_conv.inner = untag_ptr(this_arg);
57102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57104         this_arg_conv.is_owned = false;
57105         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
57106         return ret_conv;
57107 }
57108
57109 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_variable_length_onion(int64_t this_arg) {
57110         LDKBolt11InvoiceFeatures this_arg_conv;
57111         this_arg_conv.inner = untag_ptr(this_arg);
57112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57114         this_arg_conv.is_owned = false;
57115         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
57116         return ret_conv;
57117 }
57118
57119 void  CS_LDK_InitFeatures_set_static_remote_key_optional(int64_t this_arg) {
57120         LDKInitFeatures this_arg_conv;
57121         this_arg_conv.inner = untag_ptr(this_arg);
57122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57124         this_arg_conv.is_owned = false;
57125         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
57126 }
57127
57128 void  CS_LDK_InitFeatures_set_static_remote_key_required(int64_t this_arg) {
57129         LDKInitFeatures this_arg_conv;
57130         this_arg_conv.inner = untag_ptr(this_arg);
57131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57133         this_arg_conv.is_owned = false;
57134         InitFeatures_set_static_remote_key_required(&this_arg_conv);
57135 }
57136
57137 jboolean  CS_LDK_InitFeatures_supports_static_remote_key(int64_t this_arg) {
57138         LDKInitFeatures this_arg_conv;
57139         this_arg_conv.inner = untag_ptr(this_arg);
57140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57142         this_arg_conv.is_owned = false;
57143         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
57144         return ret_conv;
57145 }
57146
57147 void  CS_LDK_NodeFeatures_set_static_remote_key_optional(int64_t this_arg) {
57148         LDKNodeFeatures this_arg_conv;
57149         this_arg_conv.inner = untag_ptr(this_arg);
57150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57152         this_arg_conv.is_owned = false;
57153         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
57154 }
57155
57156 void  CS_LDK_NodeFeatures_set_static_remote_key_required(int64_t this_arg) {
57157         LDKNodeFeatures this_arg_conv;
57158         this_arg_conv.inner = untag_ptr(this_arg);
57159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57161         this_arg_conv.is_owned = false;
57162         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
57163 }
57164
57165 jboolean  CS_LDK_NodeFeatures_supports_static_remote_key(int64_t this_arg) {
57166         LDKNodeFeatures this_arg_conv;
57167         this_arg_conv.inner = untag_ptr(this_arg);
57168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57170         this_arg_conv.is_owned = false;
57171         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
57172         return ret_conv;
57173 }
57174
57175 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_optional(int64_t this_arg) {
57176         LDKChannelTypeFeatures this_arg_conv;
57177         this_arg_conv.inner = untag_ptr(this_arg);
57178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57180         this_arg_conv.is_owned = false;
57181         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
57182 }
57183
57184 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_required(int64_t this_arg) {
57185         LDKChannelTypeFeatures this_arg_conv;
57186         this_arg_conv.inner = untag_ptr(this_arg);
57187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57189         this_arg_conv.is_owned = false;
57190         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
57191 }
57192
57193 jboolean  CS_LDK_ChannelTypeFeatures_supports_static_remote_key(int64_t this_arg) {
57194         LDKChannelTypeFeatures this_arg_conv;
57195         this_arg_conv.inner = untag_ptr(this_arg);
57196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57198         this_arg_conv.is_owned = false;
57199         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
57200         return ret_conv;
57201 }
57202
57203 jboolean  CS_LDK_InitFeatures_requires_static_remote_key(int64_t this_arg) {
57204         LDKInitFeatures this_arg_conv;
57205         this_arg_conv.inner = untag_ptr(this_arg);
57206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57208         this_arg_conv.is_owned = false;
57209         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
57210         return ret_conv;
57211 }
57212
57213 jboolean  CS_LDK_NodeFeatures_requires_static_remote_key(int64_t this_arg) {
57214         LDKNodeFeatures this_arg_conv;
57215         this_arg_conv.inner = untag_ptr(this_arg);
57216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57218         this_arg_conv.is_owned = false;
57219         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
57220         return ret_conv;
57221 }
57222
57223 jboolean  CS_LDK_ChannelTypeFeatures_requires_static_remote_key(int64_t this_arg) {
57224         LDKChannelTypeFeatures this_arg_conv;
57225         this_arg_conv.inner = untag_ptr(this_arg);
57226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57228         this_arg_conv.is_owned = false;
57229         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
57230         return ret_conv;
57231 }
57232
57233 void  CS_LDK_InitFeatures_set_payment_secret_optional(int64_t this_arg) {
57234         LDKInitFeatures this_arg_conv;
57235         this_arg_conv.inner = untag_ptr(this_arg);
57236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57238         this_arg_conv.is_owned = false;
57239         InitFeatures_set_payment_secret_optional(&this_arg_conv);
57240 }
57241
57242 void  CS_LDK_InitFeatures_set_payment_secret_required(int64_t this_arg) {
57243         LDKInitFeatures this_arg_conv;
57244         this_arg_conv.inner = untag_ptr(this_arg);
57245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57247         this_arg_conv.is_owned = false;
57248         InitFeatures_set_payment_secret_required(&this_arg_conv);
57249 }
57250
57251 jboolean  CS_LDK_InitFeatures_supports_payment_secret(int64_t this_arg) {
57252         LDKInitFeatures this_arg_conv;
57253         this_arg_conv.inner = untag_ptr(this_arg);
57254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57256         this_arg_conv.is_owned = false;
57257         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
57258         return ret_conv;
57259 }
57260
57261 void  CS_LDK_NodeFeatures_set_payment_secret_optional(int64_t this_arg) {
57262         LDKNodeFeatures this_arg_conv;
57263         this_arg_conv.inner = untag_ptr(this_arg);
57264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57266         this_arg_conv.is_owned = false;
57267         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
57268 }
57269
57270 void  CS_LDK_NodeFeatures_set_payment_secret_required(int64_t this_arg) {
57271         LDKNodeFeatures this_arg_conv;
57272         this_arg_conv.inner = untag_ptr(this_arg);
57273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57275         this_arg_conv.is_owned = false;
57276         NodeFeatures_set_payment_secret_required(&this_arg_conv);
57277 }
57278
57279 jboolean  CS_LDK_NodeFeatures_supports_payment_secret(int64_t this_arg) {
57280         LDKNodeFeatures this_arg_conv;
57281         this_arg_conv.inner = untag_ptr(this_arg);
57282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57284         this_arg_conv.is_owned = false;
57285         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
57286         return ret_conv;
57287 }
57288
57289 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_optional(int64_t this_arg) {
57290         LDKBolt11InvoiceFeatures this_arg_conv;
57291         this_arg_conv.inner = untag_ptr(this_arg);
57292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57294         this_arg_conv.is_owned = false;
57295         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
57296 }
57297
57298 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_required(int64_t this_arg) {
57299         LDKBolt11InvoiceFeatures this_arg_conv;
57300         this_arg_conv.inner = untag_ptr(this_arg);
57301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57303         this_arg_conv.is_owned = false;
57304         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
57305 }
57306
57307 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_secret(int64_t this_arg) {
57308         LDKBolt11InvoiceFeatures this_arg_conv;
57309         this_arg_conv.inner = untag_ptr(this_arg);
57310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57312         this_arg_conv.is_owned = false;
57313         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
57314         return ret_conv;
57315 }
57316
57317 jboolean  CS_LDK_InitFeatures_requires_payment_secret(int64_t this_arg) {
57318         LDKInitFeatures this_arg_conv;
57319         this_arg_conv.inner = untag_ptr(this_arg);
57320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57322         this_arg_conv.is_owned = false;
57323         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
57324         return ret_conv;
57325 }
57326
57327 jboolean  CS_LDK_NodeFeatures_requires_payment_secret(int64_t this_arg) {
57328         LDKNodeFeatures this_arg_conv;
57329         this_arg_conv.inner = untag_ptr(this_arg);
57330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57332         this_arg_conv.is_owned = false;
57333         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
57334         return ret_conv;
57335 }
57336
57337 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_secret(int64_t this_arg) {
57338         LDKBolt11InvoiceFeatures this_arg_conv;
57339         this_arg_conv.inner = untag_ptr(this_arg);
57340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57342         this_arg_conv.is_owned = false;
57343         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
57344         return ret_conv;
57345 }
57346
57347 void  CS_LDK_InitFeatures_set_basic_mpp_optional(int64_t this_arg) {
57348         LDKInitFeatures this_arg_conv;
57349         this_arg_conv.inner = untag_ptr(this_arg);
57350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57352         this_arg_conv.is_owned = false;
57353         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
57354 }
57355
57356 void  CS_LDK_InitFeatures_set_basic_mpp_required(int64_t this_arg) {
57357         LDKInitFeatures this_arg_conv;
57358         this_arg_conv.inner = untag_ptr(this_arg);
57359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57361         this_arg_conv.is_owned = false;
57362         InitFeatures_set_basic_mpp_required(&this_arg_conv);
57363 }
57364
57365 jboolean  CS_LDK_InitFeatures_supports_basic_mpp(int64_t this_arg) {
57366         LDKInitFeatures this_arg_conv;
57367         this_arg_conv.inner = untag_ptr(this_arg);
57368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57370         this_arg_conv.is_owned = false;
57371         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
57372         return ret_conv;
57373 }
57374
57375 void  CS_LDK_NodeFeatures_set_basic_mpp_optional(int64_t this_arg) {
57376         LDKNodeFeatures this_arg_conv;
57377         this_arg_conv.inner = untag_ptr(this_arg);
57378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57380         this_arg_conv.is_owned = false;
57381         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
57382 }
57383
57384 void  CS_LDK_NodeFeatures_set_basic_mpp_required(int64_t this_arg) {
57385         LDKNodeFeatures this_arg_conv;
57386         this_arg_conv.inner = untag_ptr(this_arg);
57387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57389         this_arg_conv.is_owned = false;
57390         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
57391 }
57392
57393 jboolean  CS_LDK_NodeFeatures_supports_basic_mpp(int64_t this_arg) {
57394         LDKNodeFeatures this_arg_conv;
57395         this_arg_conv.inner = untag_ptr(this_arg);
57396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57398         this_arg_conv.is_owned = false;
57399         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
57400         return ret_conv;
57401 }
57402
57403 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
57404         LDKBolt11InvoiceFeatures this_arg_conv;
57405         this_arg_conv.inner = untag_ptr(this_arg);
57406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57408         this_arg_conv.is_owned = false;
57409         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57410 }
57411
57412 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
57413         LDKBolt11InvoiceFeatures this_arg_conv;
57414         this_arg_conv.inner = untag_ptr(this_arg);
57415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57417         this_arg_conv.is_owned = false;
57418         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57419 }
57420
57421 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
57422         LDKBolt11InvoiceFeatures this_arg_conv;
57423         this_arg_conv.inner = untag_ptr(this_arg);
57424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57426         this_arg_conv.is_owned = false;
57427         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57428         return ret_conv;
57429 }
57430
57431 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
57432         LDKBolt12InvoiceFeatures this_arg_conv;
57433         this_arg_conv.inner = untag_ptr(this_arg);
57434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57436         this_arg_conv.is_owned = false;
57437         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57438 }
57439
57440 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
57441         LDKBolt12InvoiceFeatures this_arg_conv;
57442         this_arg_conv.inner = untag_ptr(this_arg);
57443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57445         this_arg_conv.is_owned = false;
57446         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57447 }
57448
57449 jboolean  CS_LDK_Bolt12InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
57450         LDKBolt12InvoiceFeatures this_arg_conv;
57451         this_arg_conv.inner = untag_ptr(this_arg);
57452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57454         this_arg_conv.is_owned = false;
57455         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57456         return ret_conv;
57457 }
57458
57459 jboolean  CS_LDK_InitFeatures_requires_basic_mpp(int64_t this_arg) {
57460         LDKInitFeatures this_arg_conv;
57461         this_arg_conv.inner = untag_ptr(this_arg);
57462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57464         this_arg_conv.is_owned = false;
57465         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
57466         return ret_conv;
57467 }
57468
57469 jboolean  CS_LDK_NodeFeatures_requires_basic_mpp(int64_t this_arg) {
57470         LDKNodeFeatures this_arg_conv;
57471         this_arg_conv.inner = untag_ptr(this_arg);
57472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57474         this_arg_conv.is_owned = false;
57475         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
57476         return ret_conv;
57477 }
57478
57479 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
57480         LDKBolt11InvoiceFeatures this_arg_conv;
57481         this_arg_conv.inner = untag_ptr(this_arg);
57482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57484         this_arg_conv.is_owned = false;
57485         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57486         return ret_conv;
57487 }
57488
57489 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
57490         LDKBolt12InvoiceFeatures this_arg_conv;
57491         this_arg_conv.inner = untag_ptr(this_arg);
57492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57494         this_arg_conv.is_owned = false;
57495         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57496         return ret_conv;
57497 }
57498
57499 void  CS_LDK_InitFeatures_set_wumbo_optional(int64_t this_arg) {
57500         LDKInitFeatures this_arg_conv;
57501         this_arg_conv.inner = untag_ptr(this_arg);
57502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57504         this_arg_conv.is_owned = false;
57505         InitFeatures_set_wumbo_optional(&this_arg_conv);
57506 }
57507
57508 void  CS_LDK_InitFeatures_set_wumbo_required(int64_t this_arg) {
57509         LDKInitFeatures this_arg_conv;
57510         this_arg_conv.inner = untag_ptr(this_arg);
57511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57513         this_arg_conv.is_owned = false;
57514         InitFeatures_set_wumbo_required(&this_arg_conv);
57515 }
57516
57517 jboolean  CS_LDK_InitFeatures_supports_wumbo(int64_t this_arg) {
57518         LDKInitFeatures this_arg_conv;
57519         this_arg_conv.inner = untag_ptr(this_arg);
57520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57522         this_arg_conv.is_owned = false;
57523         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
57524         return ret_conv;
57525 }
57526
57527 void  CS_LDK_NodeFeatures_set_wumbo_optional(int64_t this_arg) {
57528         LDKNodeFeatures this_arg_conv;
57529         this_arg_conv.inner = untag_ptr(this_arg);
57530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57532         this_arg_conv.is_owned = false;
57533         NodeFeatures_set_wumbo_optional(&this_arg_conv);
57534 }
57535
57536 void  CS_LDK_NodeFeatures_set_wumbo_required(int64_t this_arg) {
57537         LDKNodeFeatures this_arg_conv;
57538         this_arg_conv.inner = untag_ptr(this_arg);
57539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57541         this_arg_conv.is_owned = false;
57542         NodeFeatures_set_wumbo_required(&this_arg_conv);
57543 }
57544
57545 jboolean  CS_LDK_NodeFeatures_supports_wumbo(int64_t this_arg) {
57546         LDKNodeFeatures this_arg_conv;
57547         this_arg_conv.inner = untag_ptr(this_arg);
57548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57550         this_arg_conv.is_owned = false;
57551         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
57552         return ret_conv;
57553 }
57554
57555 jboolean  CS_LDK_InitFeatures_requires_wumbo(int64_t this_arg) {
57556         LDKInitFeatures this_arg_conv;
57557         this_arg_conv.inner = untag_ptr(this_arg);
57558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57560         this_arg_conv.is_owned = false;
57561         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
57562         return ret_conv;
57563 }
57564
57565 jboolean  CS_LDK_NodeFeatures_requires_wumbo(int64_t this_arg) {
57566         LDKNodeFeatures this_arg_conv;
57567         this_arg_conv.inner = untag_ptr(this_arg);
57568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57570         this_arg_conv.is_owned = false;
57571         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
57572         return ret_conv;
57573 }
57574
57575 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
57576         LDKInitFeatures this_arg_conv;
57577         this_arg_conv.inner = untag_ptr(this_arg);
57578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57580         this_arg_conv.is_owned = false;
57581         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57582 }
57583
57584 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
57585         LDKInitFeatures this_arg_conv;
57586         this_arg_conv.inner = untag_ptr(this_arg);
57587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57589         this_arg_conv.is_owned = false;
57590         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57591 }
57592
57593 jboolean  CS_LDK_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57594         LDKInitFeatures this_arg_conv;
57595         this_arg_conv.inner = untag_ptr(this_arg);
57596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57598         this_arg_conv.is_owned = false;
57599         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57600         return ret_conv;
57601 }
57602
57603 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
57604         LDKNodeFeatures this_arg_conv;
57605         this_arg_conv.inner = untag_ptr(this_arg);
57606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57608         this_arg_conv.is_owned = false;
57609         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57610 }
57611
57612 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
57613         LDKNodeFeatures this_arg_conv;
57614         this_arg_conv.inner = untag_ptr(this_arg);
57615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57617         this_arg_conv.is_owned = false;
57618         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57619 }
57620
57621 jboolean  CS_LDK_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57622         LDKNodeFeatures this_arg_conv;
57623         this_arg_conv.inner = untag_ptr(this_arg);
57624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57626         this_arg_conv.is_owned = false;
57627         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57628         return ret_conv;
57629 }
57630
57631 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
57632         LDKChannelTypeFeatures this_arg_conv;
57633         this_arg_conv.inner = untag_ptr(this_arg);
57634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57636         this_arg_conv.is_owned = false;
57637         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57638 }
57639
57640 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
57641         LDKChannelTypeFeatures this_arg_conv;
57642         this_arg_conv.inner = untag_ptr(this_arg);
57643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57645         this_arg_conv.is_owned = false;
57646         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57647 }
57648
57649 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57650         LDKChannelTypeFeatures this_arg_conv;
57651         this_arg_conv.inner = untag_ptr(this_arg);
57652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57654         this_arg_conv.is_owned = false;
57655         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57656         return ret_conv;
57657 }
57658
57659 jboolean  CS_LDK_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57660         LDKInitFeatures this_arg_conv;
57661         this_arg_conv.inner = untag_ptr(this_arg);
57662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57664         this_arg_conv.is_owned = false;
57665         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57666         return ret_conv;
57667 }
57668
57669 jboolean  CS_LDK_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57670         LDKNodeFeatures this_arg_conv;
57671         this_arg_conv.inner = untag_ptr(this_arg);
57672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57674         this_arg_conv.is_owned = false;
57675         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57676         return ret_conv;
57677 }
57678
57679 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57680         LDKChannelTypeFeatures this_arg_conv;
57681         this_arg_conv.inner = untag_ptr(this_arg);
57682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57684         this_arg_conv.is_owned = false;
57685         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57686         return ret_conv;
57687 }
57688
57689 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
57690         LDKInitFeatures this_arg_conv;
57691         this_arg_conv.inner = untag_ptr(this_arg);
57692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57694         this_arg_conv.is_owned = false;
57695         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57696 }
57697
57698 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
57699         LDKInitFeatures this_arg_conv;
57700         this_arg_conv.inner = untag_ptr(this_arg);
57701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57703         this_arg_conv.is_owned = false;
57704         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57705 }
57706
57707 jboolean  CS_LDK_InitFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57708         LDKInitFeatures this_arg_conv;
57709         this_arg_conv.inner = untag_ptr(this_arg);
57710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57712         this_arg_conv.is_owned = false;
57713         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57714         return ret_conv;
57715 }
57716
57717 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
57718         LDKNodeFeatures this_arg_conv;
57719         this_arg_conv.inner = untag_ptr(this_arg);
57720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57722         this_arg_conv.is_owned = false;
57723         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57724 }
57725
57726 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
57727         LDKNodeFeatures this_arg_conv;
57728         this_arg_conv.inner = untag_ptr(this_arg);
57729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57731         this_arg_conv.is_owned = false;
57732         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57733 }
57734
57735 jboolean  CS_LDK_NodeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57736         LDKNodeFeatures this_arg_conv;
57737         this_arg_conv.inner = untag_ptr(this_arg);
57738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57740         this_arg_conv.is_owned = false;
57741         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57742         return ret_conv;
57743 }
57744
57745 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
57746         LDKChannelTypeFeatures this_arg_conv;
57747         this_arg_conv.inner = untag_ptr(this_arg);
57748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57750         this_arg_conv.is_owned = false;
57751         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57752 }
57753
57754 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
57755         LDKChannelTypeFeatures this_arg_conv;
57756         this_arg_conv.inner = untag_ptr(this_arg);
57757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57759         this_arg_conv.is_owned = false;
57760         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57761 }
57762
57763 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57764         LDKChannelTypeFeatures this_arg_conv;
57765         this_arg_conv.inner = untag_ptr(this_arg);
57766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57768         this_arg_conv.is_owned = false;
57769         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57770         return ret_conv;
57771 }
57772
57773 jboolean  CS_LDK_InitFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57774         LDKInitFeatures this_arg_conv;
57775         this_arg_conv.inner = untag_ptr(this_arg);
57776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57778         this_arg_conv.is_owned = false;
57779         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57780         return ret_conv;
57781 }
57782
57783 jboolean  CS_LDK_NodeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57784         LDKNodeFeatures this_arg_conv;
57785         this_arg_conv.inner = untag_ptr(this_arg);
57786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57788         this_arg_conv.is_owned = false;
57789         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57790         return ret_conv;
57791 }
57792
57793 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57794         LDKChannelTypeFeatures this_arg_conv;
57795         this_arg_conv.inner = untag_ptr(this_arg);
57796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57798         this_arg_conv.is_owned = false;
57799         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57800         return ret_conv;
57801 }
57802
57803 void  CS_LDK_InitFeatures_set_route_blinding_optional(int64_t this_arg) {
57804         LDKInitFeatures this_arg_conv;
57805         this_arg_conv.inner = untag_ptr(this_arg);
57806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57808         this_arg_conv.is_owned = false;
57809         InitFeatures_set_route_blinding_optional(&this_arg_conv);
57810 }
57811
57812 void  CS_LDK_InitFeatures_set_route_blinding_required(int64_t this_arg) {
57813         LDKInitFeatures this_arg_conv;
57814         this_arg_conv.inner = untag_ptr(this_arg);
57815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57817         this_arg_conv.is_owned = false;
57818         InitFeatures_set_route_blinding_required(&this_arg_conv);
57819 }
57820
57821 jboolean  CS_LDK_InitFeatures_supports_route_blinding(int64_t this_arg) {
57822         LDKInitFeatures this_arg_conv;
57823         this_arg_conv.inner = untag_ptr(this_arg);
57824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57826         this_arg_conv.is_owned = false;
57827         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
57828         return ret_conv;
57829 }
57830
57831 void  CS_LDK_NodeFeatures_set_route_blinding_optional(int64_t this_arg) {
57832         LDKNodeFeatures this_arg_conv;
57833         this_arg_conv.inner = untag_ptr(this_arg);
57834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57836         this_arg_conv.is_owned = false;
57837         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
57838 }
57839
57840 void  CS_LDK_NodeFeatures_set_route_blinding_required(int64_t this_arg) {
57841         LDKNodeFeatures this_arg_conv;
57842         this_arg_conv.inner = untag_ptr(this_arg);
57843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57845         this_arg_conv.is_owned = false;
57846         NodeFeatures_set_route_blinding_required(&this_arg_conv);
57847 }
57848
57849 jboolean  CS_LDK_NodeFeatures_supports_route_blinding(int64_t this_arg) {
57850         LDKNodeFeatures this_arg_conv;
57851         this_arg_conv.inner = untag_ptr(this_arg);
57852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57854         this_arg_conv.is_owned = false;
57855         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
57856         return ret_conv;
57857 }
57858
57859 jboolean  CS_LDK_InitFeatures_requires_route_blinding(int64_t this_arg) {
57860         LDKInitFeatures this_arg_conv;
57861         this_arg_conv.inner = untag_ptr(this_arg);
57862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57864         this_arg_conv.is_owned = false;
57865         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
57866         return ret_conv;
57867 }
57868
57869 jboolean  CS_LDK_NodeFeatures_requires_route_blinding(int64_t this_arg) {
57870         LDKNodeFeatures this_arg_conv;
57871         this_arg_conv.inner = untag_ptr(this_arg);
57872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57874         this_arg_conv.is_owned = false;
57875         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
57876         return ret_conv;
57877 }
57878
57879 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
57880         LDKInitFeatures this_arg_conv;
57881         this_arg_conv.inner = untag_ptr(this_arg);
57882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57884         this_arg_conv.is_owned = false;
57885         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57886 }
57887
57888 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
57889         LDKInitFeatures this_arg_conv;
57890         this_arg_conv.inner = untag_ptr(this_arg);
57891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57893         this_arg_conv.is_owned = false;
57894         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57895 }
57896
57897 jboolean  CS_LDK_InitFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
57898         LDKInitFeatures this_arg_conv;
57899         this_arg_conv.inner = untag_ptr(this_arg);
57900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57902         this_arg_conv.is_owned = false;
57903         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57904         return ret_conv;
57905 }
57906
57907 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
57908         LDKNodeFeatures this_arg_conv;
57909         this_arg_conv.inner = untag_ptr(this_arg);
57910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57912         this_arg_conv.is_owned = false;
57913         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57914 }
57915
57916 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
57917         LDKNodeFeatures this_arg_conv;
57918         this_arg_conv.inner = untag_ptr(this_arg);
57919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57921         this_arg_conv.is_owned = false;
57922         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57923 }
57924
57925 jboolean  CS_LDK_NodeFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
57926         LDKNodeFeatures this_arg_conv;
57927         this_arg_conv.inner = untag_ptr(this_arg);
57928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57930         this_arg_conv.is_owned = false;
57931         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57932         return ret_conv;
57933 }
57934
57935 jboolean  CS_LDK_InitFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
57936         LDKInitFeatures this_arg_conv;
57937         this_arg_conv.inner = untag_ptr(this_arg);
57938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57940         this_arg_conv.is_owned = false;
57941         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57942         return ret_conv;
57943 }
57944
57945 jboolean  CS_LDK_NodeFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
57946         LDKNodeFeatures this_arg_conv;
57947         this_arg_conv.inner = untag_ptr(this_arg);
57948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57950         this_arg_conv.is_owned = false;
57951         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57952         return ret_conv;
57953 }
57954
57955 void  CS_LDK_InitFeatures_set_taproot_optional(int64_t this_arg) {
57956         LDKInitFeatures this_arg_conv;
57957         this_arg_conv.inner = untag_ptr(this_arg);
57958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57960         this_arg_conv.is_owned = false;
57961         InitFeatures_set_taproot_optional(&this_arg_conv);
57962 }
57963
57964 void  CS_LDK_InitFeatures_set_taproot_required(int64_t this_arg) {
57965         LDKInitFeatures this_arg_conv;
57966         this_arg_conv.inner = untag_ptr(this_arg);
57967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57969         this_arg_conv.is_owned = false;
57970         InitFeatures_set_taproot_required(&this_arg_conv);
57971 }
57972
57973 jboolean  CS_LDK_InitFeatures_supports_taproot(int64_t this_arg) {
57974         LDKInitFeatures this_arg_conv;
57975         this_arg_conv.inner = untag_ptr(this_arg);
57976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57978         this_arg_conv.is_owned = false;
57979         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
57980         return ret_conv;
57981 }
57982
57983 void  CS_LDK_NodeFeatures_set_taproot_optional(int64_t this_arg) {
57984         LDKNodeFeatures this_arg_conv;
57985         this_arg_conv.inner = untag_ptr(this_arg);
57986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57988         this_arg_conv.is_owned = false;
57989         NodeFeatures_set_taproot_optional(&this_arg_conv);
57990 }
57991
57992 void  CS_LDK_NodeFeatures_set_taproot_required(int64_t this_arg) {
57993         LDKNodeFeatures this_arg_conv;
57994         this_arg_conv.inner = untag_ptr(this_arg);
57995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57997         this_arg_conv.is_owned = false;
57998         NodeFeatures_set_taproot_required(&this_arg_conv);
57999 }
58000
58001 jboolean  CS_LDK_NodeFeatures_supports_taproot(int64_t this_arg) {
58002         LDKNodeFeatures this_arg_conv;
58003         this_arg_conv.inner = untag_ptr(this_arg);
58004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58006         this_arg_conv.is_owned = false;
58007         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
58008         return ret_conv;
58009 }
58010
58011 void  CS_LDK_ChannelTypeFeatures_set_taproot_optional(int64_t this_arg) {
58012         LDKChannelTypeFeatures this_arg_conv;
58013         this_arg_conv.inner = untag_ptr(this_arg);
58014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58016         this_arg_conv.is_owned = false;
58017         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
58018 }
58019
58020 void  CS_LDK_ChannelTypeFeatures_set_taproot_required(int64_t this_arg) {
58021         LDKChannelTypeFeatures this_arg_conv;
58022         this_arg_conv.inner = untag_ptr(this_arg);
58023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58025         this_arg_conv.is_owned = false;
58026         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
58027 }
58028
58029 jboolean  CS_LDK_ChannelTypeFeatures_supports_taproot(int64_t this_arg) {
58030         LDKChannelTypeFeatures this_arg_conv;
58031         this_arg_conv.inner = untag_ptr(this_arg);
58032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58034         this_arg_conv.is_owned = false;
58035         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
58036         return ret_conv;
58037 }
58038
58039 jboolean  CS_LDK_InitFeatures_requires_taproot(int64_t this_arg) {
58040         LDKInitFeatures this_arg_conv;
58041         this_arg_conv.inner = untag_ptr(this_arg);
58042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58044         this_arg_conv.is_owned = false;
58045         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
58046         return ret_conv;
58047 }
58048
58049 jboolean  CS_LDK_NodeFeatures_requires_taproot(int64_t this_arg) {
58050         LDKNodeFeatures this_arg_conv;
58051         this_arg_conv.inner = untag_ptr(this_arg);
58052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58054         this_arg_conv.is_owned = false;
58055         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
58056         return ret_conv;
58057 }
58058
58059 jboolean  CS_LDK_ChannelTypeFeatures_requires_taproot(int64_t this_arg) {
58060         LDKChannelTypeFeatures this_arg_conv;
58061         this_arg_conv.inner = untag_ptr(this_arg);
58062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58064         this_arg_conv.is_owned = false;
58065         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
58066         return ret_conv;
58067 }
58068
58069 void  CS_LDK_InitFeatures_set_onion_messages_optional(int64_t this_arg) {
58070         LDKInitFeatures this_arg_conv;
58071         this_arg_conv.inner = untag_ptr(this_arg);
58072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58074         this_arg_conv.is_owned = false;
58075         InitFeatures_set_onion_messages_optional(&this_arg_conv);
58076 }
58077
58078 void  CS_LDK_InitFeatures_set_onion_messages_required(int64_t this_arg) {
58079         LDKInitFeatures this_arg_conv;
58080         this_arg_conv.inner = untag_ptr(this_arg);
58081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58083         this_arg_conv.is_owned = false;
58084         InitFeatures_set_onion_messages_required(&this_arg_conv);
58085 }
58086
58087 jboolean  CS_LDK_InitFeatures_supports_onion_messages(int64_t this_arg) {
58088         LDKInitFeatures this_arg_conv;
58089         this_arg_conv.inner = untag_ptr(this_arg);
58090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58092         this_arg_conv.is_owned = false;
58093         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
58094         return ret_conv;
58095 }
58096
58097 void  CS_LDK_NodeFeatures_set_onion_messages_optional(int64_t this_arg) {
58098         LDKNodeFeatures this_arg_conv;
58099         this_arg_conv.inner = untag_ptr(this_arg);
58100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58102         this_arg_conv.is_owned = false;
58103         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
58104 }
58105
58106 void  CS_LDK_NodeFeatures_set_onion_messages_required(int64_t this_arg) {
58107         LDKNodeFeatures this_arg_conv;
58108         this_arg_conv.inner = untag_ptr(this_arg);
58109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58111         this_arg_conv.is_owned = false;
58112         NodeFeatures_set_onion_messages_required(&this_arg_conv);
58113 }
58114
58115 jboolean  CS_LDK_NodeFeatures_supports_onion_messages(int64_t this_arg) {
58116         LDKNodeFeatures this_arg_conv;
58117         this_arg_conv.inner = untag_ptr(this_arg);
58118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58120         this_arg_conv.is_owned = false;
58121         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
58122         return ret_conv;
58123 }
58124
58125 jboolean  CS_LDK_InitFeatures_requires_onion_messages(int64_t this_arg) {
58126         LDKInitFeatures this_arg_conv;
58127         this_arg_conv.inner = untag_ptr(this_arg);
58128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58130         this_arg_conv.is_owned = false;
58131         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
58132         return ret_conv;
58133 }
58134
58135 jboolean  CS_LDK_NodeFeatures_requires_onion_messages(int64_t this_arg) {
58136         LDKNodeFeatures this_arg_conv;
58137         this_arg_conv.inner = untag_ptr(this_arg);
58138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58140         this_arg_conv.is_owned = false;
58141         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
58142         return ret_conv;
58143 }
58144
58145 void  CS_LDK_InitFeatures_set_channel_type_optional(int64_t this_arg) {
58146         LDKInitFeatures this_arg_conv;
58147         this_arg_conv.inner = untag_ptr(this_arg);
58148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58150         this_arg_conv.is_owned = false;
58151         InitFeatures_set_channel_type_optional(&this_arg_conv);
58152 }
58153
58154 void  CS_LDK_InitFeatures_set_channel_type_required(int64_t this_arg) {
58155         LDKInitFeatures this_arg_conv;
58156         this_arg_conv.inner = untag_ptr(this_arg);
58157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58159         this_arg_conv.is_owned = false;
58160         InitFeatures_set_channel_type_required(&this_arg_conv);
58161 }
58162
58163 jboolean  CS_LDK_InitFeatures_supports_channel_type(int64_t this_arg) {
58164         LDKInitFeatures this_arg_conv;
58165         this_arg_conv.inner = untag_ptr(this_arg);
58166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58168         this_arg_conv.is_owned = false;
58169         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
58170         return ret_conv;
58171 }
58172
58173 void  CS_LDK_NodeFeatures_set_channel_type_optional(int64_t this_arg) {
58174         LDKNodeFeatures this_arg_conv;
58175         this_arg_conv.inner = untag_ptr(this_arg);
58176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58178         this_arg_conv.is_owned = false;
58179         NodeFeatures_set_channel_type_optional(&this_arg_conv);
58180 }
58181
58182 void  CS_LDK_NodeFeatures_set_channel_type_required(int64_t this_arg) {
58183         LDKNodeFeatures this_arg_conv;
58184         this_arg_conv.inner = untag_ptr(this_arg);
58185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58187         this_arg_conv.is_owned = false;
58188         NodeFeatures_set_channel_type_required(&this_arg_conv);
58189 }
58190
58191 jboolean  CS_LDK_NodeFeatures_supports_channel_type(int64_t this_arg) {
58192         LDKNodeFeatures this_arg_conv;
58193         this_arg_conv.inner = untag_ptr(this_arg);
58194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58196         this_arg_conv.is_owned = false;
58197         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
58198         return ret_conv;
58199 }
58200
58201 jboolean  CS_LDK_InitFeatures_requires_channel_type(int64_t this_arg) {
58202         LDKInitFeatures this_arg_conv;
58203         this_arg_conv.inner = untag_ptr(this_arg);
58204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58206         this_arg_conv.is_owned = false;
58207         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
58208         return ret_conv;
58209 }
58210
58211 jboolean  CS_LDK_NodeFeatures_requires_channel_type(int64_t this_arg) {
58212         LDKNodeFeatures this_arg_conv;
58213         this_arg_conv.inner = untag_ptr(this_arg);
58214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58216         this_arg_conv.is_owned = false;
58217         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
58218         return ret_conv;
58219 }
58220
58221 void  CS_LDK_InitFeatures_set_scid_privacy_optional(int64_t this_arg) {
58222         LDKInitFeatures this_arg_conv;
58223         this_arg_conv.inner = untag_ptr(this_arg);
58224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58226         this_arg_conv.is_owned = false;
58227         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
58228 }
58229
58230 void  CS_LDK_InitFeatures_set_scid_privacy_required(int64_t this_arg) {
58231         LDKInitFeatures this_arg_conv;
58232         this_arg_conv.inner = untag_ptr(this_arg);
58233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58235         this_arg_conv.is_owned = false;
58236         InitFeatures_set_scid_privacy_required(&this_arg_conv);
58237 }
58238
58239 jboolean  CS_LDK_InitFeatures_supports_scid_privacy(int64_t this_arg) {
58240         LDKInitFeatures this_arg_conv;
58241         this_arg_conv.inner = untag_ptr(this_arg);
58242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58244         this_arg_conv.is_owned = false;
58245         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
58246         return ret_conv;
58247 }
58248
58249 void  CS_LDK_NodeFeatures_set_scid_privacy_optional(int64_t this_arg) {
58250         LDKNodeFeatures this_arg_conv;
58251         this_arg_conv.inner = untag_ptr(this_arg);
58252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58254         this_arg_conv.is_owned = false;
58255         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
58256 }
58257
58258 void  CS_LDK_NodeFeatures_set_scid_privacy_required(int64_t this_arg) {
58259         LDKNodeFeatures this_arg_conv;
58260         this_arg_conv.inner = untag_ptr(this_arg);
58261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58263         this_arg_conv.is_owned = false;
58264         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
58265 }
58266
58267 jboolean  CS_LDK_NodeFeatures_supports_scid_privacy(int64_t this_arg) {
58268         LDKNodeFeatures this_arg_conv;
58269         this_arg_conv.inner = untag_ptr(this_arg);
58270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58272         this_arg_conv.is_owned = false;
58273         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
58274         return ret_conv;
58275 }
58276
58277 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_optional(int64_t this_arg) {
58278         LDKChannelTypeFeatures this_arg_conv;
58279         this_arg_conv.inner = untag_ptr(this_arg);
58280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58282         this_arg_conv.is_owned = false;
58283         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
58284 }
58285
58286 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_required(int64_t this_arg) {
58287         LDKChannelTypeFeatures this_arg_conv;
58288         this_arg_conv.inner = untag_ptr(this_arg);
58289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58291         this_arg_conv.is_owned = false;
58292         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
58293 }
58294
58295 jboolean  CS_LDK_ChannelTypeFeatures_supports_scid_privacy(int64_t this_arg) {
58296         LDKChannelTypeFeatures this_arg_conv;
58297         this_arg_conv.inner = untag_ptr(this_arg);
58298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58300         this_arg_conv.is_owned = false;
58301         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
58302         return ret_conv;
58303 }
58304
58305 jboolean  CS_LDK_InitFeatures_requires_scid_privacy(int64_t this_arg) {
58306         LDKInitFeatures this_arg_conv;
58307         this_arg_conv.inner = untag_ptr(this_arg);
58308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58310         this_arg_conv.is_owned = false;
58311         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
58312         return ret_conv;
58313 }
58314
58315 jboolean  CS_LDK_NodeFeatures_requires_scid_privacy(int64_t this_arg) {
58316         LDKNodeFeatures this_arg_conv;
58317         this_arg_conv.inner = untag_ptr(this_arg);
58318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58320         this_arg_conv.is_owned = false;
58321         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
58322         return ret_conv;
58323 }
58324
58325 jboolean  CS_LDK_ChannelTypeFeatures_requires_scid_privacy(int64_t this_arg) {
58326         LDKChannelTypeFeatures this_arg_conv;
58327         this_arg_conv.inner = untag_ptr(this_arg);
58328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58330         this_arg_conv.is_owned = false;
58331         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
58332         return ret_conv;
58333 }
58334
58335 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_optional(int64_t this_arg) {
58336         LDKBolt11InvoiceFeatures this_arg_conv;
58337         this_arg_conv.inner = untag_ptr(this_arg);
58338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58340         this_arg_conv.is_owned = false;
58341         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
58342 }
58343
58344 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_required(int64_t this_arg) {
58345         LDKBolt11InvoiceFeatures this_arg_conv;
58346         this_arg_conv.inner = untag_ptr(this_arg);
58347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58349         this_arg_conv.is_owned = false;
58350         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
58351 }
58352
58353 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_metadata(int64_t this_arg) {
58354         LDKBolt11InvoiceFeatures this_arg_conv;
58355         this_arg_conv.inner = untag_ptr(this_arg);
58356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58358         this_arg_conv.is_owned = false;
58359         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
58360         return ret_conv;
58361 }
58362
58363 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_metadata(int64_t this_arg) {
58364         LDKBolt11InvoiceFeatures this_arg_conv;
58365         this_arg_conv.inner = untag_ptr(this_arg);
58366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58368         this_arg_conv.is_owned = false;
58369         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
58370         return ret_conv;
58371 }
58372
58373 void  CS_LDK_InitFeatures_set_zero_conf_optional(int64_t this_arg) {
58374         LDKInitFeatures this_arg_conv;
58375         this_arg_conv.inner = untag_ptr(this_arg);
58376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58378         this_arg_conv.is_owned = false;
58379         InitFeatures_set_zero_conf_optional(&this_arg_conv);
58380 }
58381
58382 void  CS_LDK_InitFeatures_set_zero_conf_required(int64_t this_arg) {
58383         LDKInitFeatures this_arg_conv;
58384         this_arg_conv.inner = untag_ptr(this_arg);
58385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58387         this_arg_conv.is_owned = false;
58388         InitFeatures_set_zero_conf_required(&this_arg_conv);
58389 }
58390
58391 jboolean  CS_LDK_InitFeatures_supports_zero_conf(int64_t this_arg) {
58392         LDKInitFeatures this_arg_conv;
58393         this_arg_conv.inner = untag_ptr(this_arg);
58394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58396         this_arg_conv.is_owned = false;
58397         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
58398         return ret_conv;
58399 }
58400
58401 void  CS_LDK_NodeFeatures_set_zero_conf_optional(int64_t this_arg) {
58402         LDKNodeFeatures this_arg_conv;
58403         this_arg_conv.inner = untag_ptr(this_arg);
58404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58406         this_arg_conv.is_owned = false;
58407         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
58408 }
58409
58410 void  CS_LDK_NodeFeatures_set_zero_conf_required(int64_t this_arg) {
58411         LDKNodeFeatures this_arg_conv;
58412         this_arg_conv.inner = untag_ptr(this_arg);
58413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58415         this_arg_conv.is_owned = false;
58416         NodeFeatures_set_zero_conf_required(&this_arg_conv);
58417 }
58418
58419 jboolean  CS_LDK_NodeFeatures_supports_zero_conf(int64_t this_arg) {
58420         LDKNodeFeatures this_arg_conv;
58421         this_arg_conv.inner = untag_ptr(this_arg);
58422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58424         this_arg_conv.is_owned = false;
58425         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
58426         return ret_conv;
58427 }
58428
58429 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_optional(int64_t this_arg) {
58430         LDKChannelTypeFeatures this_arg_conv;
58431         this_arg_conv.inner = untag_ptr(this_arg);
58432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58434         this_arg_conv.is_owned = false;
58435         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
58436 }
58437
58438 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_required(int64_t this_arg) {
58439         LDKChannelTypeFeatures this_arg_conv;
58440         this_arg_conv.inner = untag_ptr(this_arg);
58441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58443         this_arg_conv.is_owned = false;
58444         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
58445 }
58446
58447 jboolean  CS_LDK_ChannelTypeFeatures_supports_zero_conf(int64_t this_arg) {
58448         LDKChannelTypeFeatures this_arg_conv;
58449         this_arg_conv.inner = untag_ptr(this_arg);
58450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58452         this_arg_conv.is_owned = false;
58453         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
58454         return ret_conv;
58455 }
58456
58457 jboolean  CS_LDK_InitFeatures_requires_zero_conf(int64_t this_arg) {
58458         LDKInitFeatures this_arg_conv;
58459         this_arg_conv.inner = untag_ptr(this_arg);
58460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58462         this_arg_conv.is_owned = false;
58463         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
58464         return ret_conv;
58465 }
58466
58467 jboolean  CS_LDK_NodeFeatures_requires_zero_conf(int64_t this_arg) {
58468         LDKNodeFeatures this_arg_conv;
58469         this_arg_conv.inner = untag_ptr(this_arg);
58470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58472         this_arg_conv.is_owned = false;
58473         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
58474         return ret_conv;
58475 }
58476
58477 jboolean  CS_LDK_ChannelTypeFeatures_requires_zero_conf(int64_t this_arg) {
58478         LDKChannelTypeFeatures this_arg_conv;
58479         this_arg_conv.inner = untag_ptr(this_arg);
58480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58482         this_arg_conv.is_owned = false;
58483         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
58484         return ret_conv;
58485 }
58486
58487 void  CS_LDK_NodeFeatures_set_keysend_optional(int64_t this_arg) {
58488         LDKNodeFeatures this_arg_conv;
58489         this_arg_conv.inner = untag_ptr(this_arg);
58490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58492         this_arg_conv.is_owned = false;
58493         NodeFeatures_set_keysend_optional(&this_arg_conv);
58494 }
58495
58496 void  CS_LDK_NodeFeatures_set_keysend_required(int64_t this_arg) {
58497         LDKNodeFeatures this_arg_conv;
58498         this_arg_conv.inner = untag_ptr(this_arg);
58499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58501         this_arg_conv.is_owned = false;
58502         NodeFeatures_set_keysend_required(&this_arg_conv);
58503 }
58504
58505 jboolean  CS_LDK_NodeFeatures_supports_keysend(int64_t this_arg) {
58506         LDKNodeFeatures this_arg_conv;
58507         this_arg_conv.inner = untag_ptr(this_arg);
58508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58510         this_arg_conv.is_owned = false;
58511         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
58512         return ret_conv;
58513 }
58514
58515 jboolean  CS_LDK_NodeFeatures_requires_keysend(int64_t this_arg) {
58516         LDKNodeFeatures this_arg_conv;
58517         this_arg_conv.inner = untag_ptr(this_arg);
58518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58520         this_arg_conv.is_owned = false;
58521         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
58522         return ret_conv;
58523 }
58524
58525 void  CS_LDK_ShutdownScript_free(int64_t this_obj) {
58526         LDKShutdownScript this_obj_conv;
58527         this_obj_conv.inner = untag_ptr(this_obj);
58528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58530         ShutdownScript_free(this_obj_conv);
58531 }
58532
58533 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
58534         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
58535         int64_t ret_ref = 0;
58536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58538         return ret_ref;
58539 }
58540 int64_t  CS_LDK_ShutdownScript_clone_ptr(int64_t arg) {
58541         LDKShutdownScript arg_conv;
58542         arg_conv.inner = untag_ptr(arg);
58543         arg_conv.is_owned = ptr_is_owned(arg);
58544         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58545         arg_conv.is_owned = false;
58546         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
58547         return ret_conv;
58548 }
58549
58550 int64_t  CS_LDK_ShutdownScript_clone(int64_t orig) {
58551         LDKShutdownScript orig_conv;
58552         orig_conv.inner = untag_ptr(orig);
58553         orig_conv.is_owned = ptr_is_owned(orig);
58554         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58555         orig_conv.is_owned = false;
58556         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
58557         int64_t ret_ref = 0;
58558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58560         return ret_ref;
58561 }
58562
58563 jboolean  CS_LDK_ShutdownScript_eq(int64_t a, int64_t b) {
58564         LDKShutdownScript a_conv;
58565         a_conv.inner = untag_ptr(a);
58566         a_conv.is_owned = ptr_is_owned(a);
58567         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58568         a_conv.is_owned = false;
58569         LDKShutdownScript b_conv;
58570         b_conv.inner = untag_ptr(b);
58571         b_conv.is_owned = ptr_is_owned(b);
58572         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58573         b_conv.is_owned = false;
58574         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
58575         return ret_conv;
58576 }
58577
58578 void  CS_LDK_InvalidShutdownScript_free(int64_t this_obj) {
58579         LDKInvalidShutdownScript this_obj_conv;
58580         this_obj_conv.inner = untag_ptr(this_obj);
58581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58583         InvalidShutdownScript_free(this_obj_conv);
58584 }
58585
58586 int8_tArray  CS_LDK_InvalidShutdownScript_get_script(int64_t this_ptr) {
58587         LDKInvalidShutdownScript this_ptr_conv;
58588         this_ptr_conv.inner = untag_ptr(this_ptr);
58589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58591         this_ptr_conv.is_owned = false;
58592         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
58593         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58594         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58595         CVec_u8Z_free(ret_var);
58596         return ret_arr;
58597 }
58598
58599 void  CS_LDK_InvalidShutdownScript_set_script(int64_t this_ptr, int8_tArray val) {
58600         LDKInvalidShutdownScript this_ptr_conv;
58601         this_ptr_conv.inner = untag_ptr(this_ptr);
58602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58604         this_ptr_conv.is_owned = false;
58605         LDKCVec_u8Z val_ref;
58606         val_ref.datalen = val->arr_len;
58607         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58608         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
58609         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
58610 }
58611
58612 int64_t  CS_LDK_InvalidShutdownScript_new(int8_tArray script_arg) {
58613         LDKCVec_u8Z script_arg_ref;
58614         script_arg_ref.datalen = script_arg->arr_len;
58615         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58616         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
58617         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
58618         int64_t ret_ref = 0;
58619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58621         return ret_ref;
58622 }
58623
58624 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
58625         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
58626         int64_t ret_ref = 0;
58627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58629         return ret_ref;
58630 }
58631 int64_t  CS_LDK_InvalidShutdownScript_clone_ptr(int64_t arg) {
58632         LDKInvalidShutdownScript arg_conv;
58633         arg_conv.inner = untag_ptr(arg);
58634         arg_conv.is_owned = ptr_is_owned(arg);
58635         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58636         arg_conv.is_owned = false;
58637         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
58638         return ret_conv;
58639 }
58640
58641 int64_t  CS_LDK_InvalidShutdownScript_clone(int64_t orig) {
58642         LDKInvalidShutdownScript orig_conv;
58643         orig_conv.inner = untag_ptr(orig);
58644         orig_conv.is_owned = ptr_is_owned(orig);
58645         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58646         orig_conv.is_owned = false;
58647         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
58648         int64_t ret_ref = 0;
58649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58651         return ret_ref;
58652 }
58653
58654 int8_tArray  CS_LDK_ShutdownScript_write(int64_t obj) {
58655         LDKShutdownScript obj_conv;
58656         obj_conv.inner = untag_ptr(obj);
58657         obj_conv.is_owned = ptr_is_owned(obj);
58658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58659         obj_conv.is_owned = false;
58660         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
58661         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58662         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58663         CVec_u8Z_free(ret_var);
58664         return ret_arr;
58665 }
58666
58667 int64_t  CS_LDK_ShutdownScript_read(int8_tArray ser) {
58668         LDKu8slice ser_ref;
58669         ser_ref.datalen = ser->arr_len;
58670         ser_ref.data = ser->elems;
58671         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
58672         *ret_conv = ShutdownScript_read(ser_ref);
58673         FREE(ser);
58674         return tag_ptr(ret_conv, true);
58675 }
58676
58677 int64_t  CS_LDK_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
58678         uint8_t pubkey_hash_arr[20];
58679         CHECK(pubkey_hash->arr_len == 20);
58680         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
58681         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
58682         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
58683         int64_t ret_ref = 0;
58684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58686         return ret_ref;
58687 }
58688
58689 int64_t  CS_LDK_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
58690         uint8_t script_hash_arr[32];
58691         CHECK(script_hash->arr_len == 32);
58692         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
58693         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
58694         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
58695         int64_t ret_ref = 0;
58696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58698         return ret_ref;
58699 }
58700
58701 int64_t  CS_LDK_ShutdownScript_new_witness_program(int64_t witness_program) {
58702         void* witness_program_ptr = untag_ptr(witness_program);
58703         CHECK_ACCESS(witness_program_ptr);
58704         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
58705         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
58706         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
58707         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
58708         return tag_ptr(ret_conv, true);
58709 }
58710
58711 int8_tArray  CS_LDK_ShutdownScript_into_inner(int64_t this_arg) {
58712         LDKShutdownScript this_arg_conv;
58713         this_arg_conv.inner = untag_ptr(this_arg);
58714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58716         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
58717         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
58718         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58719         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58720         CVec_u8Z_free(ret_var);
58721         return ret_arr;
58722 }
58723
58724 int8_tArray  CS_LDK_ShutdownScript_as_legacy_pubkey(int64_t this_arg) {
58725         LDKShutdownScript this_arg_conv;
58726         this_arg_conv.inner = untag_ptr(this_arg);
58727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58729         this_arg_conv.is_owned = false;
58730         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58731         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
58732         return ret_arr;
58733 }
58734
58735 jboolean  CS_LDK_ShutdownScript_is_compatible(int64_t this_arg, int64_t features) {
58736         LDKShutdownScript this_arg_conv;
58737         this_arg_conv.inner = untag_ptr(this_arg);
58738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58740         this_arg_conv.is_owned = false;
58741         LDKInitFeatures features_conv;
58742         features_conv.inner = untag_ptr(features);
58743         features_conv.is_owned = ptr_is_owned(features);
58744         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58745         features_conv.is_owned = false;
58746         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
58747         return ret_conv;
58748 }
58749
58750 void  CS_LDK_Retry_free(int64_t this_ptr) {
58751         if (!ptr_is_owned(this_ptr)) return;
58752         void* this_ptr_ptr = untag_ptr(this_ptr);
58753         CHECK_ACCESS(this_ptr_ptr);
58754         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
58755         FREE(untag_ptr(this_ptr));
58756         Retry_free(this_ptr_conv);
58757 }
58758
58759 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
58760         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58761         *ret_copy = Retry_clone(arg);
58762         int64_t ret_ref = tag_ptr(ret_copy, true);
58763         return ret_ref;
58764 }
58765 int64_t  CS_LDK_Retry_clone_ptr(int64_t arg) {
58766         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
58767         int64_t ret_conv = Retry_clone_ptr(arg_conv);
58768         return ret_conv;
58769 }
58770
58771 int64_t  CS_LDK_Retry_clone(int64_t orig) {
58772         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
58773         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58774         *ret_copy = Retry_clone(orig_conv);
58775         int64_t ret_ref = tag_ptr(ret_copy, true);
58776         return ret_ref;
58777 }
58778
58779 int64_t  CS_LDK_Retry_attempts(int32_t a) {
58780         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58781         *ret_copy = Retry_attempts(a);
58782         int64_t ret_ref = tag_ptr(ret_copy, true);
58783         return ret_ref;
58784 }
58785
58786 int64_t  CS_LDK_Retry_timeout(int64_t a) {
58787         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58788         *ret_copy = Retry_timeout(a);
58789         int64_t ret_ref = tag_ptr(ret_copy, true);
58790         return ret_ref;
58791 }
58792
58793 jboolean  CS_LDK_Retry_eq(int64_t a, int64_t b) {
58794         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
58795         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
58796         jboolean ret_conv = Retry_eq(a_conv, b_conv);
58797         return ret_conv;
58798 }
58799
58800 int64_t  CS_LDK_Retry_hash(int64_t o) {
58801         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
58802         int64_t ret_conv = Retry_hash(o_conv);
58803         return ret_conv;
58804 }
58805
58806 int8_tArray  CS_LDK_Retry_write(int64_t obj) {
58807         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
58808         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
58809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58811         CVec_u8Z_free(ret_var);
58812         return ret_arr;
58813 }
58814
58815 int64_t  CS_LDK_Retry_read(int8_tArray ser) {
58816         LDKu8slice ser_ref;
58817         ser_ref.datalen = ser->arr_len;
58818         ser_ref.data = ser->elems;
58819         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
58820         *ret_conv = Retry_read(ser_ref);
58821         FREE(ser);
58822         return tag_ptr(ret_conv, true);
58823 }
58824
58825 int32_t  CS_LDK_RetryableSendFailure_clone(int64_t orig) {
58826         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
58827         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_clone(orig_conv));
58828         return ret_conv;
58829 }
58830
58831 int32_t  CS_LDK_RetryableSendFailure_payment_expired() {
58832         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_payment_expired());
58833         return ret_conv;
58834 }
58835
58836 int32_t  CS_LDK_RetryableSendFailure_route_not_found() {
58837         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_route_not_found());
58838         return ret_conv;
58839 }
58840
58841 int32_t  CS_LDK_RetryableSendFailure_duplicate_payment() {
58842         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_duplicate_payment());
58843         return ret_conv;
58844 }
58845
58846 jboolean  CS_LDK_RetryableSendFailure_eq(int64_t a, int64_t b) {
58847         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
58848         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
58849         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
58850         return ret_conv;
58851 }
58852
58853 void  CS_LDK_PaymentSendFailure_free(int64_t this_ptr) {
58854         if (!ptr_is_owned(this_ptr)) return;
58855         void* this_ptr_ptr = untag_ptr(this_ptr);
58856         CHECK_ACCESS(this_ptr_ptr);
58857         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
58858         FREE(untag_ptr(this_ptr));
58859         PaymentSendFailure_free(this_ptr_conv);
58860 }
58861
58862 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
58863         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58864         *ret_copy = PaymentSendFailure_clone(arg);
58865         int64_t ret_ref = tag_ptr(ret_copy, true);
58866         return ret_ref;
58867 }
58868 int64_t  CS_LDK_PaymentSendFailure_clone_ptr(int64_t arg) {
58869         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
58870         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
58871         return ret_conv;
58872 }
58873
58874 int64_t  CS_LDK_PaymentSendFailure_clone(int64_t orig) {
58875         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
58876         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58877         *ret_copy = PaymentSendFailure_clone(orig_conv);
58878         int64_t ret_ref = tag_ptr(ret_copy, true);
58879         return ret_ref;
58880 }
58881
58882 int64_t  CS_LDK_PaymentSendFailure_parameter_error(int64_t a) {
58883         void* a_ptr = untag_ptr(a);
58884         CHECK_ACCESS(a_ptr);
58885         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
58886         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
58887         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58888         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
58889         int64_t ret_ref = tag_ptr(ret_copy, true);
58890         return ret_ref;
58891 }
58892
58893 int64_t  CS_LDK_PaymentSendFailure_path_parameter_error(int64_tArray a) {
58894         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
58895         a_constr.datalen = a->arr_len;
58896         if (a_constr.datalen > 0)
58897                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58898         else
58899                 a_constr.data = NULL;
58900         int64_t* a_vals = a->elems;
58901         for (size_t w = 0; w < a_constr.datalen; w++) {
58902                 int64_t a_conv_22 = a_vals[w];
58903                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
58904                 CHECK_ACCESS(a_conv_22_ptr);
58905                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
58906                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
58907                 a_constr.data[w] = a_conv_22_conv;
58908         }
58909         FREE(a);
58910         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58911         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
58912         int64_t ret_ref = tag_ptr(ret_copy, true);
58913         return ret_ref;
58914 }
58915
58916 int64_t  CS_LDK_PaymentSendFailure_all_failed_resend_safe(int64_tArray a) {
58917         LDKCVec_APIErrorZ a_constr;
58918         a_constr.datalen = a->arr_len;
58919         if (a_constr.datalen > 0)
58920                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
58921         else
58922                 a_constr.data = NULL;
58923         int64_t* a_vals = a->elems;
58924         for (size_t k = 0; k < a_constr.datalen; k++) {
58925                 int64_t a_conv_10 = a_vals[k];
58926                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
58927                 CHECK_ACCESS(a_conv_10_ptr);
58928                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
58929                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
58930                 a_constr.data[k] = a_conv_10_conv;
58931         }
58932         FREE(a);
58933         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58934         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
58935         int64_t ret_ref = tag_ptr(ret_copy, true);
58936         return ret_ref;
58937 }
58938
58939 int64_t  CS_LDK_PaymentSendFailure_duplicate_payment() {
58940         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58941         *ret_copy = PaymentSendFailure_duplicate_payment();
58942         int64_t ret_ref = tag_ptr(ret_copy, true);
58943         return ret_ref;
58944 }
58945
58946 int64_t  CS_LDK_PaymentSendFailure_partial_failure(int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
58947         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
58948         results_constr.datalen = results->arr_len;
58949         if (results_constr.datalen > 0)
58950                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58951         else
58952                 results_constr.data = NULL;
58953         int64_t* results_vals = results->elems;
58954         for (size_t w = 0; w < results_constr.datalen; w++) {
58955                 int64_t results_conv_22 = results_vals[w];
58956                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
58957                 CHECK_ACCESS(results_conv_22_ptr);
58958                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
58959                 results_constr.data[w] = results_conv_22_conv;
58960         }
58961         FREE(results);
58962         LDKRouteParameters failed_paths_retry_conv;
58963         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
58964         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
58965         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
58966         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
58967         LDKThirtyTwoBytes payment_id_ref;
58968         CHECK(payment_id->arr_len == 32);
58969         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
58970         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58971         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
58972         int64_t ret_ref = tag_ptr(ret_copy, true);
58973         return ret_ref;
58974 }
58975
58976 jboolean  CS_LDK_PaymentSendFailure_eq(int64_t a, int64_t b) {
58977         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
58978         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
58979         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
58980         return ret_conv;
58981 }
58982
58983 void  CS_LDK_ProbeSendFailure_free(int64_t this_ptr) {
58984         if (!ptr_is_owned(this_ptr)) return;
58985         void* this_ptr_ptr = untag_ptr(this_ptr);
58986         CHECK_ACCESS(this_ptr_ptr);
58987         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
58988         FREE(untag_ptr(this_ptr));
58989         ProbeSendFailure_free(this_ptr_conv);
58990 }
58991
58992 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
58993         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58994         *ret_copy = ProbeSendFailure_clone(arg);
58995         int64_t ret_ref = tag_ptr(ret_copy, true);
58996         return ret_ref;
58997 }
58998 int64_t  CS_LDK_ProbeSendFailure_clone_ptr(int64_t arg) {
58999         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
59000         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
59001         return ret_conv;
59002 }
59003
59004 int64_t  CS_LDK_ProbeSendFailure_clone(int64_t orig) {
59005         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
59006         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
59007         *ret_copy = ProbeSendFailure_clone(orig_conv);
59008         int64_t ret_ref = tag_ptr(ret_copy, true);
59009         return ret_ref;
59010 }
59011
59012 int64_t  CS_LDK_ProbeSendFailure_route_not_found() {
59013         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
59014         *ret_copy = ProbeSendFailure_route_not_found();
59015         int64_t ret_ref = tag_ptr(ret_copy, true);
59016         return ret_ref;
59017 }
59018
59019 int64_t  CS_LDK_ProbeSendFailure_sending_failed(int64_t a) {
59020         void* a_ptr = untag_ptr(a);
59021         CHECK_ACCESS(a_ptr);
59022         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
59023         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
59024         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
59025         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
59026         int64_t ret_ref = tag_ptr(ret_copy, true);
59027         return ret_ref;
59028 }
59029
59030 jboolean  CS_LDK_ProbeSendFailure_eq(int64_t a, int64_t b) {
59031         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
59032         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
59033         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
59034         return ret_conv;
59035 }
59036
59037 void  CS_LDK_RecipientOnionFields_free(int64_t this_obj) {
59038         LDKRecipientOnionFields this_obj_conv;
59039         this_obj_conv.inner = untag_ptr(this_obj);
59040         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59042         RecipientOnionFields_free(this_obj_conv);
59043 }
59044
59045 int64_t  CS_LDK_RecipientOnionFields_get_payment_secret(int64_t this_ptr) {
59046         LDKRecipientOnionFields this_ptr_conv;
59047         this_ptr_conv.inner = untag_ptr(this_ptr);
59048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59050         this_ptr_conv.is_owned = false;
59051         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
59052         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
59053         int64_t ret_ref = tag_ptr(ret_copy, true);
59054         return ret_ref;
59055 }
59056
59057 void  CS_LDK_RecipientOnionFields_set_payment_secret(int64_t this_ptr, int64_t val) {
59058         LDKRecipientOnionFields this_ptr_conv;
59059         this_ptr_conv.inner = untag_ptr(this_ptr);
59060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59062         this_ptr_conv.is_owned = false;
59063         void* val_ptr = untag_ptr(val);
59064         CHECK_ACCESS(val_ptr);
59065         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
59066         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
59067         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
59068 }
59069
59070 int64_t  CS_LDK_RecipientOnionFields_get_payment_metadata(int64_t this_ptr) {
59071         LDKRecipientOnionFields this_ptr_conv;
59072         this_ptr_conv.inner = untag_ptr(this_ptr);
59073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59075         this_ptr_conv.is_owned = false;
59076         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59077         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
59078         int64_t ret_ref = tag_ptr(ret_copy, true);
59079         return ret_ref;
59080 }
59081
59082 void  CS_LDK_RecipientOnionFields_set_payment_metadata(int64_t this_ptr, int64_t val) {
59083         LDKRecipientOnionFields this_ptr_conv;
59084         this_ptr_conv.inner = untag_ptr(this_ptr);
59085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59087         this_ptr_conv.is_owned = false;
59088         void* val_ptr = untag_ptr(val);
59089         CHECK_ACCESS(val_ptr);
59090         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
59091         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
59092         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
59093 }
59094
59095 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
59096         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
59097         int64_t ret_ref = 0;
59098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59100         return ret_ref;
59101 }
59102 int64_t  CS_LDK_RecipientOnionFields_clone_ptr(int64_t arg) {
59103         LDKRecipientOnionFields arg_conv;
59104         arg_conv.inner = untag_ptr(arg);
59105         arg_conv.is_owned = ptr_is_owned(arg);
59106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59107         arg_conv.is_owned = false;
59108         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
59109         return ret_conv;
59110 }
59111
59112 int64_t  CS_LDK_RecipientOnionFields_clone(int64_t orig) {
59113         LDKRecipientOnionFields orig_conv;
59114         orig_conv.inner = untag_ptr(orig);
59115         orig_conv.is_owned = ptr_is_owned(orig);
59116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59117         orig_conv.is_owned = false;
59118         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
59119         int64_t ret_ref = 0;
59120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59122         return ret_ref;
59123 }
59124
59125 jboolean  CS_LDK_RecipientOnionFields_eq(int64_t a, int64_t b) {
59126         LDKRecipientOnionFields a_conv;
59127         a_conv.inner = untag_ptr(a);
59128         a_conv.is_owned = ptr_is_owned(a);
59129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59130         a_conv.is_owned = false;
59131         LDKRecipientOnionFields b_conv;
59132         b_conv.inner = untag_ptr(b);
59133         b_conv.is_owned = ptr_is_owned(b);
59134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59135         b_conv.is_owned = false;
59136         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
59137         return ret_conv;
59138 }
59139
59140 int8_tArray  CS_LDK_RecipientOnionFields_write(int64_t obj) {
59141         LDKRecipientOnionFields obj_conv;
59142         obj_conv.inner = untag_ptr(obj);
59143         obj_conv.is_owned = ptr_is_owned(obj);
59144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59145         obj_conv.is_owned = false;
59146         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
59147         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59148         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59149         CVec_u8Z_free(ret_var);
59150         return ret_arr;
59151 }
59152
59153 int64_t  CS_LDK_RecipientOnionFields_read(int8_tArray ser) {
59154         LDKu8slice ser_ref;
59155         ser_ref.datalen = ser->arr_len;
59156         ser_ref.data = ser->elems;
59157         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
59158         *ret_conv = RecipientOnionFields_read(ser_ref);
59159         FREE(ser);
59160         return tag_ptr(ret_conv, true);
59161 }
59162
59163 int64_t  CS_LDK_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
59164         LDKThirtyTwoBytes payment_secret_ref;
59165         CHECK(payment_secret->arr_len == 32);
59166         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
59167         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
59168         int64_t ret_ref = 0;
59169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59171         return ret_ref;
59172 }
59173
59174 int64_t  CS_LDK_RecipientOnionFields_spontaneous_empty() {
59175         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
59176         int64_t ret_ref = 0;
59177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59179         return ret_ref;
59180 }
59181
59182 int64_t  CS_LDK_RecipientOnionFields_with_custom_tlvs(int64_t this_arg, int64_tArray custom_tlvs) {
59183         LDKRecipientOnionFields this_arg_conv;
59184         this_arg_conv.inner = untag_ptr(this_arg);
59185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59187         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
59188         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
59189         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
59190         if (custom_tlvs_constr.datalen > 0)
59191                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
59192         else
59193                 custom_tlvs_constr.data = NULL;
59194         int64_t* custom_tlvs_vals = custom_tlvs->elems;
59195         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
59196                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
59197                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
59198                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
59199                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
59200                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
59201                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
59202         }
59203         FREE(custom_tlvs);
59204         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
59205         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
59206         return tag_ptr(ret_conv, true);
59207 }
59208
59209 int64_tArray  CS_LDK_RecipientOnionFields_custom_tlvs(int64_t this_arg) {
59210         LDKRecipientOnionFields this_arg_conv;
59211         this_arg_conv.inner = untag_ptr(this_arg);
59212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59214         this_arg_conv.is_owned = false;
59215         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
59216         int64_tArray ret_arr = NULL;
59217         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59218         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59219         for (size_t x = 0; x < ret_var.datalen; x++) {
59220                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
59221                 *ret_conv_23_conv = ret_var.data[x];
59222                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
59223         }
59224         
59225         FREE(ret_var.data);
59226         return ret_arr;
59227 }
59228
59229 void  CS_LDK_CustomMessageReader_free(int64_t this_ptr) {
59230         if (!ptr_is_owned(this_ptr)) return;
59231         void* this_ptr_ptr = untag_ptr(this_ptr);
59232         CHECK_ACCESS(this_ptr_ptr);
59233         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
59234         FREE(untag_ptr(this_ptr));
59235         CustomMessageReader_free(this_ptr_conv);
59236 }
59237
59238 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
59239         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
59240         *ret_ret = Type_clone(arg);
59241         return tag_ptr(ret_ret, true);
59242 }
59243 int64_t  CS_LDK_Type_clone_ptr(int64_t arg) {
59244         void* arg_ptr = untag_ptr(arg);
59245         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
59246         LDKType* arg_conv = (LDKType*)arg_ptr;
59247         int64_t ret_conv = Type_clone_ptr(arg_conv);
59248         return ret_conv;
59249 }
59250
59251 int64_t  CS_LDK_Type_clone(int64_t orig) {
59252         void* orig_ptr = untag_ptr(orig);
59253         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
59254         LDKType* orig_conv = (LDKType*)orig_ptr;
59255         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
59256         *ret_ret = Type_clone(orig_conv);
59257         return tag_ptr(ret_ret, true);
59258 }
59259
59260 void  CS_LDK_Type_free(int64_t this_ptr) {
59261         if (!ptr_is_owned(this_ptr)) return;
59262         void* this_ptr_ptr = untag_ptr(this_ptr);
59263         CHECK_ACCESS(this_ptr_ptr);
59264         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
59265         FREE(untag_ptr(this_ptr));
59266         Type_free(this_ptr_conv);
59267 }
59268
59269 void  CS_LDK_Offer_free(int64_t this_obj) {
59270         LDKOffer this_obj_conv;
59271         this_obj_conv.inner = untag_ptr(this_obj);
59272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59274         Offer_free(this_obj_conv);
59275 }
59276
59277 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
59278         LDKOffer ret_var = Offer_clone(arg);
59279         int64_t ret_ref = 0;
59280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59282         return ret_ref;
59283 }
59284 int64_t  CS_LDK_Offer_clone_ptr(int64_t arg) {
59285         LDKOffer arg_conv;
59286         arg_conv.inner = untag_ptr(arg);
59287         arg_conv.is_owned = ptr_is_owned(arg);
59288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59289         arg_conv.is_owned = false;
59290         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
59291         return ret_conv;
59292 }
59293
59294 int64_t  CS_LDK_Offer_clone(int64_t orig) {
59295         LDKOffer orig_conv;
59296         orig_conv.inner = untag_ptr(orig);
59297         orig_conv.is_owned = ptr_is_owned(orig);
59298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59299         orig_conv.is_owned = false;
59300         LDKOffer ret_var = Offer_clone(&orig_conv);
59301         int64_t ret_ref = 0;
59302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59304         return ret_ref;
59305 }
59306
59307 ptrArray  CS_LDK_Offer_chains(int64_t this_arg) {
59308         LDKOffer this_arg_conv;
59309         this_arg_conv.inner = untag_ptr(this_arg);
59310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59312         this_arg_conv.is_owned = false;
59313         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
59314         ptrArray ret_arr = NULL;
59315         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
59316         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
59317         for (size_t i = 0; i < ret_var.datalen; i++) {
59318                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
59319                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
59320                 ret_arr_ptr[i] = ret_conv_8_arr;
59321         }
59322         
59323         FREE(ret_var.data);
59324         return ret_arr;
59325 }
59326
59327 int64_t  CS_LDK_Offer_metadata(int64_t this_arg) {
59328         LDKOffer this_arg_conv;
59329         this_arg_conv.inner = untag_ptr(this_arg);
59330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59332         this_arg_conv.is_owned = false;
59333         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59334         *ret_copy = Offer_metadata(&this_arg_conv);
59335         int64_t ret_ref = tag_ptr(ret_copy, true);
59336         return ret_ref;
59337 }
59338
59339 int64_t  CS_LDK_Offer_amount(int64_t this_arg) {
59340         LDKOffer this_arg_conv;
59341         this_arg_conv.inner = untag_ptr(this_arg);
59342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59344         this_arg_conv.is_owned = false;
59345         LDKAmount ret_var = Offer_amount(&this_arg_conv);
59346         int64_t ret_ref = 0;
59347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59349         return ret_ref;
59350 }
59351
59352 int64_t  CS_LDK_Offer_description(int64_t this_arg) {
59353         LDKOffer this_arg_conv;
59354         this_arg_conv.inner = untag_ptr(this_arg);
59355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59357         this_arg_conv.is_owned = false;
59358         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
59359         int64_t ret_ref = 0;
59360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59362         return ret_ref;
59363 }
59364
59365 int64_t  CS_LDK_Offer_offer_features(int64_t this_arg) {
59366         LDKOffer this_arg_conv;
59367         this_arg_conv.inner = untag_ptr(this_arg);
59368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59370         this_arg_conv.is_owned = false;
59371         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
59372         int64_t ret_ref = 0;
59373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59375         return ret_ref;
59376 }
59377
59378 int64_t  CS_LDK_Offer_absolute_expiry(int64_t this_arg) {
59379         LDKOffer this_arg_conv;
59380         this_arg_conv.inner = untag_ptr(this_arg);
59381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59383         this_arg_conv.is_owned = false;
59384         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59385         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
59386         int64_t ret_ref = tag_ptr(ret_copy, true);
59387         return ret_ref;
59388 }
59389
59390 int64_t  CS_LDK_Offer_issuer(int64_t this_arg) {
59391         LDKOffer this_arg_conv;
59392         this_arg_conv.inner = untag_ptr(this_arg);
59393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59395         this_arg_conv.is_owned = false;
59396         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
59397         int64_t ret_ref = 0;
59398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59400         return ret_ref;
59401 }
59402
59403 int64_tArray  CS_LDK_Offer_paths(int64_t this_arg) {
59404         LDKOffer this_arg_conv;
59405         this_arg_conv.inner = untag_ptr(this_arg);
59406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59408         this_arg_conv.is_owned = false;
59409         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
59410         int64_tArray ret_arr = NULL;
59411         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59412         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59413         for (size_t n = 0; n < ret_var.datalen; n++) {
59414                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59415                 int64_t ret_conv_13_ref = 0;
59416                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59417                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59418                 ret_arr_ptr[n] = ret_conv_13_ref;
59419         }
59420         
59421         FREE(ret_var.data);
59422         return ret_arr;
59423 }
59424
59425 int64_t  CS_LDK_Offer_supported_quantity(int64_t this_arg) {
59426         LDKOffer this_arg_conv;
59427         this_arg_conv.inner = untag_ptr(this_arg);
59428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59430         this_arg_conv.is_owned = false;
59431         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
59432         int64_t ret_ref = 0;
59433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59435         return ret_ref;
59436 }
59437
59438 int8_tArray  CS_LDK_Offer_signing_pubkey(int64_t this_arg) {
59439         LDKOffer this_arg_conv;
59440         this_arg_conv.inner = untag_ptr(this_arg);
59441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59443         this_arg_conv.is_owned = false;
59444         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59445         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
59446         return ret_arr;
59447 }
59448
59449 jboolean  CS_LDK_Offer_supports_chain(int64_t this_arg, int8_tArray chain) {
59450         LDKOffer this_arg_conv;
59451         this_arg_conv.inner = untag_ptr(this_arg);
59452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59454         this_arg_conv.is_owned = false;
59455         LDKThirtyTwoBytes chain_ref;
59456         CHECK(chain->arr_len == 32);
59457         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
59458         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
59459         return ret_conv;
59460 }
59461
59462 jboolean  CS_LDK_Offer_is_expired(int64_t this_arg) {
59463         LDKOffer this_arg_conv;
59464         this_arg_conv.inner = untag_ptr(this_arg);
59465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59467         this_arg_conv.is_owned = false;
59468         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
59469         return ret_conv;
59470 }
59471
59472 jboolean  CS_LDK_Offer_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
59473         LDKOffer this_arg_conv;
59474         this_arg_conv.inner = untag_ptr(this_arg);
59475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59477         this_arg_conv.is_owned = false;
59478         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
59479         return ret_conv;
59480 }
59481
59482 jboolean  CS_LDK_Offer_is_valid_quantity(int64_t this_arg, int64_t quantity) {
59483         LDKOffer this_arg_conv;
59484         this_arg_conv.inner = untag_ptr(this_arg);
59485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59487         this_arg_conv.is_owned = false;
59488         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
59489         return ret_conv;
59490 }
59491
59492 jboolean  CS_LDK_Offer_expects_quantity(int64_t this_arg) {
59493         LDKOffer this_arg_conv;
59494         this_arg_conv.inner = untag_ptr(this_arg);
59495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59497         this_arg_conv.is_owned = false;
59498         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
59499         return ret_conv;
59500 }
59501
59502 int8_tArray  CS_LDK_Offer_write(int64_t obj) {
59503         LDKOffer obj_conv;
59504         obj_conv.inner = untag_ptr(obj);
59505         obj_conv.is_owned = ptr_is_owned(obj);
59506         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59507         obj_conv.is_owned = false;
59508         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
59509         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59510         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59511         CVec_u8Z_free(ret_var);
59512         return ret_arr;
59513 }
59514
59515 void  CS_LDK_Amount_free(int64_t this_obj) {
59516         LDKAmount this_obj_conv;
59517         this_obj_conv.inner = untag_ptr(this_obj);
59518         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59520         Amount_free(this_obj_conv);
59521 }
59522
59523 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
59524         LDKAmount ret_var = Amount_clone(arg);
59525         int64_t ret_ref = 0;
59526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59528         return ret_ref;
59529 }
59530 int64_t  CS_LDK_Amount_clone_ptr(int64_t arg) {
59531         LDKAmount arg_conv;
59532         arg_conv.inner = untag_ptr(arg);
59533         arg_conv.is_owned = ptr_is_owned(arg);
59534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59535         arg_conv.is_owned = false;
59536         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
59537         return ret_conv;
59538 }
59539
59540 int64_t  CS_LDK_Amount_clone(int64_t orig) {
59541         LDKAmount orig_conv;
59542         orig_conv.inner = untag_ptr(orig);
59543         orig_conv.is_owned = ptr_is_owned(orig);
59544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59545         orig_conv.is_owned = false;
59546         LDKAmount ret_var = Amount_clone(&orig_conv);
59547         int64_t ret_ref = 0;
59548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59550         return ret_ref;
59551 }
59552
59553 void  CS_LDK_Quantity_free(int64_t this_obj) {
59554         LDKQuantity this_obj_conv;
59555         this_obj_conv.inner = untag_ptr(this_obj);
59556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59558         Quantity_free(this_obj_conv);
59559 }
59560
59561 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
59562         LDKQuantity ret_var = Quantity_clone(arg);
59563         int64_t ret_ref = 0;
59564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59566         return ret_ref;
59567 }
59568 int64_t  CS_LDK_Quantity_clone_ptr(int64_t arg) {
59569         LDKQuantity arg_conv;
59570         arg_conv.inner = untag_ptr(arg);
59571         arg_conv.is_owned = ptr_is_owned(arg);
59572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59573         arg_conv.is_owned = false;
59574         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
59575         return ret_conv;
59576 }
59577
59578 int64_t  CS_LDK_Quantity_clone(int64_t orig) {
59579         LDKQuantity orig_conv;
59580         orig_conv.inner = untag_ptr(orig);
59581         orig_conv.is_owned = ptr_is_owned(orig);
59582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59583         orig_conv.is_owned = false;
59584         LDKQuantity ret_var = Quantity_clone(&orig_conv);
59585         int64_t ret_ref = 0;
59586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59588         return ret_ref;
59589 }
59590
59591 int64_t  CS_LDK_Offer_from_str(jstring s) {
59592         LDKStr s_conv = str_ref_to_owned_c(s);
59593         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
59594         *ret_conv = Offer_from_str(s_conv);
59595         return tag_ptr(ret_conv, true);
59596 }
59597
59598 void  CS_LDK_UnsignedBolt12Invoice_free(int64_t this_obj) {
59599         LDKUnsignedBolt12Invoice this_obj_conv;
59600         this_obj_conv.inner = untag_ptr(this_obj);
59601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59603         UnsignedBolt12Invoice_free(this_obj_conv);
59604 }
59605
59606 int64_t  CS_LDK_UnsignedBolt12Invoice_tagged_hash(int64_t this_arg) {
59607         LDKUnsignedBolt12Invoice this_arg_conv;
59608         this_arg_conv.inner = untag_ptr(this_arg);
59609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59611         this_arg_conv.is_owned = false;
59612         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
59613         int64_t ret_ref = 0;
59614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59616         return ret_ref;
59617 }
59618
59619 void  CS_LDK_Bolt12Invoice_free(int64_t this_obj) {
59620         LDKBolt12Invoice this_obj_conv;
59621         this_obj_conv.inner = untag_ptr(this_obj);
59622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59624         Bolt12Invoice_free(this_obj_conv);
59625 }
59626
59627 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
59628         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
59629         int64_t ret_ref = 0;
59630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59632         return ret_ref;
59633 }
59634 int64_t  CS_LDK_Bolt12Invoice_clone_ptr(int64_t arg) {
59635         LDKBolt12Invoice arg_conv;
59636         arg_conv.inner = untag_ptr(arg);
59637         arg_conv.is_owned = ptr_is_owned(arg);
59638         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59639         arg_conv.is_owned = false;
59640         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
59641         return ret_conv;
59642 }
59643
59644 int64_t  CS_LDK_Bolt12Invoice_clone(int64_t orig) {
59645         LDKBolt12Invoice orig_conv;
59646         orig_conv.inner = untag_ptr(orig);
59647         orig_conv.is_owned = ptr_is_owned(orig);
59648         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59649         orig_conv.is_owned = false;
59650         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
59651         int64_t ret_ref = 0;
59652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59654         return ret_ref;
59655 }
59656
59657 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_chains(int64_t this_arg) {
59658         LDKUnsignedBolt12Invoice this_arg_conv;
59659         this_arg_conv.inner = untag_ptr(this_arg);
59660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59662         this_arg_conv.is_owned = false;
59663         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59664         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
59665         int64_t ret_ref = tag_ptr(ret_copy, true);
59666         return ret_ref;
59667 }
59668
59669 int8_tArray  CS_LDK_UnsignedBolt12Invoice_chain(int64_t this_arg) {
59670         LDKUnsignedBolt12Invoice this_arg_conv;
59671         this_arg_conv.inner = untag_ptr(this_arg);
59672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59674         this_arg_conv.is_owned = false;
59675         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59676         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
59677         return ret_arr;
59678 }
59679
59680 int64_t  CS_LDK_UnsignedBolt12Invoice_metadata(int64_t this_arg) {
59681         LDKUnsignedBolt12Invoice this_arg_conv;
59682         this_arg_conv.inner = untag_ptr(this_arg);
59683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59685         this_arg_conv.is_owned = false;
59686         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59687         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
59688         int64_t ret_ref = tag_ptr(ret_copy, true);
59689         return ret_ref;
59690 }
59691
59692 int64_t  CS_LDK_UnsignedBolt12Invoice_amount(int64_t this_arg) {
59693         LDKUnsignedBolt12Invoice this_arg_conv;
59694         this_arg_conv.inner = untag_ptr(this_arg);
59695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59697         this_arg_conv.is_owned = false;
59698         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
59699         int64_t ret_ref = 0;
59700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59702         return ret_ref;
59703 }
59704
59705 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_features(int64_t this_arg) {
59706         LDKUnsignedBolt12Invoice this_arg_conv;
59707         this_arg_conv.inner = untag_ptr(this_arg);
59708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59710         this_arg_conv.is_owned = false;
59711         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
59712         int64_t ret_ref = 0;
59713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59715         return ret_ref;
59716 }
59717
59718 int64_t  CS_LDK_UnsignedBolt12Invoice_description(int64_t this_arg) {
59719         LDKUnsignedBolt12Invoice this_arg_conv;
59720         this_arg_conv.inner = untag_ptr(this_arg);
59721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59723         this_arg_conv.is_owned = false;
59724         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
59725         int64_t ret_ref = 0;
59726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59728         return ret_ref;
59729 }
59730
59731 int64_t  CS_LDK_UnsignedBolt12Invoice_absolute_expiry(int64_t this_arg) {
59732         LDKUnsignedBolt12Invoice this_arg_conv;
59733         this_arg_conv.inner = untag_ptr(this_arg);
59734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59736         this_arg_conv.is_owned = false;
59737         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59738         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
59739         int64_t ret_ref = tag_ptr(ret_copy, true);
59740         return ret_ref;
59741 }
59742
59743 int64_t  CS_LDK_UnsignedBolt12Invoice_issuer(int64_t this_arg) {
59744         LDKUnsignedBolt12Invoice this_arg_conv;
59745         this_arg_conv.inner = untag_ptr(this_arg);
59746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59748         this_arg_conv.is_owned = false;
59749         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
59750         int64_t ret_ref = 0;
59751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59753         return ret_ref;
59754 }
59755
59756 int64_tArray  CS_LDK_UnsignedBolt12Invoice_message_paths(int64_t this_arg) {
59757         LDKUnsignedBolt12Invoice this_arg_conv;
59758         this_arg_conv.inner = untag_ptr(this_arg);
59759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59761         this_arg_conv.is_owned = false;
59762         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
59763         int64_tArray ret_arr = NULL;
59764         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59765         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59766         for (size_t n = 0; n < ret_var.datalen; n++) {
59767                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59768                 int64_t ret_conv_13_ref = 0;
59769                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59770                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59771                 ret_arr_ptr[n] = ret_conv_13_ref;
59772         }
59773         
59774         FREE(ret_var.data);
59775         return ret_arr;
59776 }
59777
59778 int64_t  CS_LDK_UnsignedBolt12Invoice_supported_quantity(int64_t this_arg) {
59779         LDKUnsignedBolt12Invoice this_arg_conv;
59780         this_arg_conv.inner = untag_ptr(this_arg);
59781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59783         this_arg_conv.is_owned = false;
59784         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
59785         int64_t ret_ref = 0;
59786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59788         return ret_ref;
59789 }
59790
59791 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_metadata(int64_t this_arg) {
59792         LDKUnsignedBolt12Invoice this_arg_conv;
59793         this_arg_conv.inner = untag_ptr(this_arg);
59794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59796         this_arg_conv.is_owned = false;
59797         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
59798         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59799         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59800         return ret_arr;
59801 }
59802
59803 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_request_features(int64_t this_arg) {
59804         LDKUnsignedBolt12Invoice this_arg_conv;
59805         this_arg_conv.inner = untag_ptr(this_arg);
59806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59808         this_arg_conv.is_owned = false;
59809         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
59810         int64_t ret_ref = 0;
59811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59813         return ret_ref;
59814 }
59815
59816 int64_t  CS_LDK_UnsignedBolt12Invoice_quantity(int64_t this_arg) {
59817         LDKUnsignedBolt12Invoice this_arg_conv;
59818         this_arg_conv.inner = untag_ptr(this_arg);
59819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59821         this_arg_conv.is_owned = false;
59822         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59823         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
59824         int64_t ret_ref = tag_ptr(ret_copy, true);
59825         return ret_ref;
59826 }
59827
59828 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_id(int64_t this_arg) {
59829         LDKUnsignedBolt12Invoice this_arg_conv;
59830         this_arg_conv.inner = untag_ptr(this_arg);
59831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59833         this_arg_conv.is_owned = false;
59834         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59835         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
59836         return ret_arr;
59837 }
59838
59839 int64_t  CS_LDK_UnsignedBolt12Invoice_payer_note(int64_t this_arg) {
59840         LDKUnsignedBolt12Invoice this_arg_conv;
59841         this_arg_conv.inner = untag_ptr(this_arg);
59842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59844         this_arg_conv.is_owned = false;
59845         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
59846         int64_t ret_ref = 0;
59847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59849         return ret_ref;
59850 }
59851
59852 int64_t  CS_LDK_UnsignedBolt12Invoice_created_at(int64_t this_arg) {
59853         LDKUnsignedBolt12Invoice this_arg_conv;
59854         this_arg_conv.inner = untag_ptr(this_arg);
59855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59857         this_arg_conv.is_owned = false;
59858         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
59859         return ret_conv;
59860 }
59861
59862 int64_t  CS_LDK_UnsignedBolt12Invoice_relative_expiry(int64_t this_arg) {
59863         LDKUnsignedBolt12Invoice this_arg_conv;
59864         this_arg_conv.inner = untag_ptr(this_arg);
59865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59867         this_arg_conv.is_owned = false;
59868         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
59869         return ret_conv;
59870 }
59871
59872 jboolean  CS_LDK_UnsignedBolt12Invoice_is_expired(int64_t this_arg) {
59873         LDKUnsignedBolt12Invoice this_arg_conv;
59874         this_arg_conv.inner = untag_ptr(this_arg);
59875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59877         this_arg_conv.is_owned = false;
59878         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
59879         return ret_conv;
59880 }
59881
59882 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payment_hash(int64_t this_arg) {
59883         LDKUnsignedBolt12Invoice this_arg_conv;
59884         this_arg_conv.inner = untag_ptr(this_arg);
59885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59887         this_arg_conv.is_owned = false;
59888         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59889         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
59890         return ret_arr;
59891 }
59892
59893 int64_t  CS_LDK_UnsignedBolt12Invoice_amount_msats(int64_t this_arg) {
59894         LDKUnsignedBolt12Invoice this_arg_conv;
59895         this_arg_conv.inner = untag_ptr(this_arg);
59896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59898         this_arg_conv.is_owned = false;
59899         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
59900         return ret_conv;
59901 }
59902
59903 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_features(int64_t this_arg) {
59904         LDKUnsignedBolt12Invoice this_arg_conv;
59905         this_arg_conv.inner = untag_ptr(this_arg);
59906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59908         this_arg_conv.is_owned = false;
59909         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
59910         int64_t ret_ref = 0;
59911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59913         return ret_ref;
59914 }
59915
59916 int8_tArray  CS_LDK_UnsignedBolt12Invoice_signing_pubkey(int64_t this_arg) {
59917         LDKUnsignedBolt12Invoice this_arg_conv;
59918         this_arg_conv.inner = untag_ptr(this_arg);
59919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59921         this_arg_conv.is_owned = false;
59922         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59923         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
59924         return ret_arr;
59925 }
59926
59927 int64_t  CS_LDK_Bolt12Invoice_offer_chains(int64_t this_arg) {
59928         LDKBolt12Invoice this_arg_conv;
59929         this_arg_conv.inner = untag_ptr(this_arg);
59930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59932         this_arg_conv.is_owned = false;
59933         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59934         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
59935         int64_t ret_ref = tag_ptr(ret_copy, true);
59936         return ret_ref;
59937 }
59938
59939 int8_tArray  CS_LDK_Bolt12Invoice_chain(int64_t this_arg) {
59940         LDKBolt12Invoice this_arg_conv;
59941         this_arg_conv.inner = untag_ptr(this_arg);
59942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59944         this_arg_conv.is_owned = false;
59945         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59946         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
59947         return ret_arr;
59948 }
59949
59950 int64_t  CS_LDK_Bolt12Invoice_metadata(int64_t this_arg) {
59951         LDKBolt12Invoice this_arg_conv;
59952         this_arg_conv.inner = untag_ptr(this_arg);
59953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59955         this_arg_conv.is_owned = false;
59956         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59957         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
59958         int64_t ret_ref = tag_ptr(ret_copy, true);
59959         return ret_ref;
59960 }
59961
59962 int64_t  CS_LDK_Bolt12Invoice_amount(int64_t this_arg) {
59963         LDKBolt12Invoice this_arg_conv;
59964         this_arg_conv.inner = untag_ptr(this_arg);
59965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59967         this_arg_conv.is_owned = false;
59968         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
59969         int64_t ret_ref = 0;
59970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59972         return ret_ref;
59973 }
59974
59975 int64_t  CS_LDK_Bolt12Invoice_offer_features(int64_t this_arg) {
59976         LDKBolt12Invoice this_arg_conv;
59977         this_arg_conv.inner = untag_ptr(this_arg);
59978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59980         this_arg_conv.is_owned = false;
59981         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
59982         int64_t ret_ref = 0;
59983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59985         return ret_ref;
59986 }
59987
59988 int64_t  CS_LDK_Bolt12Invoice_description(int64_t this_arg) {
59989         LDKBolt12Invoice this_arg_conv;
59990         this_arg_conv.inner = untag_ptr(this_arg);
59991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59993         this_arg_conv.is_owned = false;
59994         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
59995         int64_t ret_ref = 0;
59996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59998         return ret_ref;
59999 }
60000
60001 int64_t  CS_LDK_Bolt12Invoice_absolute_expiry(int64_t this_arg) {
60002         LDKBolt12Invoice this_arg_conv;
60003         this_arg_conv.inner = untag_ptr(this_arg);
60004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60006         this_arg_conv.is_owned = false;
60007         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60008         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
60009         int64_t ret_ref = tag_ptr(ret_copy, true);
60010         return ret_ref;
60011 }
60012
60013 int64_t  CS_LDK_Bolt12Invoice_issuer(int64_t this_arg) {
60014         LDKBolt12Invoice this_arg_conv;
60015         this_arg_conv.inner = untag_ptr(this_arg);
60016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60018         this_arg_conv.is_owned = false;
60019         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
60020         int64_t ret_ref = 0;
60021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60023         return ret_ref;
60024 }
60025
60026 int64_tArray  CS_LDK_Bolt12Invoice_message_paths(int64_t this_arg) {
60027         LDKBolt12Invoice this_arg_conv;
60028         this_arg_conv.inner = untag_ptr(this_arg);
60029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60031         this_arg_conv.is_owned = false;
60032         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
60033         int64_tArray ret_arr = NULL;
60034         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
60035         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
60036         for (size_t n = 0; n < ret_var.datalen; n++) {
60037                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60038                 int64_t ret_conv_13_ref = 0;
60039                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60040                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60041                 ret_arr_ptr[n] = ret_conv_13_ref;
60042         }
60043         
60044         FREE(ret_var.data);
60045         return ret_arr;
60046 }
60047
60048 int64_t  CS_LDK_Bolt12Invoice_supported_quantity(int64_t this_arg) {
60049         LDKBolt12Invoice this_arg_conv;
60050         this_arg_conv.inner = untag_ptr(this_arg);
60051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60053         this_arg_conv.is_owned = false;
60054         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
60055         int64_t ret_ref = 0;
60056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60058         return ret_ref;
60059 }
60060
60061 int8_tArray  CS_LDK_Bolt12Invoice_payer_metadata(int64_t this_arg) {
60062         LDKBolt12Invoice this_arg_conv;
60063         this_arg_conv.inner = untag_ptr(this_arg);
60064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60066         this_arg_conv.is_owned = false;
60067         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
60068         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60069         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60070         return ret_arr;
60071 }
60072
60073 int64_t  CS_LDK_Bolt12Invoice_invoice_request_features(int64_t this_arg) {
60074         LDKBolt12Invoice this_arg_conv;
60075         this_arg_conv.inner = untag_ptr(this_arg);
60076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60078         this_arg_conv.is_owned = false;
60079         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
60080         int64_t ret_ref = 0;
60081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60083         return ret_ref;
60084 }
60085
60086 int64_t  CS_LDK_Bolt12Invoice_quantity(int64_t this_arg) {
60087         LDKBolt12Invoice this_arg_conv;
60088         this_arg_conv.inner = untag_ptr(this_arg);
60089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60091         this_arg_conv.is_owned = false;
60092         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60093         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
60094         int64_t ret_ref = tag_ptr(ret_copy, true);
60095         return ret_ref;
60096 }
60097
60098 int8_tArray  CS_LDK_Bolt12Invoice_payer_id(int64_t this_arg) {
60099         LDKBolt12Invoice this_arg_conv;
60100         this_arg_conv.inner = untag_ptr(this_arg);
60101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60103         this_arg_conv.is_owned = false;
60104         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60105         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
60106         return ret_arr;
60107 }
60108
60109 int64_t  CS_LDK_Bolt12Invoice_payer_note(int64_t this_arg) {
60110         LDKBolt12Invoice this_arg_conv;
60111         this_arg_conv.inner = untag_ptr(this_arg);
60112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60114         this_arg_conv.is_owned = false;
60115         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
60116         int64_t ret_ref = 0;
60117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60119         return ret_ref;
60120 }
60121
60122 int64_t  CS_LDK_Bolt12Invoice_created_at(int64_t this_arg) {
60123         LDKBolt12Invoice this_arg_conv;
60124         this_arg_conv.inner = untag_ptr(this_arg);
60125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60127         this_arg_conv.is_owned = false;
60128         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
60129         return ret_conv;
60130 }
60131
60132 int64_t  CS_LDK_Bolt12Invoice_relative_expiry(int64_t this_arg) {
60133         LDKBolt12Invoice this_arg_conv;
60134         this_arg_conv.inner = untag_ptr(this_arg);
60135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60137         this_arg_conv.is_owned = false;
60138         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
60139         return ret_conv;
60140 }
60141
60142 jboolean  CS_LDK_Bolt12Invoice_is_expired(int64_t this_arg) {
60143         LDKBolt12Invoice this_arg_conv;
60144         this_arg_conv.inner = untag_ptr(this_arg);
60145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60147         this_arg_conv.is_owned = false;
60148         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
60149         return ret_conv;
60150 }
60151
60152 int8_tArray  CS_LDK_Bolt12Invoice_payment_hash(int64_t this_arg) {
60153         LDKBolt12Invoice this_arg_conv;
60154         this_arg_conv.inner = untag_ptr(this_arg);
60155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60157         this_arg_conv.is_owned = false;
60158         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60159         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
60160         return ret_arr;
60161 }
60162
60163 int64_t  CS_LDK_Bolt12Invoice_amount_msats(int64_t this_arg) {
60164         LDKBolt12Invoice this_arg_conv;
60165         this_arg_conv.inner = untag_ptr(this_arg);
60166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60168         this_arg_conv.is_owned = false;
60169         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
60170         return ret_conv;
60171 }
60172
60173 int64_t  CS_LDK_Bolt12Invoice_invoice_features(int64_t this_arg) {
60174         LDKBolt12Invoice this_arg_conv;
60175         this_arg_conv.inner = untag_ptr(this_arg);
60176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60178         this_arg_conv.is_owned = false;
60179         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
60180         int64_t ret_ref = 0;
60181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60183         return ret_ref;
60184 }
60185
60186 int8_tArray  CS_LDK_Bolt12Invoice_signing_pubkey(int64_t this_arg) {
60187         LDKBolt12Invoice this_arg_conv;
60188         this_arg_conv.inner = untag_ptr(this_arg);
60189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60191         this_arg_conv.is_owned = false;
60192         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60193         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
60194         return ret_arr;
60195 }
60196
60197 int8_tArray  CS_LDK_Bolt12Invoice_signature(int64_t this_arg) {
60198         LDKBolt12Invoice this_arg_conv;
60199         this_arg_conv.inner = untag_ptr(this_arg);
60200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60202         this_arg_conv.is_owned = false;
60203         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60204         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
60205         return ret_arr;
60206 }
60207
60208 int8_tArray  CS_LDK_Bolt12Invoice_signable_hash(int64_t this_arg) {
60209         LDKBolt12Invoice this_arg_conv;
60210         this_arg_conv.inner = untag_ptr(this_arg);
60211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60213         this_arg_conv.is_owned = false;
60214         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60215         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
60216         return ret_arr;
60217 }
60218
60219 int64_t  CS_LDK_Bolt12Invoice_verify(int64_t this_arg, int64_t key) {
60220         LDKBolt12Invoice this_arg_conv;
60221         this_arg_conv.inner = untag_ptr(this_arg);
60222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60224         this_arg_conv.is_owned = false;
60225         LDKExpandedKey key_conv;
60226         key_conv.inner = untag_ptr(key);
60227         key_conv.is_owned = ptr_is_owned(key);
60228         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60229         key_conv.is_owned = false;
60230         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
60231         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
60232         return tag_ptr(ret_conv, true);
60233 }
60234
60235 int8_tArray  CS_LDK_UnsignedBolt12Invoice_write(int64_t obj) {
60236         LDKUnsignedBolt12Invoice obj_conv;
60237         obj_conv.inner = untag_ptr(obj);
60238         obj_conv.is_owned = ptr_is_owned(obj);
60239         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60240         obj_conv.is_owned = false;
60241         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
60242         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60243         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60244         CVec_u8Z_free(ret_var);
60245         return ret_arr;
60246 }
60247
60248 int8_tArray  CS_LDK_Bolt12Invoice_write(int64_t obj) {
60249         LDKBolt12Invoice obj_conv;
60250         obj_conv.inner = untag_ptr(obj);
60251         obj_conv.is_owned = ptr_is_owned(obj);
60252         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60253         obj_conv.is_owned = false;
60254         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
60255         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60256         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60257         CVec_u8Z_free(ret_var);
60258         return ret_arr;
60259 }
60260
60261 void  CS_LDK_BlindedPayInfo_free(int64_t this_obj) {
60262         LDKBlindedPayInfo this_obj_conv;
60263         this_obj_conv.inner = untag_ptr(this_obj);
60264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60266         BlindedPayInfo_free(this_obj_conv);
60267 }
60268
60269 int32_t  CS_LDK_BlindedPayInfo_get_fee_base_msat(int64_t this_ptr) {
60270         LDKBlindedPayInfo this_ptr_conv;
60271         this_ptr_conv.inner = untag_ptr(this_ptr);
60272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60274         this_ptr_conv.is_owned = false;
60275         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
60276         return ret_conv;
60277 }
60278
60279 void  CS_LDK_BlindedPayInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
60280         LDKBlindedPayInfo this_ptr_conv;
60281         this_ptr_conv.inner = untag_ptr(this_ptr);
60282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60284         this_ptr_conv.is_owned = false;
60285         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
60286 }
60287
60288 int32_t  CS_LDK_BlindedPayInfo_get_fee_proportional_millionths(int64_t this_ptr) {
60289         LDKBlindedPayInfo this_ptr_conv;
60290         this_ptr_conv.inner = untag_ptr(this_ptr);
60291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60293         this_ptr_conv.is_owned = false;
60294         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
60295         return ret_conv;
60296 }
60297
60298 void  CS_LDK_BlindedPayInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
60299         LDKBlindedPayInfo this_ptr_conv;
60300         this_ptr_conv.inner = untag_ptr(this_ptr);
60301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60303         this_ptr_conv.is_owned = false;
60304         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
60305 }
60306
60307 int16_t  CS_LDK_BlindedPayInfo_get_cltv_expiry_delta(int64_t this_ptr) {
60308         LDKBlindedPayInfo this_ptr_conv;
60309         this_ptr_conv.inner = untag_ptr(this_ptr);
60310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60312         this_ptr_conv.is_owned = false;
60313         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
60314         return ret_conv;
60315 }
60316
60317 void  CS_LDK_BlindedPayInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
60318         LDKBlindedPayInfo this_ptr_conv;
60319         this_ptr_conv.inner = untag_ptr(this_ptr);
60320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60322         this_ptr_conv.is_owned = false;
60323         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
60324 }
60325
60326 int64_t  CS_LDK_BlindedPayInfo_get_htlc_minimum_msat(int64_t this_ptr) {
60327         LDKBlindedPayInfo this_ptr_conv;
60328         this_ptr_conv.inner = untag_ptr(this_ptr);
60329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60331         this_ptr_conv.is_owned = false;
60332         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
60333         return ret_conv;
60334 }
60335
60336 void  CS_LDK_BlindedPayInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
60337         LDKBlindedPayInfo this_ptr_conv;
60338         this_ptr_conv.inner = untag_ptr(this_ptr);
60339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60341         this_ptr_conv.is_owned = false;
60342         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
60343 }
60344
60345 int64_t  CS_LDK_BlindedPayInfo_get_htlc_maximum_msat(int64_t this_ptr) {
60346         LDKBlindedPayInfo this_ptr_conv;
60347         this_ptr_conv.inner = untag_ptr(this_ptr);
60348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60350         this_ptr_conv.is_owned = false;
60351         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
60352         return ret_conv;
60353 }
60354
60355 void  CS_LDK_BlindedPayInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
60356         LDKBlindedPayInfo this_ptr_conv;
60357         this_ptr_conv.inner = untag_ptr(this_ptr);
60358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60360         this_ptr_conv.is_owned = false;
60361         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
60362 }
60363
60364 int64_t  CS_LDK_BlindedPayInfo_get_features(int64_t this_ptr) {
60365         LDKBlindedPayInfo this_ptr_conv;
60366         this_ptr_conv.inner = untag_ptr(this_ptr);
60367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60369         this_ptr_conv.is_owned = false;
60370         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
60371         int64_t ret_ref = 0;
60372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60374         return ret_ref;
60375 }
60376
60377 void  CS_LDK_BlindedPayInfo_set_features(int64_t this_ptr, int64_t val) {
60378         LDKBlindedPayInfo this_ptr_conv;
60379         this_ptr_conv.inner = untag_ptr(this_ptr);
60380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60382         this_ptr_conv.is_owned = false;
60383         LDKBlindedHopFeatures val_conv;
60384         val_conv.inner = untag_ptr(val);
60385         val_conv.is_owned = ptr_is_owned(val);
60386         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60387         val_conv = BlindedHopFeatures_clone(&val_conv);
60388         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
60389 }
60390
60391 int64_t  CS_LDK_BlindedPayInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t features_arg) {
60392         LDKBlindedHopFeatures features_arg_conv;
60393         features_arg_conv.inner = untag_ptr(features_arg);
60394         features_arg_conv.is_owned = ptr_is_owned(features_arg);
60395         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
60396         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
60397         LDKBlindedPayInfo ret_var = BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg_conv);
60398         int64_t ret_ref = 0;
60399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60401         return ret_ref;
60402 }
60403
60404 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
60405         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
60406         int64_t ret_ref = 0;
60407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60409         return ret_ref;
60410 }
60411 int64_t  CS_LDK_BlindedPayInfo_clone_ptr(int64_t arg) {
60412         LDKBlindedPayInfo arg_conv;
60413         arg_conv.inner = untag_ptr(arg);
60414         arg_conv.is_owned = ptr_is_owned(arg);
60415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60416         arg_conv.is_owned = false;
60417         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
60418         return ret_conv;
60419 }
60420
60421 int64_t  CS_LDK_BlindedPayInfo_clone(int64_t orig) {
60422         LDKBlindedPayInfo orig_conv;
60423         orig_conv.inner = untag_ptr(orig);
60424         orig_conv.is_owned = ptr_is_owned(orig);
60425         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60426         orig_conv.is_owned = false;
60427         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
60428         int64_t ret_ref = 0;
60429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60431         return ret_ref;
60432 }
60433
60434 int64_t  CS_LDK_BlindedPayInfo_hash(int64_t o) {
60435         LDKBlindedPayInfo o_conv;
60436         o_conv.inner = untag_ptr(o);
60437         o_conv.is_owned = ptr_is_owned(o);
60438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60439         o_conv.is_owned = false;
60440         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
60441         return ret_conv;
60442 }
60443
60444 jboolean  CS_LDK_BlindedPayInfo_eq(int64_t a, int64_t b) {
60445         LDKBlindedPayInfo a_conv;
60446         a_conv.inner = untag_ptr(a);
60447         a_conv.is_owned = ptr_is_owned(a);
60448         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60449         a_conv.is_owned = false;
60450         LDKBlindedPayInfo b_conv;
60451         b_conv.inner = untag_ptr(b);
60452         b_conv.is_owned = ptr_is_owned(b);
60453         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60454         b_conv.is_owned = false;
60455         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
60456         return ret_conv;
60457 }
60458
60459 int8_tArray  CS_LDK_BlindedPayInfo_write(int64_t obj) {
60460         LDKBlindedPayInfo obj_conv;
60461         obj_conv.inner = untag_ptr(obj);
60462         obj_conv.is_owned = ptr_is_owned(obj);
60463         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60464         obj_conv.is_owned = false;
60465         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
60466         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60467         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60468         CVec_u8Z_free(ret_var);
60469         return ret_arr;
60470 }
60471
60472 int64_t  CS_LDK_BlindedPayInfo_read(int8_tArray ser) {
60473         LDKu8slice ser_ref;
60474         ser_ref.datalen = ser->arr_len;
60475         ser_ref.data = ser->elems;
60476         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
60477         *ret_conv = BlindedPayInfo_read(ser_ref);
60478         FREE(ser);
60479         return tag_ptr(ret_conv, true);
60480 }
60481
60482 void  CS_LDK_InvoiceError_free(int64_t this_obj) {
60483         LDKInvoiceError this_obj_conv;
60484         this_obj_conv.inner = untag_ptr(this_obj);
60485         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60487         InvoiceError_free(this_obj_conv);
60488 }
60489
60490 int64_t  CS_LDK_InvoiceError_get_erroneous_field(int64_t this_ptr) {
60491         LDKInvoiceError this_ptr_conv;
60492         this_ptr_conv.inner = untag_ptr(this_ptr);
60493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60495         this_ptr_conv.is_owned = false;
60496         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
60497         int64_t ret_ref = 0;
60498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60500         return ret_ref;
60501 }
60502
60503 void  CS_LDK_InvoiceError_set_erroneous_field(int64_t this_ptr, int64_t val) {
60504         LDKInvoiceError this_ptr_conv;
60505         this_ptr_conv.inner = untag_ptr(this_ptr);
60506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60508         this_ptr_conv.is_owned = false;
60509         LDKErroneousField val_conv;
60510         val_conv.inner = untag_ptr(val);
60511         val_conv.is_owned = ptr_is_owned(val);
60512         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60513         val_conv = ErroneousField_clone(&val_conv);
60514         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
60515 }
60516
60517 int64_t  CS_LDK_InvoiceError_get_message(int64_t this_ptr) {
60518         LDKInvoiceError this_ptr_conv;
60519         this_ptr_conv.inner = untag_ptr(this_ptr);
60520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60522         this_ptr_conv.is_owned = false;
60523         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
60524         int64_t ret_ref = 0;
60525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60527         return ret_ref;
60528 }
60529
60530 void  CS_LDK_InvoiceError_set_message(int64_t this_ptr, int64_t val) {
60531         LDKInvoiceError this_ptr_conv;
60532         this_ptr_conv.inner = untag_ptr(this_ptr);
60533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60535         this_ptr_conv.is_owned = false;
60536         LDKUntrustedString val_conv;
60537         val_conv.inner = untag_ptr(val);
60538         val_conv.is_owned = ptr_is_owned(val);
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60540         val_conv = UntrustedString_clone(&val_conv);
60541         InvoiceError_set_message(&this_ptr_conv, val_conv);
60542 }
60543
60544 int64_t  CS_LDK_InvoiceError_new(int64_t erroneous_field_arg, int64_t message_arg) {
60545         LDKErroneousField erroneous_field_arg_conv;
60546         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
60547         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
60548         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
60549         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
60550         LDKUntrustedString message_arg_conv;
60551         message_arg_conv.inner = untag_ptr(message_arg);
60552         message_arg_conv.is_owned = ptr_is_owned(message_arg);
60553         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
60554         message_arg_conv = UntrustedString_clone(&message_arg_conv);
60555         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
60556         int64_t ret_ref = 0;
60557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60559         return ret_ref;
60560 }
60561
60562 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
60563         LDKInvoiceError ret_var = InvoiceError_clone(arg);
60564         int64_t ret_ref = 0;
60565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60567         return ret_ref;
60568 }
60569 int64_t  CS_LDK_InvoiceError_clone_ptr(int64_t arg) {
60570         LDKInvoiceError arg_conv;
60571         arg_conv.inner = untag_ptr(arg);
60572         arg_conv.is_owned = ptr_is_owned(arg);
60573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60574         arg_conv.is_owned = false;
60575         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
60576         return ret_conv;
60577 }
60578
60579 int64_t  CS_LDK_InvoiceError_clone(int64_t orig) {
60580         LDKInvoiceError orig_conv;
60581         orig_conv.inner = untag_ptr(orig);
60582         orig_conv.is_owned = ptr_is_owned(orig);
60583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60584         orig_conv.is_owned = false;
60585         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
60586         int64_t ret_ref = 0;
60587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60589         return ret_ref;
60590 }
60591
60592 void  CS_LDK_ErroneousField_free(int64_t this_obj) {
60593         LDKErroneousField this_obj_conv;
60594         this_obj_conv.inner = untag_ptr(this_obj);
60595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60597         ErroneousField_free(this_obj_conv);
60598 }
60599
60600 int64_t  CS_LDK_ErroneousField_get_tlv_fieldnum(int64_t this_ptr) {
60601         LDKErroneousField this_ptr_conv;
60602         this_ptr_conv.inner = untag_ptr(this_ptr);
60603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60605         this_ptr_conv.is_owned = false;
60606         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
60607         return ret_conv;
60608 }
60609
60610 void  CS_LDK_ErroneousField_set_tlv_fieldnum(int64_t this_ptr, int64_t val) {
60611         LDKErroneousField this_ptr_conv;
60612         this_ptr_conv.inner = untag_ptr(this_ptr);
60613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60615         this_ptr_conv.is_owned = false;
60616         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
60617 }
60618
60619 int64_t  CS_LDK_ErroneousField_get_suggested_value(int64_t this_ptr) {
60620         LDKErroneousField this_ptr_conv;
60621         this_ptr_conv.inner = untag_ptr(this_ptr);
60622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60624         this_ptr_conv.is_owned = false;
60625         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60626         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
60627         int64_t ret_ref = tag_ptr(ret_copy, true);
60628         return ret_ref;
60629 }
60630
60631 void  CS_LDK_ErroneousField_set_suggested_value(int64_t this_ptr, int64_t val) {
60632         LDKErroneousField this_ptr_conv;
60633         this_ptr_conv.inner = untag_ptr(this_ptr);
60634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60636         this_ptr_conv.is_owned = false;
60637         void* val_ptr = untag_ptr(val);
60638         CHECK_ACCESS(val_ptr);
60639         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
60640         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
60641         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
60642 }
60643
60644 int64_t  CS_LDK_ErroneousField_new(int64_t tlv_fieldnum_arg, int64_t suggested_value_arg) {
60645         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
60646         CHECK_ACCESS(suggested_value_arg_ptr);
60647         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
60648         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
60649         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
60650         int64_t ret_ref = 0;
60651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60653         return ret_ref;
60654 }
60655
60656 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
60657         LDKErroneousField ret_var = ErroneousField_clone(arg);
60658         int64_t ret_ref = 0;
60659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60661         return ret_ref;
60662 }
60663 int64_t  CS_LDK_ErroneousField_clone_ptr(int64_t arg) {
60664         LDKErroneousField arg_conv;
60665         arg_conv.inner = untag_ptr(arg);
60666         arg_conv.is_owned = ptr_is_owned(arg);
60667         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60668         arg_conv.is_owned = false;
60669         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
60670         return ret_conv;
60671 }
60672
60673 int64_t  CS_LDK_ErroneousField_clone(int64_t orig) {
60674         LDKErroneousField orig_conv;
60675         orig_conv.inner = untag_ptr(orig);
60676         orig_conv.is_owned = ptr_is_owned(orig);
60677         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60678         orig_conv.is_owned = false;
60679         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
60680         int64_t ret_ref = 0;
60681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60683         return ret_ref;
60684 }
60685
60686 int64_t  CS_LDK_InvoiceError_from_string(jstring s) {
60687         LDKStr s_conv = str_ref_to_owned_c(s);
60688         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
60689         int64_t ret_ref = 0;
60690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60692         return ret_ref;
60693 }
60694
60695 int8_tArray  CS_LDK_InvoiceError_write(int64_t obj) {
60696         LDKInvoiceError obj_conv;
60697         obj_conv.inner = untag_ptr(obj);
60698         obj_conv.is_owned = ptr_is_owned(obj);
60699         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60700         obj_conv.is_owned = false;
60701         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
60702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60704         CVec_u8Z_free(ret_var);
60705         return ret_arr;
60706 }
60707
60708 int64_t  CS_LDK_InvoiceError_read(int8_tArray ser) {
60709         LDKu8slice ser_ref;
60710         ser_ref.datalen = ser->arr_len;
60711         ser_ref.data = ser->elems;
60712         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
60713         *ret_conv = InvoiceError_read(ser_ref);
60714         FREE(ser);
60715         return tag_ptr(ret_conv, true);
60716 }
60717
60718 void  CS_LDK_UnsignedInvoiceRequest_free(int64_t this_obj) {
60719         LDKUnsignedInvoiceRequest this_obj_conv;
60720         this_obj_conv.inner = untag_ptr(this_obj);
60721         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60723         UnsignedInvoiceRequest_free(this_obj_conv);
60724 }
60725
60726 int64_t  CS_LDK_UnsignedInvoiceRequest_tagged_hash(int64_t this_arg) {
60727         LDKUnsignedInvoiceRequest this_arg_conv;
60728         this_arg_conv.inner = untag_ptr(this_arg);
60729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60731         this_arg_conv.is_owned = false;
60732         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
60733         int64_t ret_ref = 0;
60734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60736         return ret_ref;
60737 }
60738
60739 void  CS_LDK_InvoiceRequest_free(int64_t this_obj) {
60740         LDKInvoiceRequest this_obj_conv;
60741         this_obj_conv.inner = untag_ptr(this_obj);
60742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60744         InvoiceRequest_free(this_obj_conv);
60745 }
60746
60747 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
60748         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
60749         int64_t ret_ref = 0;
60750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60752         return ret_ref;
60753 }
60754 int64_t  CS_LDK_InvoiceRequest_clone_ptr(int64_t arg) {
60755         LDKInvoiceRequest arg_conv;
60756         arg_conv.inner = untag_ptr(arg);
60757         arg_conv.is_owned = ptr_is_owned(arg);
60758         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60759         arg_conv.is_owned = false;
60760         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
60761         return ret_conv;
60762 }
60763
60764 int64_t  CS_LDK_InvoiceRequest_clone(int64_t orig) {
60765         LDKInvoiceRequest orig_conv;
60766         orig_conv.inner = untag_ptr(orig);
60767         orig_conv.is_owned = ptr_is_owned(orig);
60768         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60769         orig_conv.is_owned = false;
60770         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
60771         int64_t ret_ref = 0;
60772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60774         return ret_ref;
60775 }
60776
60777 void  CS_LDK_VerifiedInvoiceRequest_free(int64_t this_obj) {
60778         LDKVerifiedInvoiceRequest this_obj_conv;
60779         this_obj_conv.inner = untag_ptr(this_obj);
60780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60782         VerifiedInvoiceRequest_free(this_obj_conv);
60783 }
60784
60785 int64_t  CS_LDK_VerifiedInvoiceRequest_get_keys(int64_t this_ptr) {
60786         LDKVerifiedInvoiceRequest this_ptr_conv;
60787         this_ptr_conv.inner = untag_ptr(this_ptr);
60788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60790         this_ptr_conv.is_owned = false;
60791         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
60792         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
60793         int64_t ret_ref = tag_ptr(ret_copy, true);
60794         return ret_ref;
60795 }
60796
60797 void  CS_LDK_VerifiedInvoiceRequest_set_keys(int64_t this_ptr, int64_t val) {
60798         LDKVerifiedInvoiceRequest this_ptr_conv;
60799         this_ptr_conv.inner = untag_ptr(this_ptr);
60800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60802         this_ptr_conv.is_owned = false;
60803         void* val_ptr = untag_ptr(val);
60804         CHECK_ACCESS(val_ptr);
60805         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
60806         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
60807         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
60808 }
60809
60810 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
60811         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
60812         int64_t ret_ref = 0;
60813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60815         return ret_ref;
60816 }
60817 int64_t  CS_LDK_VerifiedInvoiceRequest_clone_ptr(int64_t arg) {
60818         LDKVerifiedInvoiceRequest arg_conv;
60819         arg_conv.inner = untag_ptr(arg);
60820         arg_conv.is_owned = ptr_is_owned(arg);
60821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60822         arg_conv.is_owned = false;
60823         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
60824         return ret_conv;
60825 }
60826
60827 int64_t  CS_LDK_VerifiedInvoiceRequest_clone(int64_t orig) {
60828         LDKVerifiedInvoiceRequest orig_conv;
60829         orig_conv.inner = untag_ptr(orig);
60830         orig_conv.is_owned = ptr_is_owned(orig);
60831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60832         orig_conv.is_owned = false;
60833         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
60834         int64_t ret_ref = 0;
60835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60837         return ret_ref;
60838 }
60839
60840 ptrArray  CS_LDK_UnsignedInvoiceRequest_chains(int64_t this_arg) {
60841         LDKUnsignedInvoiceRequest this_arg_conv;
60842         this_arg_conv.inner = untag_ptr(this_arg);
60843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60845         this_arg_conv.is_owned = false;
60846         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
60847         ptrArray ret_arr = NULL;
60848         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60849         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60850         for (size_t i = 0; i < ret_var.datalen; i++) {
60851                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
60852                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
60853                 ret_arr_ptr[i] = ret_conv_8_arr;
60854         }
60855         
60856         FREE(ret_var.data);
60857         return ret_arr;
60858 }
60859
60860 int64_t  CS_LDK_UnsignedInvoiceRequest_metadata(int64_t this_arg) {
60861         LDKUnsignedInvoiceRequest this_arg_conv;
60862         this_arg_conv.inner = untag_ptr(this_arg);
60863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60865         this_arg_conv.is_owned = false;
60866         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60867         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
60868         int64_t ret_ref = tag_ptr(ret_copy, true);
60869         return ret_ref;
60870 }
60871
60872 int64_t  CS_LDK_UnsignedInvoiceRequest_amount(int64_t this_arg) {
60873         LDKUnsignedInvoiceRequest this_arg_conv;
60874         this_arg_conv.inner = untag_ptr(this_arg);
60875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60877         this_arg_conv.is_owned = false;
60878         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
60879         int64_t ret_ref = 0;
60880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60882         return ret_ref;
60883 }
60884
60885 int64_t  CS_LDK_UnsignedInvoiceRequest_description(int64_t this_arg) {
60886         LDKUnsignedInvoiceRequest this_arg_conv;
60887         this_arg_conv.inner = untag_ptr(this_arg);
60888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60890         this_arg_conv.is_owned = false;
60891         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
60892         int64_t ret_ref = 0;
60893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60895         return ret_ref;
60896 }
60897
60898 int64_t  CS_LDK_UnsignedInvoiceRequest_offer_features(int64_t this_arg) {
60899         LDKUnsignedInvoiceRequest this_arg_conv;
60900         this_arg_conv.inner = untag_ptr(this_arg);
60901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60903         this_arg_conv.is_owned = false;
60904         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
60905         int64_t ret_ref = 0;
60906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60908         return ret_ref;
60909 }
60910
60911 int64_t  CS_LDK_UnsignedInvoiceRequest_absolute_expiry(int64_t this_arg) {
60912         LDKUnsignedInvoiceRequest this_arg_conv;
60913         this_arg_conv.inner = untag_ptr(this_arg);
60914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60916         this_arg_conv.is_owned = false;
60917         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60918         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
60919         int64_t ret_ref = tag_ptr(ret_copy, true);
60920         return ret_ref;
60921 }
60922
60923 int64_t  CS_LDK_UnsignedInvoiceRequest_issuer(int64_t this_arg) {
60924         LDKUnsignedInvoiceRequest this_arg_conv;
60925         this_arg_conv.inner = untag_ptr(this_arg);
60926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60928         this_arg_conv.is_owned = false;
60929         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
60930         int64_t ret_ref = 0;
60931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60933         return ret_ref;
60934 }
60935
60936 int64_tArray  CS_LDK_UnsignedInvoiceRequest_paths(int64_t this_arg) {
60937         LDKUnsignedInvoiceRequest this_arg_conv;
60938         this_arg_conv.inner = untag_ptr(this_arg);
60939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60941         this_arg_conv.is_owned = false;
60942         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
60943         int64_tArray ret_arr = NULL;
60944         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
60945         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
60946         for (size_t n = 0; n < ret_var.datalen; n++) {
60947                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60948                 int64_t ret_conv_13_ref = 0;
60949                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60950                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60951                 ret_arr_ptr[n] = ret_conv_13_ref;
60952         }
60953         
60954         FREE(ret_var.data);
60955         return ret_arr;
60956 }
60957
60958 int64_t  CS_LDK_UnsignedInvoiceRequest_supported_quantity(int64_t this_arg) {
60959         LDKUnsignedInvoiceRequest this_arg_conv;
60960         this_arg_conv.inner = untag_ptr(this_arg);
60961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60963         this_arg_conv.is_owned = false;
60964         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
60965         int64_t ret_ref = 0;
60966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60968         return ret_ref;
60969 }
60970
60971 int8_tArray  CS_LDK_UnsignedInvoiceRequest_signing_pubkey(int64_t this_arg) {
60972         LDKUnsignedInvoiceRequest this_arg_conv;
60973         this_arg_conv.inner = untag_ptr(this_arg);
60974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60976         this_arg_conv.is_owned = false;
60977         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60978         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
60979         return ret_arr;
60980 }
60981
60982 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_metadata(int64_t this_arg) {
60983         LDKUnsignedInvoiceRequest this_arg_conv;
60984         this_arg_conv.inner = untag_ptr(this_arg);
60985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60987         this_arg_conv.is_owned = false;
60988         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
60989         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60990         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60991         return ret_arr;
60992 }
60993
60994 int8_tArray  CS_LDK_UnsignedInvoiceRequest_chain(int64_t this_arg) {
60995         LDKUnsignedInvoiceRequest this_arg_conv;
60996         this_arg_conv.inner = untag_ptr(this_arg);
60997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60999         this_arg_conv.is_owned = false;
61000         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61001         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
61002         return ret_arr;
61003 }
61004
61005 int64_t  CS_LDK_UnsignedInvoiceRequest_amount_msats(int64_t this_arg) {
61006         LDKUnsignedInvoiceRequest this_arg_conv;
61007         this_arg_conv.inner = untag_ptr(this_arg);
61008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61010         this_arg_conv.is_owned = false;
61011         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61012         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
61013         int64_t ret_ref = tag_ptr(ret_copy, true);
61014         return ret_ref;
61015 }
61016
61017 int64_t  CS_LDK_UnsignedInvoiceRequest_invoice_request_features(int64_t this_arg) {
61018         LDKUnsignedInvoiceRequest this_arg_conv;
61019         this_arg_conv.inner = untag_ptr(this_arg);
61020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61022         this_arg_conv.is_owned = false;
61023         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
61024         int64_t ret_ref = 0;
61025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61027         return ret_ref;
61028 }
61029
61030 int64_t  CS_LDK_UnsignedInvoiceRequest_quantity(int64_t this_arg) {
61031         LDKUnsignedInvoiceRequest this_arg_conv;
61032         this_arg_conv.inner = untag_ptr(this_arg);
61033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61035         this_arg_conv.is_owned = false;
61036         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61037         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
61038         int64_t ret_ref = tag_ptr(ret_copy, true);
61039         return ret_ref;
61040 }
61041
61042 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_id(int64_t this_arg) {
61043         LDKUnsignedInvoiceRequest this_arg_conv;
61044         this_arg_conv.inner = untag_ptr(this_arg);
61045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61047         this_arg_conv.is_owned = false;
61048         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61049         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61050         return ret_arr;
61051 }
61052
61053 int64_t  CS_LDK_UnsignedInvoiceRequest_payer_note(int64_t this_arg) {
61054         LDKUnsignedInvoiceRequest this_arg_conv;
61055         this_arg_conv.inner = untag_ptr(this_arg);
61056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61058         this_arg_conv.is_owned = false;
61059         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
61060         int64_t ret_ref = 0;
61061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61063         return ret_ref;
61064 }
61065
61066 ptrArray  CS_LDK_InvoiceRequest_chains(int64_t this_arg) {
61067         LDKInvoiceRequest this_arg_conv;
61068         this_arg_conv.inner = untag_ptr(this_arg);
61069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61071         this_arg_conv.is_owned = false;
61072         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
61073         ptrArray ret_arr = NULL;
61074         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
61075         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
61076         for (size_t i = 0; i < ret_var.datalen; i++) {
61077                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
61078                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
61079                 ret_arr_ptr[i] = ret_conv_8_arr;
61080         }
61081         
61082         FREE(ret_var.data);
61083         return ret_arr;
61084 }
61085
61086 int64_t  CS_LDK_InvoiceRequest_metadata(int64_t this_arg) {
61087         LDKInvoiceRequest this_arg_conv;
61088         this_arg_conv.inner = untag_ptr(this_arg);
61089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61091         this_arg_conv.is_owned = false;
61092         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61093         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
61094         int64_t ret_ref = tag_ptr(ret_copy, true);
61095         return ret_ref;
61096 }
61097
61098 int64_t  CS_LDK_InvoiceRequest_amount(int64_t this_arg) {
61099         LDKInvoiceRequest this_arg_conv;
61100         this_arg_conv.inner = untag_ptr(this_arg);
61101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61103         this_arg_conv.is_owned = false;
61104         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
61105         int64_t ret_ref = 0;
61106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61108         return ret_ref;
61109 }
61110
61111 int64_t  CS_LDK_InvoiceRequest_description(int64_t this_arg) {
61112         LDKInvoiceRequest this_arg_conv;
61113         this_arg_conv.inner = untag_ptr(this_arg);
61114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61116         this_arg_conv.is_owned = false;
61117         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
61118         int64_t ret_ref = 0;
61119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61121         return ret_ref;
61122 }
61123
61124 int64_t  CS_LDK_InvoiceRequest_offer_features(int64_t this_arg) {
61125         LDKInvoiceRequest this_arg_conv;
61126         this_arg_conv.inner = untag_ptr(this_arg);
61127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61129         this_arg_conv.is_owned = false;
61130         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
61131         int64_t ret_ref = 0;
61132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61134         return ret_ref;
61135 }
61136
61137 int64_t  CS_LDK_InvoiceRequest_absolute_expiry(int64_t this_arg) {
61138         LDKInvoiceRequest this_arg_conv;
61139         this_arg_conv.inner = untag_ptr(this_arg);
61140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61142         this_arg_conv.is_owned = false;
61143         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61144         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
61145         int64_t ret_ref = tag_ptr(ret_copy, true);
61146         return ret_ref;
61147 }
61148
61149 int64_t  CS_LDK_InvoiceRequest_issuer(int64_t this_arg) {
61150         LDKInvoiceRequest this_arg_conv;
61151         this_arg_conv.inner = untag_ptr(this_arg);
61152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61154         this_arg_conv.is_owned = false;
61155         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
61156         int64_t ret_ref = 0;
61157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61159         return ret_ref;
61160 }
61161
61162 int64_tArray  CS_LDK_InvoiceRequest_paths(int64_t this_arg) {
61163         LDKInvoiceRequest this_arg_conv;
61164         this_arg_conv.inner = untag_ptr(this_arg);
61165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61167         this_arg_conv.is_owned = false;
61168         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
61169         int64_tArray ret_arr = NULL;
61170         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
61171         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
61172         for (size_t n = 0; n < ret_var.datalen; n++) {
61173                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61174                 int64_t ret_conv_13_ref = 0;
61175                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61176                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61177                 ret_arr_ptr[n] = ret_conv_13_ref;
61178         }
61179         
61180         FREE(ret_var.data);
61181         return ret_arr;
61182 }
61183
61184 int64_t  CS_LDK_InvoiceRequest_supported_quantity(int64_t this_arg) {
61185         LDKInvoiceRequest this_arg_conv;
61186         this_arg_conv.inner = untag_ptr(this_arg);
61187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61189         this_arg_conv.is_owned = false;
61190         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
61191         int64_t ret_ref = 0;
61192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61194         return ret_ref;
61195 }
61196
61197 int8_tArray  CS_LDK_InvoiceRequest_signing_pubkey(int64_t this_arg) {
61198         LDKInvoiceRequest this_arg_conv;
61199         this_arg_conv.inner = untag_ptr(this_arg);
61200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61202         this_arg_conv.is_owned = false;
61203         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61204         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
61205         return ret_arr;
61206 }
61207
61208 int8_tArray  CS_LDK_InvoiceRequest_payer_metadata(int64_t this_arg) {
61209         LDKInvoiceRequest this_arg_conv;
61210         this_arg_conv.inner = untag_ptr(this_arg);
61211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61213         this_arg_conv.is_owned = false;
61214         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
61215         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61216         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61217         return ret_arr;
61218 }
61219
61220 int8_tArray  CS_LDK_InvoiceRequest_chain(int64_t this_arg) {
61221         LDKInvoiceRequest this_arg_conv;
61222         this_arg_conv.inner = untag_ptr(this_arg);
61223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61225         this_arg_conv.is_owned = false;
61226         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61227         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
61228         return ret_arr;
61229 }
61230
61231 int64_t  CS_LDK_InvoiceRequest_amount_msats(int64_t this_arg) {
61232         LDKInvoiceRequest this_arg_conv;
61233         this_arg_conv.inner = untag_ptr(this_arg);
61234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61236         this_arg_conv.is_owned = false;
61237         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61238         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
61239         int64_t ret_ref = tag_ptr(ret_copy, true);
61240         return ret_ref;
61241 }
61242
61243 int64_t  CS_LDK_InvoiceRequest_invoice_request_features(int64_t this_arg) {
61244         LDKInvoiceRequest this_arg_conv;
61245         this_arg_conv.inner = untag_ptr(this_arg);
61246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61248         this_arg_conv.is_owned = false;
61249         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
61250         int64_t ret_ref = 0;
61251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61253         return ret_ref;
61254 }
61255
61256 int64_t  CS_LDK_InvoiceRequest_quantity(int64_t this_arg) {
61257         LDKInvoiceRequest this_arg_conv;
61258         this_arg_conv.inner = untag_ptr(this_arg);
61259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61261         this_arg_conv.is_owned = false;
61262         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61263         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
61264         int64_t ret_ref = tag_ptr(ret_copy, true);
61265         return ret_ref;
61266 }
61267
61268 int8_tArray  CS_LDK_InvoiceRequest_payer_id(int64_t this_arg) {
61269         LDKInvoiceRequest this_arg_conv;
61270         this_arg_conv.inner = untag_ptr(this_arg);
61271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61273         this_arg_conv.is_owned = false;
61274         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61275         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61276         return ret_arr;
61277 }
61278
61279 int64_t  CS_LDK_InvoiceRequest_payer_note(int64_t this_arg) {
61280         LDKInvoiceRequest this_arg_conv;
61281         this_arg_conv.inner = untag_ptr(this_arg);
61282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61284         this_arg_conv.is_owned = false;
61285         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
61286         int64_t ret_ref = 0;
61287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61289         return ret_ref;
61290 }
61291
61292 int8_tArray  CS_LDK_InvoiceRequest_signature(int64_t this_arg) {
61293         LDKInvoiceRequest this_arg_conv;
61294         this_arg_conv.inner = untag_ptr(this_arg);
61295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61297         this_arg_conv.is_owned = false;
61298         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
61299         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
61300         return ret_arr;
61301 }
61302
61303 int64_t  CS_LDK_InvoiceRequest_verify(int64_t this_arg, int64_t key) {
61304         LDKInvoiceRequest this_arg_conv;
61305         this_arg_conv.inner = untag_ptr(this_arg);
61306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61308         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
61309         LDKExpandedKey key_conv;
61310         key_conv.inner = untag_ptr(key);
61311         key_conv.is_owned = ptr_is_owned(key);
61312         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
61313         key_conv.is_owned = false;
61314         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
61315         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
61316         return tag_ptr(ret_conv, true);
61317 }
61318
61319 ptrArray  CS_LDK_VerifiedInvoiceRequest_chains(int64_t this_arg) {
61320         LDKVerifiedInvoiceRequest this_arg_conv;
61321         this_arg_conv.inner = untag_ptr(this_arg);
61322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61324         this_arg_conv.is_owned = false;
61325         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
61326         ptrArray ret_arr = NULL;
61327         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
61328         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
61329         for (size_t i = 0; i < ret_var.datalen; i++) {
61330                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
61331                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
61332                 ret_arr_ptr[i] = ret_conv_8_arr;
61333         }
61334         
61335         FREE(ret_var.data);
61336         return ret_arr;
61337 }
61338
61339 int64_t  CS_LDK_VerifiedInvoiceRequest_metadata(int64_t this_arg) {
61340         LDKVerifiedInvoiceRequest this_arg_conv;
61341         this_arg_conv.inner = untag_ptr(this_arg);
61342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61344         this_arg_conv.is_owned = false;
61345         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61346         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
61347         int64_t ret_ref = tag_ptr(ret_copy, true);
61348         return ret_ref;
61349 }
61350
61351 int64_t  CS_LDK_VerifiedInvoiceRequest_amount(int64_t this_arg) {
61352         LDKVerifiedInvoiceRequest this_arg_conv;
61353         this_arg_conv.inner = untag_ptr(this_arg);
61354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61356         this_arg_conv.is_owned = false;
61357         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
61358         int64_t ret_ref = 0;
61359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61361         return ret_ref;
61362 }
61363
61364 int64_t  CS_LDK_VerifiedInvoiceRequest_description(int64_t this_arg) {
61365         LDKVerifiedInvoiceRequest this_arg_conv;
61366         this_arg_conv.inner = untag_ptr(this_arg);
61367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61369         this_arg_conv.is_owned = false;
61370         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
61371         int64_t ret_ref = 0;
61372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61374         return ret_ref;
61375 }
61376
61377 int64_t  CS_LDK_VerifiedInvoiceRequest_offer_features(int64_t this_arg) {
61378         LDKVerifiedInvoiceRequest this_arg_conv;
61379         this_arg_conv.inner = untag_ptr(this_arg);
61380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61382         this_arg_conv.is_owned = false;
61383         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
61384         int64_t ret_ref = 0;
61385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61387         return ret_ref;
61388 }
61389
61390 int64_t  CS_LDK_VerifiedInvoiceRequest_absolute_expiry(int64_t this_arg) {
61391         LDKVerifiedInvoiceRequest this_arg_conv;
61392         this_arg_conv.inner = untag_ptr(this_arg);
61393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61395         this_arg_conv.is_owned = false;
61396         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61397         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
61398         int64_t ret_ref = tag_ptr(ret_copy, true);
61399         return ret_ref;
61400 }
61401
61402 int64_t  CS_LDK_VerifiedInvoiceRequest_issuer(int64_t this_arg) {
61403         LDKVerifiedInvoiceRequest this_arg_conv;
61404         this_arg_conv.inner = untag_ptr(this_arg);
61405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61407         this_arg_conv.is_owned = false;
61408         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
61409         int64_t ret_ref = 0;
61410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61412         return ret_ref;
61413 }
61414
61415 int64_tArray  CS_LDK_VerifiedInvoiceRequest_paths(int64_t this_arg) {
61416         LDKVerifiedInvoiceRequest this_arg_conv;
61417         this_arg_conv.inner = untag_ptr(this_arg);
61418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61420         this_arg_conv.is_owned = false;
61421         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
61422         int64_tArray ret_arr = NULL;
61423         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
61424         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
61425         for (size_t n = 0; n < ret_var.datalen; n++) {
61426                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61427                 int64_t ret_conv_13_ref = 0;
61428                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61429                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61430                 ret_arr_ptr[n] = ret_conv_13_ref;
61431         }
61432         
61433         FREE(ret_var.data);
61434         return ret_arr;
61435 }
61436
61437 int64_t  CS_LDK_VerifiedInvoiceRequest_supported_quantity(int64_t this_arg) {
61438         LDKVerifiedInvoiceRequest this_arg_conv;
61439         this_arg_conv.inner = untag_ptr(this_arg);
61440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61442         this_arg_conv.is_owned = false;
61443         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
61444         int64_t ret_ref = 0;
61445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61447         return ret_ref;
61448 }
61449
61450 int8_tArray  CS_LDK_VerifiedInvoiceRequest_signing_pubkey(int64_t this_arg) {
61451         LDKVerifiedInvoiceRequest this_arg_conv;
61452         this_arg_conv.inner = untag_ptr(this_arg);
61453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61455         this_arg_conv.is_owned = false;
61456         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61457         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
61458         return ret_arr;
61459 }
61460
61461 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_metadata(int64_t this_arg) {
61462         LDKVerifiedInvoiceRequest this_arg_conv;
61463         this_arg_conv.inner = untag_ptr(this_arg);
61464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61466         this_arg_conv.is_owned = false;
61467         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
61468         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61469         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61470         return ret_arr;
61471 }
61472
61473 int8_tArray  CS_LDK_VerifiedInvoiceRequest_chain(int64_t this_arg) {
61474         LDKVerifiedInvoiceRequest this_arg_conv;
61475         this_arg_conv.inner = untag_ptr(this_arg);
61476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61478         this_arg_conv.is_owned = false;
61479         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61480         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
61481         return ret_arr;
61482 }
61483
61484 int64_t  CS_LDK_VerifiedInvoiceRequest_amount_msats(int64_t this_arg) {
61485         LDKVerifiedInvoiceRequest this_arg_conv;
61486         this_arg_conv.inner = untag_ptr(this_arg);
61487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61489         this_arg_conv.is_owned = false;
61490         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61491         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
61492         int64_t ret_ref = tag_ptr(ret_copy, true);
61493         return ret_ref;
61494 }
61495
61496 int64_t  CS_LDK_VerifiedInvoiceRequest_invoice_request_features(int64_t this_arg) {
61497         LDKVerifiedInvoiceRequest this_arg_conv;
61498         this_arg_conv.inner = untag_ptr(this_arg);
61499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61501         this_arg_conv.is_owned = false;
61502         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
61503         int64_t ret_ref = 0;
61504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61506         return ret_ref;
61507 }
61508
61509 int64_t  CS_LDK_VerifiedInvoiceRequest_quantity(int64_t this_arg) {
61510         LDKVerifiedInvoiceRequest this_arg_conv;
61511         this_arg_conv.inner = untag_ptr(this_arg);
61512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61514         this_arg_conv.is_owned = false;
61515         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61516         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
61517         int64_t ret_ref = tag_ptr(ret_copy, true);
61518         return ret_ref;
61519 }
61520
61521 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_id(int64_t this_arg) {
61522         LDKVerifiedInvoiceRequest this_arg_conv;
61523         this_arg_conv.inner = untag_ptr(this_arg);
61524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61526         this_arg_conv.is_owned = false;
61527         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61528         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61529         return ret_arr;
61530 }
61531
61532 int64_t  CS_LDK_VerifiedInvoiceRequest_payer_note(int64_t this_arg) {
61533         LDKVerifiedInvoiceRequest this_arg_conv;
61534         this_arg_conv.inner = untag_ptr(this_arg);
61535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61537         this_arg_conv.is_owned = false;
61538         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
61539         int64_t ret_ref = 0;
61540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61542         return ret_ref;
61543 }
61544
61545 int8_tArray  CS_LDK_UnsignedInvoiceRequest_write(int64_t obj) {
61546         LDKUnsignedInvoiceRequest obj_conv;
61547         obj_conv.inner = untag_ptr(obj);
61548         obj_conv.is_owned = ptr_is_owned(obj);
61549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61550         obj_conv.is_owned = false;
61551         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
61552         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61553         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61554         CVec_u8Z_free(ret_var);
61555         return ret_arr;
61556 }
61557
61558 int8_tArray  CS_LDK_InvoiceRequest_write(int64_t obj) {
61559         LDKInvoiceRequest obj_conv;
61560         obj_conv.inner = untag_ptr(obj);
61561         obj_conv.is_owned = ptr_is_owned(obj);
61562         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61563         obj_conv.is_owned = false;
61564         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
61565         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61566         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61567         CVec_u8Z_free(ret_var);
61568         return ret_arr;
61569 }
61570
61571 void  CS_LDK_TaggedHash_free(int64_t this_obj) {
61572         LDKTaggedHash this_obj_conv;
61573         this_obj_conv.inner = untag_ptr(this_obj);
61574         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61576         TaggedHash_free(this_obj_conv);
61577 }
61578
61579 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
61580         LDKTaggedHash ret_var = TaggedHash_clone(arg);
61581         int64_t ret_ref = 0;
61582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61584         return ret_ref;
61585 }
61586 int64_t  CS_LDK_TaggedHash_clone_ptr(int64_t arg) {
61587         LDKTaggedHash arg_conv;
61588         arg_conv.inner = untag_ptr(arg);
61589         arg_conv.is_owned = ptr_is_owned(arg);
61590         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61591         arg_conv.is_owned = false;
61592         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
61593         return ret_conv;
61594 }
61595
61596 int64_t  CS_LDK_TaggedHash_clone(int64_t orig) {
61597         LDKTaggedHash orig_conv;
61598         orig_conv.inner = untag_ptr(orig);
61599         orig_conv.is_owned = ptr_is_owned(orig);
61600         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61601         orig_conv.is_owned = false;
61602         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
61603         int64_t ret_ref = 0;
61604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61606         return ret_ref;
61607 }
61608
61609 int8_tArray  CS_LDK_TaggedHash_as_digest(int64_t this_arg) {
61610         LDKTaggedHash this_arg_conv;
61611         this_arg_conv.inner = untag_ptr(this_arg);
61612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61614         this_arg_conv.is_owned = false;
61615         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61616         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
61617         return ret_arr;
61618 }
61619
61620 jstring  CS_LDK_TaggedHash_tag(int64_t this_arg) {
61621         LDKTaggedHash this_arg_conv;
61622         this_arg_conv.inner = untag_ptr(this_arg);
61623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61625         this_arg_conv.is_owned = false;
61626         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
61627         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
61628         Str_free(ret_str);
61629         return ret_conv;
61630 }
61631
61632 int8_tArray  CS_LDK_TaggedHash_merkle_root(int64_t this_arg) {
61633         LDKTaggedHash this_arg_conv;
61634         this_arg_conv.inner = untag_ptr(this_arg);
61635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61637         this_arg_conv.is_owned = false;
61638         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61639         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
61640         return ret_arr;
61641 }
61642
61643 void  CS_LDK_Bolt12ParseError_free(int64_t this_obj) {
61644         LDKBolt12ParseError this_obj_conv;
61645         this_obj_conv.inner = untag_ptr(this_obj);
61646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61648         Bolt12ParseError_free(this_obj_conv);
61649 }
61650
61651 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
61652         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
61653         int64_t ret_ref = 0;
61654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61656         return ret_ref;
61657 }
61658 int64_t  CS_LDK_Bolt12ParseError_clone_ptr(int64_t arg) {
61659         LDKBolt12ParseError arg_conv;
61660         arg_conv.inner = untag_ptr(arg);
61661         arg_conv.is_owned = ptr_is_owned(arg);
61662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61663         arg_conv.is_owned = false;
61664         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
61665         return ret_conv;
61666 }
61667
61668 int64_t  CS_LDK_Bolt12ParseError_clone(int64_t orig) {
61669         LDKBolt12ParseError orig_conv;
61670         orig_conv.inner = untag_ptr(orig);
61671         orig_conv.is_owned = ptr_is_owned(orig);
61672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61673         orig_conv.is_owned = false;
61674         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
61675         int64_t ret_ref = 0;
61676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61678         return ret_ref;
61679 }
61680
61681 int32_t  CS_LDK_Bolt12SemanticError_clone(int64_t orig) {
61682         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
61683         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_clone(orig_conv));
61684         return ret_conv;
61685 }
61686
61687 int32_t  CS_LDK_Bolt12SemanticError_already_expired() {
61688         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_already_expired());
61689         return ret_conv;
61690 }
61691
61692 int32_t  CS_LDK_Bolt12SemanticError_unsupported_chain() {
61693         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_chain());
61694         return ret_conv;
61695 }
61696
61697 int32_t  CS_LDK_Bolt12SemanticError_unexpected_chain() {
61698         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_chain());
61699         return ret_conv;
61700 }
61701
61702 int32_t  CS_LDK_Bolt12SemanticError_missing_amount() {
61703         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_amount());
61704         return ret_conv;
61705 }
61706
61707 int32_t  CS_LDK_Bolt12SemanticError_invalid_amount() {
61708         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_amount());
61709         return ret_conv;
61710 }
61711
61712 int32_t  CS_LDK_Bolt12SemanticError_insufficient_amount() {
61713         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_insufficient_amount());
61714         return ret_conv;
61715 }
61716
61717 int32_t  CS_LDK_Bolt12SemanticError_unexpected_amount() {
61718         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_amount());
61719         return ret_conv;
61720 }
61721
61722 int32_t  CS_LDK_Bolt12SemanticError_unsupported_currency() {
61723         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_currency());
61724         return ret_conv;
61725 }
61726
61727 int32_t  CS_LDK_Bolt12SemanticError_unknown_required_features() {
61728         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unknown_required_features());
61729         return ret_conv;
61730 }
61731
61732 int32_t  CS_LDK_Bolt12SemanticError_unexpected_features() {
61733         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_features());
61734         return ret_conv;
61735 }
61736
61737 int32_t  CS_LDK_Bolt12SemanticError_missing_description() {
61738         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_description());
61739         return ret_conv;
61740 }
61741
61742 int32_t  CS_LDK_Bolt12SemanticError_missing_signing_pubkey() {
61743         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signing_pubkey());
61744         return ret_conv;
61745 }
61746
61747 int32_t  CS_LDK_Bolt12SemanticError_invalid_signing_pubkey() {
61748         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_signing_pubkey());
61749         return ret_conv;
61750 }
61751
61752 int32_t  CS_LDK_Bolt12SemanticError_unexpected_signing_pubkey() {
61753         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_signing_pubkey());
61754         return ret_conv;
61755 }
61756
61757 int32_t  CS_LDK_Bolt12SemanticError_missing_quantity() {
61758         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_quantity());
61759         return ret_conv;
61760 }
61761
61762 int32_t  CS_LDK_Bolt12SemanticError_invalid_quantity() {
61763         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_quantity());
61764         return ret_conv;
61765 }
61766
61767 int32_t  CS_LDK_Bolt12SemanticError_unexpected_quantity() {
61768         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_quantity());
61769         return ret_conv;
61770 }
61771
61772 int32_t  CS_LDK_Bolt12SemanticError_invalid_metadata() {
61773         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_metadata());
61774         return ret_conv;
61775 }
61776
61777 int32_t  CS_LDK_Bolt12SemanticError_unexpected_metadata() {
61778         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_metadata());
61779         return ret_conv;
61780 }
61781
61782 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_metadata() {
61783         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_metadata());
61784         return ret_conv;
61785 }
61786
61787 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_id() {
61788         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_id());
61789         return ret_conv;
61790 }
61791
61792 int32_t  CS_LDK_Bolt12SemanticError_duplicate_payment_id() {
61793         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_duplicate_payment_id());
61794         return ret_conv;
61795 }
61796
61797 int32_t  CS_LDK_Bolt12SemanticError_missing_paths() {
61798         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_paths());
61799         return ret_conv;
61800 }
61801
61802 int32_t  CS_LDK_Bolt12SemanticError_invalid_pay_info() {
61803         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_pay_info());
61804         return ret_conv;
61805 }
61806
61807 int32_t  CS_LDK_Bolt12SemanticError_missing_creation_time() {
61808         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_creation_time());
61809         return ret_conv;
61810 }
61811
61812 int32_t  CS_LDK_Bolt12SemanticError_missing_payment_hash() {
61813         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payment_hash());
61814         return ret_conv;
61815 }
61816
61817 int32_t  CS_LDK_Bolt12SemanticError_missing_signature() {
61818         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signature());
61819         return ret_conv;
61820 }
61821
61822 void  CS_LDK_Refund_free(int64_t this_obj) {
61823         LDKRefund this_obj_conv;
61824         this_obj_conv.inner = untag_ptr(this_obj);
61825         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61827         Refund_free(this_obj_conv);
61828 }
61829
61830 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
61831         LDKRefund ret_var = Refund_clone(arg);
61832         int64_t ret_ref = 0;
61833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61835         return ret_ref;
61836 }
61837 int64_t  CS_LDK_Refund_clone_ptr(int64_t arg) {
61838         LDKRefund arg_conv;
61839         arg_conv.inner = untag_ptr(arg);
61840         arg_conv.is_owned = ptr_is_owned(arg);
61841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61842         arg_conv.is_owned = false;
61843         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
61844         return ret_conv;
61845 }
61846
61847 int64_t  CS_LDK_Refund_clone(int64_t orig) {
61848         LDKRefund orig_conv;
61849         orig_conv.inner = untag_ptr(orig);
61850         orig_conv.is_owned = ptr_is_owned(orig);
61851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61852         orig_conv.is_owned = false;
61853         LDKRefund ret_var = Refund_clone(&orig_conv);
61854         int64_t ret_ref = 0;
61855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61857         return ret_ref;
61858 }
61859
61860 int64_t  CS_LDK_Refund_description(int64_t this_arg) {
61861         LDKRefund this_arg_conv;
61862         this_arg_conv.inner = untag_ptr(this_arg);
61863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61865         this_arg_conv.is_owned = false;
61866         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
61867         int64_t ret_ref = 0;
61868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61870         return ret_ref;
61871 }
61872
61873 int64_t  CS_LDK_Refund_absolute_expiry(int64_t this_arg) {
61874         LDKRefund this_arg_conv;
61875         this_arg_conv.inner = untag_ptr(this_arg);
61876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61878         this_arg_conv.is_owned = false;
61879         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61880         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
61881         int64_t ret_ref = tag_ptr(ret_copy, true);
61882         return ret_ref;
61883 }
61884
61885 jboolean  CS_LDK_Refund_is_expired(int64_t this_arg) {
61886         LDKRefund this_arg_conv;
61887         this_arg_conv.inner = untag_ptr(this_arg);
61888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61890         this_arg_conv.is_owned = false;
61891         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
61892         return ret_conv;
61893 }
61894
61895 jboolean  CS_LDK_Refund_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
61896         LDKRefund this_arg_conv;
61897         this_arg_conv.inner = untag_ptr(this_arg);
61898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61900         this_arg_conv.is_owned = false;
61901         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
61902         return ret_conv;
61903 }
61904
61905 int64_t  CS_LDK_Refund_issuer(int64_t this_arg) {
61906         LDKRefund this_arg_conv;
61907         this_arg_conv.inner = untag_ptr(this_arg);
61908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61910         this_arg_conv.is_owned = false;
61911         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
61912         int64_t ret_ref = 0;
61913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61915         return ret_ref;
61916 }
61917
61918 int64_tArray  CS_LDK_Refund_paths(int64_t this_arg) {
61919         LDKRefund this_arg_conv;
61920         this_arg_conv.inner = untag_ptr(this_arg);
61921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61923         this_arg_conv.is_owned = false;
61924         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
61925         int64_tArray ret_arr = NULL;
61926         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
61927         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
61928         for (size_t n = 0; n < ret_var.datalen; n++) {
61929                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61930                 int64_t ret_conv_13_ref = 0;
61931                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61932                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61933                 ret_arr_ptr[n] = ret_conv_13_ref;
61934         }
61935         
61936         FREE(ret_var.data);
61937         return ret_arr;
61938 }
61939
61940 int8_tArray  CS_LDK_Refund_payer_metadata(int64_t this_arg) {
61941         LDKRefund this_arg_conv;
61942         this_arg_conv.inner = untag_ptr(this_arg);
61943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61945         this_arg_conv.is_owned = false;
61946         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
61947         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61948         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61949         return ret_arr;
61950 }
61951
61952 int8_tArray  CS_LDK_Refund_chain(int64_t this_arg) {
61953         LDKRefund this_arg_conv;
61954         this_arg_conv.inner = untag_ptr(this_arg);
61955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61957         this_arg_conv.is_owned = false;
61958         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61959         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
61960         return ret_arr;
61961 }
61962
61963 int64_t  CS_LDK_Refund_amount_msats(int64_t this_arg) {
61964         LDKRefund this_arg_conv;
61965         this_arg_conv.inner = untag_ptr(this_arg);
61966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61968         this_arg_conv.is_owned = false;
61969         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
61970         return ret_conv;
61971 }
61972
61973 int64_t  CS_LDK_Refund_features(int64_t this_arg) {
61974         LDKRefund this_arg_conv;
61975         this_arg_conv.inner = untag_ptr(this_arg);
61976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61978         this_arg_conv.is_owned = false;
61979         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
61980         int64_t ret_ref = 0;
61981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61983         return ret_ref;
61984 }
61985
61986 int64_t  CS_LDK_Refund_quantity(int64_t this_arg) {
61987         LDKRefund this_arg_conv;
61988         this_arg_conv.inner = untag_ptr(this_arg);
61989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61991         this_arg_conv.is_owned = false;
61992         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61993         *ret_copy = Refund_quantity(&this_arg_conv);
61994         int64_t ret_ref = tag_ptr(ret_copy, true);
61995         return ret_ref;
61996 }
61997
61998 int8_tArray  CS_LDK_Refund_payer_id(int64_t this_arg) {
61999         LDKRefund this_arg_conv;
62000         this_arg_conv.inner = untag_ptr(this_arg);
62001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62003         this_arg_conv.is_owned = false;
62004         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62005         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
62006         return ret_arr;
62007 }
62008
62009 int64_t  CS_LDK_Refund_payer_note(int64_t this_arg) {
62010         LDKRefund this_arg_conv;
62011         this_arg_conv.inner = untag_ptr(this_arg);
62012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62014         this_arg_conv.is_owned = false;
62015         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
62016         int64_t ret_ref = 0;
62017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62019         return ret_ref;
62020 }
62021
62022 int8_tArray  CS_LDK_Refund_write(int64_t obj) {
62023         LDKRefund obj_conv;
62024         obj_conv.inner = untag_ptr(obj);
62025         obj_conv.is_owned = ptr_is_owned(obj);
62026         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62027         obj_conv.is_owned = false;
62028         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
62029         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62030         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62031         CVec_u8Z_free(ret_var);
62032         return ret_arr;
62033 }
62034
62035 int64_t  CS_LDK_Refund_from_str(jstring s) {
62036         LDKStr s_conv = str_ref_to_owned_c(s);
62037         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
62038         *ret_conv = Refund_from_str(s_conv);
62039         return tag_ptr(ret_conv, true);
62040 }
62041
62042 int32_t  CS_LDK_UtxoLookupError_clone(int64_t orig) {
62043         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
62044         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_clone(orig_conv));
62045         return ret_conv;
62046 }
62047
62048 int32_t  CS_LDK_UtxoLookupError_unknown_chain() {
62049         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_chain());
62050         return ret_conv;
62051 }
62052
62053 int32_t  CS_LDK_UtxoLookupError_unknown_tx() {
62054         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_tx());
62055         return ret_conv;
62056 }
62057
62058 void  CS_LDK_UtxoResult_free(int64_t this_ptr) {
62059         if (!ptr_is_owned(this_ptr)) return;
62060         void* this_ptr_ptr = untag_ptr(this_ptr);
62061         CHECK_ACCESS(this_ptr_ptr);
62062         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
62063         FREE(untag_ptr(this_ptr));
62064         UtxoResult_free(this_ptr_conv);
62065 }
62066
62067 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
62068         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62069         *ret_copy = UtxoResult_clone(arg);
62070         int64_t ret_ref = tag_ptr(ret_copy, true);
62071         return ret_ref;
62072 }
62073 int64_t  CS_LDK_UtxoResult_clone_ptr(int64_t arg) {
62074         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
62075         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
62076         return ret_conv;
62077 }
62078
62079 int64_t  CS_LDK_UtxoResult_clone(int64_t orig) {
62080         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
62081         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62082         *ret_copy = UtxoResult_clone(orig_conv);
62083         int64_t ret_ref = tag_ptr(ret_copy, true);
62084         return ret_ref;
62085 }
62086
62087 int64_t  CS_LDK_UtxoResult_sync(int64_t a) {
62088         void* a_ptr = untag_ptr(a);
62089         CHECK_ACCESS(a_ptr);
62090         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
62091         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
62092         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62093         *ret_copy = UtxoResult_sync(a_conv);
62094         int64_t ret_ref = tag_ptr(ret_copy, true);
62095         return ret_ref;
62096 }
62097
62098 int64_t  CS_LDK_UtxoResult_async(int64_t a) {
62099         LDKUtxoFuture a_conv;
62100         a_conv.inner = untag_ptr(a);
62101         a_conv.is_owned = ptr_is_owned(a);
62102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62103         a_conv = UtxoFuture_clone(&a_conv);
62104         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62105         *ret_copy = UtxoResult_async(a_conv);
62106         int64_t ret_ref = tag_ptr(ret_copy, true);
62107         return ret_ref;
62108 }
62109
62110 void  CS_LDK_UtxoLookup_free(int64_t this_ptr) {
62111         if (!ptr_is_owned(this_ptr)) return;
62112         void* this_ptr_ptr = untag_ptr(this_ptr);
62113         CHECK_ACCESS(this_ptr_ptr);
62114         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
62115         FREE(untag_ptr(this_ptr));
62116         UtxoLookup_free(this_ptr_conv);
62117 }
62118
62119 void  CS_LDK_UtxoFuture_free(int64_t this_obj) {
62120         LDKUtxoFuture this_obj_conv;
62121         this_obj_conv.inner = untag_ptr(this_obj);
62122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62124         UtxoFuture_free(this_obj_conv);
62125 }
62126
62127 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
62128         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
62129         int64_t ret_ref = 0;
62130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62132         return ret_ref;
62133 }
62134 int64_t  CS_LDK_UtxoFuture_clone_ptr(int64_t arg) {
62135         LDKUtxoFuture arg_conv;
62136         arg_conv.inner = untag_ptr(arg);
62137         arg_conv.is_owned = ptr_is_owned(arg);
62138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62139         arg_conv.is_owned = false;
62140         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
62141         return ret_conv;
62142 }
62143
62144 int64_t  CS_LDK_UtxoFuture_clone(int64_t orig) {
62145         LDKUtxoFuture orig_conv;
62146         orig_conv.inner = untag_ptr(orig);
62147         orig_conv.is_owned = ptr_is_owned(orig);
62148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62149         orig_conv.is_owned = false;
62150         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
62151         int64_t ret_ref = 0;
62152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62154         return ret_ref;
62155 }
62156
62157 int64_t  CS_LDK_UtxoFuture_new() {
62158         LDKUtxoFuture ret_var = UtxoFuture_new();
62159         int64_t ret_ref = 0;
62160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62162         return ret_ref;
62163 }
62164
62165 void  CS_LDK_UtxoFuture_resolve_without_forwarding(int64_t this_arg, int64_t graph, int64_t result) {
62166         LDKUtxoFuture this_arg_conv;
62167         this_arg_conv.inner = untag_ptr(this_arg);
62168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62170         this_arg_conv.is_owned = false;
62171         LDKNetworkGraph graph_conv;
62172         graph_conv.inner = untag_ptr(graph);
62173         graph_conv.is_owned = ptr_is_owned(graph);
62174         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
62175         graph_conv.is_owned = false;
62176         void* result_ptr = untag_ptr(result);
62177         CHECK_ACCESS(result_ptr);
62178         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
62179         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
62180 }
62181
62182 void  CS_LDK_UtxoFuture_resolve(int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) {
62183         LDKUtxoFuture this_arg_conv;
62184         this_arg_conv.inner = untag_ptr(this_arg);
62185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62187         this_arg_conv.is_owned = false;
62188         LDKNetworkGraph graph_conv;
62189         graph_conv.inner = untag_ptr(graph);
62190         graph_conv.is_owned = ptr_is_owned(graph);
62191         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
62192         graph_conv.is_owned = false;
62193         LDKP2PGossipSync gossip_conv;
62194         gossip_conv.inner = untag_ptr(gossip);
62195         gossip_conv.is_owned = ptr_is_owned(gossip);
62196         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
62197         gossip_conv.is_owned = false;
62198         void* result_ptr = untag_ptr(result);
62199         CHECK_ACCESS(result_ptr);
62200         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
62201         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
62202 }
62203
62204 void  CS_LDK_NodeId_free(int64_t this_obj) {
62205         LDKNodeId this_obj_conv;
62206         this_obj_conv.inner = untag_ptr(this_obj);
62207         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62209         NodeId_free(this_obj_conv);
62210 }
62211
62212 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
62213         LDKNodeId ret_var = NodeId_clone(arg);
62214         int64_t ret_ref = 0;
62215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62217         return ret_ref;
62218 }
62219 int64_t  CS_LDK_NodeId_clone_ptr(int64_t arg) {
62220         LDKNodeId arg_conv;
62221         arg_conv.inner = untag_ptr(arg);
62222         arg_conv.is_owned = ptr_is_owned(arg);
62223         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62224         arg_conv.is_owned = false;
62225         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
62226         return ret_conv;
62227 }
62228
62229 int64_t  CS_LDK_NodeId_clone(int64_t orig) {
62230         LDKNodeId orig_conv;
62231         orig_conv.inner = untag_ptr(orig);
62232         orig_conv.is_owned = ptr_is_owned(orig);
62233         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62234         orig_conv.is_owned = false;
62235         LDKNodeId ret_var = NodeId_clone(&orig_conv);
62236         int64_t ret_ref = 0;
62237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62239         return ret_ref;
62240 }
62241
62242 int64_t  CS_LDK_NodeId_from_pubkey(int8_tArray pubkey) {
62243         LDKPublicKey pubkey_ref;
62244         CHECK(pubkey->arr_len == 33);
62245         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
62246         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
62247         int64_t ret_ref = 0;
62248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62250         return ret_ref;
62251 }
62252
62253 int8_tArray  CS_LDK_NodeId_as_slice(int64_t this_arg) {
62254         LDKNodeId this_arg_conv;
62255         this_arg_conv.inner = untag_ptr(this_arg);
62256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62258         this_arg_conv.is_owned = false;
62259         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
62260         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62261         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62262         return ret_arr;
62263 }
62264
62265 int8_tArray  CS_LDK_NodeId_as_array(int64_t this_arg) {
62266         LDKNodeId this_arg_conv;
62267         this_arg_conv.inner = untag_ptr(this_arg);
62268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62270         this_arg_conv.is_owned = false;
62271         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62272         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
62273         return ret_arr;
62274 }
62275
62276 int64_t  CS_LDK_NodeId_as_pubkey(int64_t this_arg) {
62277         LDKNodeId this_arg_conv;
62278         this_arg_conv.inner = untag_ptr(this_arg);
62279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62281         this_arg_conv.is_owned = false;
62282         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
62283         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
62284         return tag_ptr(ret_conv, true);
62285 }
62286
62287 int64_t  CS_LDK_NodeId_hash(int64_t o) {
62288         LDKNodeId o_conv;
62289         o_conv.inner = untag_ptr(o);
62290         o_conv.is_owned = ptr_is_owned(o);
62291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62292         o_conv.is_owned = false;
62293         int64_t ret_conv = NodeId_hash(&o_conv);
62294         return ret_conv;
62295 }
62296
62297 int8_tArray  CS_LDK_NodeId_write(int64_t obj) {
62298         LDKNodeId obj_conv;
62299         obj_conv.inner = untag_ptr(obj);
62300         obj_conv.is_owned = ptr_is_owned(obj);
62301         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62302         obj_conv.is_owned = false;
62303         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
62304         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62305         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62306         CVec_u8Z_free(ret_var);
62307         return ret_arr;
62308 }
62309
62310 int64_t  CS_LDK_NodeId_read(int8_tArray ser) {
62311         LDKu8slice ser_ref;
62312         ser_ref.datalen = ser->arr_len;
62313         ser_ref.data = ser->elems;
62314         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
62315         *ret_conv = NodeId_read(ser_ref);
62316         FREE(ser);
62317         return tag_ptr(ret_conv, true);
62318 }
62319
62320 void  CS_LDK_NetworkGraph_free(int64_t this_obj) {
62321         LDKNetworkGraph this_obj_conv;
62322         this_obj_conv.inner = untag_ptr(this_obj);
62323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62325         NetworkGraph_free(this_obj_conv);
62326 }
62327
62328 void  CS_LDK_ReadOnlyNetworkGraph_free(int64_t this_obj) {
62329         LDKReadOnlyNetworkGraph this_obj_conv;
62330         this_obj_conv.inner = untag_ptr(this_obj);
62331         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62333         ReadOnlyNetworkGraph_free(this_obj_conv);
62334 }
62335
62336 void  CS_LDK_NetworkUpdate_free(int64_t this_ptr) {
62337         if (!ptr_is_owned(this_ptr)) return;
62338         void* this_ptr_ptr = untag_ptr(this_ptr);
62339         CHECK_ACCESS(this_ptr_ptr);
62340         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
62341         FREE(untag_ptr(this_ptr));
62342         NetworkUpdate_free(this_ptr_conv);
62343 }
62344
62345 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
62346         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62347         *ret_copy = NetworkUpdate_clone(arg);
62348         int64_t ret_ref = tag_ptr(ret_copy, true);
62349         return ret_ref;
62350 }
62351 int64_t  CS_LDK_NetworkUpdate_clone_ptr(int64_t arg) {
62352         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
62353         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
62354         return ret_conv;
62355 }
62356
62357 int64_t  CS_LDK_NetworkUpdate_clone(int64_t orig) {
62358         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
62359         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62360         *ret_copy = NetworkUpdate_clone(orig_conv);
62361         int64_t ret_ref = tag_ptr(ret_copy, true);
62362         return ret_ref;
62363 }
62364
62365 int64_t  CS_LDK_NetworkUpdate_channel_update_message(int64_t msg) {
62366         LDKChannelUpdate msg_conv;
62367         msg_conv.inner = untag_ptr(msg);
62368         msg_conv.is_owned = ptr_is_owned(msg);
62369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62370         msg_conv = ChannelUpdate_clone(&msg_conv);
62371         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62372         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
62373         int64_t ret_ref = tag_ptr(ret_copy, true);
62374         return ret_ref;
62375 }
62376
62377 int64_t  CS_LDK_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
62378         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62379         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
62380         int64_t ret_ref = tag_ptr(ret_copy, true);
62381         return ret_ref;
62382 }
62383
62384 int64_t  CS_LDK_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
62385         LDKPublicKey node_id_ref;
62386         CHECK(node_id->arr_len == 33);
62387         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
62388         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62389         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
62390         int64_t ret_ref = tag_ptr(ret_copy, true);
62391         return ret_ref;
62392 }
62393
62394 jboolean  CS_LDK_NetworkUpdate_eq(int64_t a, int64_t b) {
62395         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
62396         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
62397         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
62398         return ret_conv;
62399 }
62400
62401 int8_tArray  CS_LDK_NetworkUpdate_write(int64_t obj) {
62402         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
62403         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
62404         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62405         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62406         CVec_u8Z_free(ret_var);
62407         return ret_arr;
62408 }
62409
62410 int64_t  CS_LDK_NetworkUpdate_read(int8_tArray ser) {
62411         LDKu8slice ser_ref;
62412         ser_ref.datalen = ser->arr_len;
62413         ser_ref.data = ser->elems;
62414         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
62415         *ret_conv = NetworkUpdate_read(ser_ref);
62416         FREE(ser);
62417         return tag_ptr(ret_conv, true);
62418 }
62419
62420 void  CS_LDK_P2PGossipSync_free(int64_t this_obj) {
62421         LDKP2PGossipSync this_obj_conv;
62422         this_obj_conv.inner = untag_ptr(this_obj);
62423         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62425         P2PGossipSync_free(this_obj_conv);
62426 }
62427
62428 int64_t  CS_LDK_P2PGossipSync_new(int64_t network_graph, int64_t utxo_lookup, int64_t logger) {
62429         LDKNetworkGraph network_graph_conv;
62430         network_graph_conv.inner = untag_ptr(network_graph);
62431         network_graph_conv.is_owned = ptr_is_owned(network_graph);
62432         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
62433         network_graph_conv.is_owned = false;
62434         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62435         CHECK_ACCESS(utxo_lookup_ptr);
62436         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62437         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62438         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62439                 // Manually implement clone for Java trait instances
62440                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62441                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62442                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62443                 }
62444         }
62445         void* logger_ptr = untag_ptr(logger);
62446         CHECK_ACCESS(logger_ptr);
62447         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62448         if (logger_conv.free == LDKLogger_JCalls_free) {
62449                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62450                 LDKLogger_JCalls_cloned(&logger_conv);
62451         }
62452         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
62453         int64_t ret_ref = 0;
62454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62456         return ret_ref;
62457 }
62458
62459 void  CS_LDK_P2PGossipSync_add_utxo_lookup(int64_t this_arg, int64_t utxo_lookup) {
62460         LDKP2PGossipSync this_arg_conv;
62461         this_arg_conv.inner = untag_ptr(this_arg);
62462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62464         this_arg_conv.is_owned = false;
62465         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62466         CHECK_ACCESS(utxo_lookup_ptr);
62467         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62468         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62469         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62470                 // Manually implement clone for Java trait instances
62471                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62472                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62473                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62474                 }
62475         }
62476         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
62477 }
62478
62479 void  CS_LDK_NetworkGraph_handle_network_update(int64_t this_arg, int64_t network_update) {
62480         LDKNetworkGraph this_arg_conv;
62481         this_arg_conv.inner = untag_ptr(this_arg);
62482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62484         this_arg_conv.is_owned = false;
62485         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
62486         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
62487 }
62488
62489 int8_tArray  CS_LDK_NetworkGraph_get_chain_hash(int64_t this_arg) {
62490         LDKNetworkGraph this_arg_conv;
62491         this_arg_conv.inner = untag_ptr(this_arg);
62492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62494         this_arg_conv.is_owned = false;
62495         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62496         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
62497         return ret_arr;
62498 }
62499
62500 int64_t  CS_LDK_verify_node_announcement(int64_t msg) {
62501         LDKNodeAnnouncement msg_conv;
62502         msg_conv.inner = untag_ptr(msg);
62503         msg_conv.is_owned = ptr_is_owned(msg);
62504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62505         msg_conv.is_owned = false;
62506         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62507         *ret_conv = verify_node_announcement(&msg_conv);
62508         return tag_ptr(ret_conv, true);
62509 }
62510
62511 int64_t  CS_LDK_verify_channel_announcement(int64_t msg) {
62512         LDKChannelAnnouncement msg_conv;
62513         msg_conv.inner = untag_ptr(msg);
62514         msg_conv.is_owned = ptr_is_owned(msg);
62515         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62516         msg_conv.is_owned = false;
62517         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62518         *ret_conv = verify_channel_announcement(&msg_conv);
62519         return tag_ptr(ret_conv, true);
62520 }
62521
62522 int64_t  CS_LDK_P2PGossipSync_as_RoutingMessageHandler(int64_t this_arg) {
62523         LDKP2PGossipSync this_arg_conv;
62524         this_arg_conv.inner = untag_ptr(this_arg);
62525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62527         this_arg_conv.is_owned = false;
62528         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
62529         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
62530         return tag_ptr(ret_ret, true);
62531 }
62532
62533 int64_t  CS_LDK_P2PGossipSync_as_MessageSendEventsProvider(int64_t this_arg) {
62534         LDKP2PGossipSync this_arg_conv;
62535         this_arg_conv.inner = untag_ptr(this_arg);
62536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62538         this_arg_conv.is_owned = false;
62539         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
62540         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
62541         return tag_ptr(ret_ret, true);
62542 }
62543
62544 void  CS_LDK_ChannelUpdateInfo_free(int64_t this_obj) {
62545         LDKChannelUpdateInfo this_obj_conv;
62546         this_obj_conv.inner = untag_ptr(this_obj);
62547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62549         ChannelUpdateInfo_free(this_obj_conv);
62550 }
62551
62552 int32_t  CS_LDK_ChannelUpdateInfo_get_last_update(int64_t this_ptr) {
62553         LDKChannelUpdateInfo this_ptr_conv;
62554         this_ptr_conv.inner = untag_ptr(this_ptr);
62555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62557         this_ptr_conv.is_owned = false;
62558         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
62559         return ret_conv;
62560 }
62561
62562 void  CS_LDK_ChannelUpdateInfo_set_last_update(int64_t this_ptr, int32_t val) {
62563         LDKChannelUpdateInfo this_ptr_conv;
62564         this_ptr_conv.inner = untag_ptr(this_ptr);
62565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62567         this_ptr_conv.is_owned = false;
62568         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
62569 }
62570
62571 jboolean  CS_LDK_ChannelUpdateInfo_get_enabled(int64_t this_ptr) {
62572         LDKChannelUpdateInfo this_ptr_conv;
62573         this_ptr_conv.inner = untag_ptr(this_ptr);
62574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62576         this_ptr_conv.is_owned = false;
62577         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
62578         return ret_conv;
62579 }
62580
62581 void  CS_LDK_ChannelUpdateInfo_set_enabled(int64_t this_ptr, jboolean val) {
62582         LDKChannelUpdateInfo this_ptr_conv;
62583         this_ptr_conv.inner = untag_ptr(this_ptr);
62584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62586         this_ptr_conv.is_owned = false;
62587         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
62588 }
62589
62590 int16_t  CS_LDK_ChannelUpdateInfo_get_cltv_expiry_delta(int64_t this_ptr) {
62591         LDKChannelUpdateInfo this_ptr_conv;
62592         this_ptr_conv.inner = untag_ptr(this_ptr);
62593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62595         this_ptr_conv.is_owned = false;
62596         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
62597         return ret_conv;
62598 }
62599
62600 void  CS_LDK_ChannelUpdateInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
62601         LDKChannelUpdateInfo this_ptr_conv;
62602         this_ptr_conv.inner = untag_ptr(this_ptr);
62603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62605         this_ptr_conv.is_owned = false;
62606         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
62607 }
62608
62609 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_minimum_msat(int64_t this_ptr) {
62610         LDKChannelUpdateInfo this_ptr_conv;
62611         this_ptr_conv.inner = untag_ptr(this_ptr);
62612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62614         this_ptr_conv.is_owned = false;
62615         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
62616         return ret_conv;
62617 }
62618
62619 void  CS_LDK_ChannelUpdateInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
62620         LDKChannelUpdateInfo this_ptr_conv;
62621         this_ptr_conv.inner = untag_ptr(this_ptr);
62622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62624         this_ptr_conv.is_owned = false;
62625         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
62626 }
62627
62628 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_maximum_msat(int64_t this_ptr) {
62629         LDKChannelUpdateInfo this_ptr_conv;
62630         this_ptr_conv.inner = untag_ptr(this_ptr);
62631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62633         this_ptr_conv.is_owned = false;
62634         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
62635         return ret_conv;
62636 }
62637
62638 void  CS_LDK_ChannelUpdateInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
62639         LDKChannelUpdateInfo this_ptr_conv;
62640         this_ptr_conv.inner = untag_ptr(this_ptr);
62641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62643         this_ptr_conv.is_owned = false;
62644         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
62645 }
62646
62647 int64_t  CS_LDK_ChannelUpdateInfo_get_fees(int64_t this_ptr) {
62648         LDKChannelUpdateInfo this_ptr_conv;
62649         this_ptr_conv.inner = untag_ptr(this_ptr);
62650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62652         this_ptr_conv.is_owned = false;
62653         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
62654         int64_t ret_ref = 0;
62655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62657         return ret_ref;
62658 }
62659
62660 void  CS_LDK_ChannelUpdateInfo_set_fees(int64_t this_ptr, int64_t val) {
62661         LDKChannelUpdateInfo this_ptr_conv;
62662         this_ptr_conv.inner = untag_ptr(this_ptr);
62663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62665         this_ptr_conv.is_owned = false;
62666         LDKRoutingFees val_conv;
62667         val_conv.inner = untag_ptr(val);
62668         val_conv.is_owned = ptr_is_owned(val);
62669         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62670         val_conv = RoutingFees_clone(&val_conv);
62671         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
62672 }
62673
62674 int64_t  CS_LDK_ChannelUpdateInfo_get_last_update_message(int64_t this_ptr) {
62675         LDKChannelUpdateInfo this_ptr_conv;
62676         this_ptr_conv.inner = untag_ptr(this_ptr);
62677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62679         this_ptr_conv.is_owned = false;
62680         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
62681         int64_t ret_ref = 0;
62682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62684         return ret_ref;
62685 }
62686
62687 void  CS_LDK_ChannelUpdateInfo_set_last_update_message(int64_t this_ptr, int64_t val) {
62688         LDKChannelUpdateInfo this_ptr_conv;
62689         this_ptr_conv.inner = untag_ptr(this_ptr);
62690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62692         this_ptr_conv.is_owned = false;
62693         LDKChannelUpdate val_conv;
62694         val_conv.inner = untag_ptr(val);
62695         val_conv.is_owned = ptr_is_owned(val);
62696         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62697         val_conv = ChannelUpdate_clone(&val_conv);
62698         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
62699 }
62700
62701 int64_t  CS_LDK_ChannelUpdateInfo_new(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) {
62702         LDKRoutingFees fees_arg_conv;
62703         fees_arg_conv.inner = untag_ptr(fees_arg);
62704         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
62705         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
62706         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
62707         LDKChannelUpdate last_update_message_arg_conv;
62708         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
62709         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
62710         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
62711         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
62712         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);
62713         int64_t ret_ref = 0;
62714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62716         return ret_ref;
62717 }
62718
62719 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
62720         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
62721         int64_t ret_ref = 0;
62722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62724         return ret_ref;
62725 }
62726 int64_t  CS_LDK_ChannelUpdateInfo_clone_ptr(int64_t arg) {
62727         LDKChannelUpdateInfo arg_conv;
62728         arg_conv.inner = untag_ptr(arg);
62729         arg_conv.is_owned = ptr_is_owned(arg);
62730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62731         arg_conv.is_owned = false;
62732         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
62733         return ret_conv;
62734 }
62735
62736 int64_t  CS_LDK_ChannelUpdateInfo_clone(int64_t orig) {
62737         LDKChannelUpdateInfo orig_conv;
62738         orig_conv.inner = untag_ptr(orig);
62739         orig_conv.is_owned = ptr_is_owned(orig);
62740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62741         orig_conv.is_owned = false;
62742         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
62743         int64_t ret_ref = 0;
62744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62746         return ret_ref;
62747 }
62748
62749 jboolean  CS_LDK_ChannelUpdateInfo_eq(int64_t a, int64_t b) {
62750         LDKChannelUpdateInfo a_conv;
62751         a_conv.inner = untag_ptr(a);
62752         a_conv.is_owned = ptr_is_owned(a);
62753         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62754         a_conv.is_owned = false;
62755         LDKChannelUpdateInfo b_conv;
62756         b_conv.inner = untag_ptr(b);
62757         b_conv.is_owned = ptr_is_owned(b);
62758         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62759         b_conv.is_owned = false;
62760         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
62761         return ret_conv;
62762 }
62763
62764 int8_tArray  CS_LDK_ChannelUpdateInfo_write(int64_t obj) {
62765         LDKChannelUpdateInfo obj_conv;
62766         obj_conv.inner = untag_ptr(obj);
62767         obj_conv.is_owned = ptr_is_owned(obj);
62768         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62769         obj_conv.is_owned = false;
62770         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
62771         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62772         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62773         CVec_u8Z_free(ret_var);
62774         return ret_arr;
62775 }
62776
62777 int64_t  CS_LDK_ChannelUpdateInfo_read(int8_tArray ser) {
62778         LDKu8slice ser_ref;
62779         ser_ref.datalen = ser->arr_len;
62780         ser_ref.data = ser->elems;
62781         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
62782         *ret_conv = ChannelUpdateInfo_read(ser_ref);
62783         FREE(ser);
62784         return tag_ptr(ret_conv, true);
62785 }
62786
62787 void  CS_LDK_ChannelInfo_free(int64_t this_obj) {
62788         LDKChannelInfo this_obj_conv;
62789         this_obj_conv.inner = untag_ptr(this_obj);
62790         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62792         ChannelInfo_free(this_obj_conv);
62793 }
62794
62795 int64_t  CS_LDK_ChannelInfo_get_features(int64_t this_ptr) {
62796         LDKChannelInfo this_ptr_conv;
62797         this_ptr_conv.inner = untag_ptr(this_ptr);
62798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62800         this_ptr_conv.is_owned = false;
62801         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
62802         int64_t ret_ref = 0;
62803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62805         return ret_ref;
62806 }
62807
62808 void  CS_LDK_ChannelInfo_set_features(int64_t this_ptr, int64_t val) {
62809         LDKChannelInfo this_ptr_conv;
62810         this_ptr_conv.inner = untag_ptr(this_ptr);
62811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62813         this_ptr_conv.is_owned = false;
62814         LDKChannelFeatures val_conv;
62815         val_conv.inner = untag_ptr(val);
62816         val_conv.is_owned = ptr_is_owned(val);
62817         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62818         val_conv = ChannelFeatures_clone(&val_conv);
62819         ChannelInfo_set_features(&this_ptr_conv, val_conv);
62820 }
62821
62822 int64_t  CS_LDK_ChannelInfo_get_node_one(int64_t this_ptr) {
62823         LDKChannelInfo this_ptr_conv;
62824         this_ptr_conv.inner = untag_ptr(this_ptr);
62825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62827         this_ptr_conv.is_owned = false;
62828         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
62829         int64_t ret_ref = 0;
62830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62832         return ret_ref;
62833 }
62834
62835 void  CS_LDK_ChannelInfo_set_node_one(int64_t this_ptr, int64_t val) {
62836         LDKChannelInfo this_ptr_conv;
62837         this_ptr_conv.inner = untag_ptr(this_ptr);
62838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62840         this_ptr_conv.is_owned = false;
62841         LDKNodeId val_conv;
62842         val_conv.inner = untag_ptr(val);
62843         val_conv.is_owned = ptr_is_owned(val);
62844         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62845         val_conv = NodeId_clone(&val_conv);
62846         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
62847 }
62848
62849 int64_t  CS_LDK_ChannelInfo_get_one_to_two(int64_t this_ptr) {
62850         LDKChannelInfo this_ptr_conv;
62851         this_ptr_conv.inner = untag_ptr(this_ptr);
62852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62854         this_ptr_conv.is_owned = false;
62855         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
62856         int64_t ret_ref = 0;
62857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62859         return ret_ref;
62860 }
62861
62862 void  CS_LDK_ChannelInfo_set_one_to_two(int64_t this_ptr, int64_t val) {
62863         LDKChannelInfo this_ptr_conv;
62864         this_ptr_conv.inner = untag_ptr(this_ptr);
62865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62867         this_ptr_conv.is_owned = false;
62868         LDKChannelUpdateInfo val_conv;
62869         val_conv.inner = untag_ptr(val);
62870         val_conv.is_owned = ptr_is_owned(val);
62871         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62872         val_conv = ChannelUpdateInfo_clone(&val_conv);
62873         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
62874 }
62875
62876 int64_t  CS_LDK_ChannelInfo_get_node_two(int64_t this_ptr) {
62877         LDKChannelInfo this_ptr_conv;
62878         this_ptr_conv.inner = untag_ptr(this_ptr);
62879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62881         this_ptr_conv.is_owned = false;
62882         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
62883         int64_t ret_ref = 0;
62884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62886         return ret_ref;
62887 }
62888
62889 void  CS_LDK_ChannelInfo_set_node_two(int64_t this_ptr, int64_t val) {
62890         LDKChannelInfo this_ptr_conv;
62891         this_ptr_conv.inner = untag_ptr(this_ptr);
62892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62894         this_ptr_conv.is_owned = false;
62895         LDKNodeId val_conv;
62896         val_conv.inner = untag_ptr(val);
62897         val_conv.is_owned = ptr_is_owned(val);
62898         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62899         val_conv = NodeId_clone(&val_conv);
62900         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
62901 }
62902
62903 int64_t  CS_LDK_ChannelInfo_get_two_to_one(int64_t this_ptr) {
62904         LDKChannelInfo this_ptr_conv;
62905         this_ptr_conv.inner = untag_ptr(this_ptr);
62906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62908         this_ptr_conv.is_owned = false;
62909         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
62910         int64_t ret_ref = 0;
62911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62913         return ret_ref;
62914 }
62915
62916 void  CS_LDK_ChannelInfo_set_two_to_one(int64_t this_ptr, int64_t val) {
62917         LDKChannelInfo this_ptr_conv;
62918         this_ptr_conv.inner = untag_ptr(this_ptr);
62919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62921         this_ptr_conv.is_owned = false;
62922         LDKChannelUpdateInfo val_conv;
62923         val_conv.inner = untag_ptr(val);
62924         val_conv.is_owned = ptr_is_owned(val);
62925         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62926         val_conv = ChannelUpdateInfo_clone(&val_conv);
62927         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
62928 }
62929
62930 int64_t  CS_LDK_ChannelInfo_get_capacity_sats(int64_t this_ptr) {
62931         LDKChannelInfo this_ptr_conv;
62932         this_ptr_conv.inner = untag_ptr(this_ptr);
62933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62935         this_ptr_conv.is_owned = false;
62936         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
62937         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
62938         int64_t ret_ref = tag_ptr(ret_copy, true);
62939         return ret_ref;
62940 }
62941
62942 void  CS_LDK_ChannelInfo_set_capacity_sats(int64_t this_ptr, int64_t val) {
62943         LDKChannelInfo this_ptr_conv;
62944         this_ptr_conv.inner = untag_ptr(this_ptr);
62945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62947         this_ptr_conv.is_owned = false;
62948         void* val_ptr = untag_ptr(val);
62949         CHECK_ACCESS(val_ptr);
62950         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
62951         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
62952         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
62953 }
62954
62955 int64_t  CS_LDK_ChannelInfo_get_announcement_message(int64_t this_ptr) {
62956         LDKChannelInfo this_ptr_conv;
62957         this_ptr_conv.inner = untag_ptr(this_ptr);
62958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62960         this_ptr_conv.is_owned = false;
62961         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
62962         int64_t ret_ref = 0;
62963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62965         return ret_ref;
62966 }
62967
62968 void  CS_LDK_ChannelInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
62969         LDKChannelInfo this_ptr_conv;
62970         this_ptr_conv.inner = untag_ptr(this_ptr);
62971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62973         this_ptr_conv.is_owned = false;
62974         LDKChannelAnnouncement val_conv;
62975         val_conv.inner = untag_ptr(val);
62976         val_conv.is_owned = ptr_is_owned(val);
62977         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62978         val_conv = ChannelAnnouncement_clone(&val_conv);
62979         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
62980 }
62981
62982 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
62983         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
62984         int64_t ret_ref = 0;
62985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62987         return ret_ref;
62988 }
62989 int64_t  CS_LDK_ChannelInfo_clone_ptr(int64_t arg) {
62990         LDKChannelInfo arg_conv;
62991         arg_conv.inner = untag_ptr(arg);
62992         arg_conv.is_owned = ptr_is_owned(arg);
62993         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62994         arg_conv.is_owned = false;
62995         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
62996         return ret_conv;
62997 }
62998
62999 int64_t  CS_LDK_ChannelInfo_clone(int64_t orig) {
63000         LDKChannelInfo orig_conv;
63001         orig_conv.inner = untag_ptr(orig);
63002         orig_conv.is_owned = ptr_is_owned(orig);
63003         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63004         orig_conv.is_owned = false;
63005         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
63006         int64_t ret_ref = 0;
63007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63009         return ret_ref;
63010 }
63011
63012 jboolean  CS_LDK_ChannelInfo_eq(int64_t a, int64_t b) {
63013         LDKChannelInfo a_conv;
63014         a_conv.inner = untag_ptr(a);
63015         a_conv.is_owned = ptr_is_owned(a);
63016         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63017         a_conv.is_owned = false;
63018         LDKChannelInfo b_conv;
63019         b_conv.inner = untag_ptr(b);
63020         b_conv.is_owned = ptr_is_owned(b);
63021         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63022         b_conv.is_owned = false;
63023         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
63024         return ret_conv;
63025 }
63026
63027 int64_t  CS_LDK_ChannelInfo_get_directional_info(int64_t this_arg, int8_t channel_flags) {
63028         LDKChannelInfo this_arg_conv;
63029         this_arg_conv.inner = untag_ptr(this_arg);
63030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63032         this_arg_conv.is_owned = false;
63033         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
63034         int64_t ret_ref = 0;
63035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63037         return ret_ref;
63038 }
63039
63040 int8_tArray  CS_LDK_ChannelInfo_write(int64_t obj) {
63041         LDKChannelInfo obj_conv;
63042         obj_conv.inner = untag_ptr(obj);
63043         obj_conv.is_owned = ptr_is_owned(obj);
63044         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63045         obj_conv.is_owned = false;
63046         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
63047         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63048         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63049         CVec_u8Z_free(ret_var);
63050         return ret_arr;
63051 }
63052
63053 int64_t  CS_LDK_ChannelInfo_read(int8_tArray ser) {
63054         LDKu8slice ser_ref;
63055         ser_ref.datalen = ser->arr_len;
63056         ser_ref.data = ser->elems;
63057         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
63058         *ret_conv = ChannelInfo_read(ser_ref);
63059         FREE(ser);
63060         return tag_ptr(ret_conv, true);
63061 }
63062
63063 void  CS_LDK_DirectedChannelInfo_free(int64_t this_obj) {
63064         LDKDirectedChannelInfo this_obj_conv;
63065         this_obj_conv.inner = untag_ptr(this_obj);
63066         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63068         DirectedChannelInfo_free(this_obj_conv);
63069 }
63070
63071 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
63072         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
63073         int64_t ret_ref = 0;
63074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63076         return ret_ref;
63077 }
63078 int64_t  CS_LDK_DirectedChannelInfo_clone_ptr(int64_t arg) {
63079         LDKDirectedChannelInfo arg_conv;
63080         arg_conv.inner = untag_ptr(arg);
63081         arg_conv.is_owned = ptr_is_owned(arg);
63082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63083         arg_conv.is_owned = false;
63084         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
63085         return ret_conv;
63086 }
63087
63088 int64_t  CS_LDK_DirectedChannelInfo_clone(int64_t orig) {
63089         LDKDirectedChannelInfo orig_conv;
63090         orig_conv.inner = untag_ptr(orig);
63091         orig_conv.is_owned = ptr_is_owned(orig);
63092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63093         orig_conv.is_owned = false;
63094         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
63095         int64_t ret_ref = 0;
63096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63098         return ret_ref;
63099 }
63100
63101 int64_t  CS_LDK_DirectedChannelInfo_channel(int64_t this_arg) {
63102         LDKDirectedChannelInfo this_arg_conv;
63103         this_arg_conv.inner = untag_ptr(this_arg);
63104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63106         this_arg_conv.is_owned = false;
63107         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
63108         int64_t ret_ref = 0;
63109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63111         return ret_ref;
63112 }
63113
63114 int64_t  CS_LDK_DirectedChannelInfo_effective_capacity(int64_t this_arg) {
63115         LDKDirectedChannelInfo this_arg_conv;
63116         this_arg_conv.inner = untag_ptr(this_arg);
63117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63119         this_arg_conv.is_owned = false;
63120         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63121         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
63122         int64_t ret_ref = tag_ptr(ret_copy, true);
63123         return ret_ref;
63124 }
63125
63126 void  CS_LDK_EffectiveCapacity_free(int64_t this_ptr) {
63127         if (!ptr_is_owned(this_ptr)) return;
63128         void* this_ptr_ptr = untag_ptr(this_ptr);
63129         CHECK_ACCESS(this_ptr_ptr);
63130         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
63131         FREE(untag_ptr(this_ptr));
63132         EffectiveCapacity_free(this_ptr_conv);
63133 }
63134
63135 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
63136         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63137         *ret_copy = EffectiveCapacity_clone(arg);
63138         int64_t ret_ref = tag_ptr(ret_copy, true);
63139         return ret_ref;
63140 }
63141 int64_t  CS_LDK_EffectiveCapacity_clone_ptr(int64_t arg) {
63142         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
63143         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
63144         return ret_conv;
63145 }
63146
63147 int64_t  CS_LDK_EffectiveCapacity_clone(int64_t orig) {
63148         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
63149         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63150         *ret_copy = EffectiveCapacity_clone(orig_conv);
63151         int64_t ret_ref = tag_ptr(ret_copy, true);
63152         return ret_ref;
63153 }
63154
63155 int64_t  CS_LDK_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
63156         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63157         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
63158         int64_t ret_ref = tag_ptr(ret_copy, true);
63159         return ret_ref;
63160 }
63161
63162 int64_t  CS_LDK_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
63163         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63164         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
63165         int64_t ret_ref = tag_ptr(ret_copy, true);
63166         return ret_ref;
63167 }
63168
63169 int64_t  CS_LDK_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
63170         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63171         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
63172         int64_t ret_ref = tag_ptr(ret_copy, true);
63173         return ret_ref;
63174 }
63175
63176 int64_t  CS_LDK_EffectiveCapacity_infinite() {
63177         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63178         *ret_copy = EffectiveCapacity_infinite();
63179         int64_t ret_ref = tag_ptr(ret_copy, true);
63180         return ret_ref;
63181 }
63182
63183 int64_t  CS_LDK_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
63184         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63185         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
63186         int64_t ret_ref = tag_ptr(ret_copy, true);
63187         return ret_ref;
63188 }
63189
63190 int64_t  CS_LDK_EffectiveCapacity_unknown() {
63191         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63192         *ret_copy = EffectiveCapacity_unknown();
63193         int64_t ret_ref = tag_ptr(ret_copy, true);
63194         return ret_ref;
63195 }
63196
63197 int64_t  CS_LDK_EffectiveCapacity_as_msat(int64_t this_arg) {
63198         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
63199         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
63200         return ret_conv;
63201 }
63202
63203 void  CS_LDK_RoutingFees_free(int64_t this_obj) {
63204         LDKRoutingFees this_obj_conv;
63205         this_obj_conv.inner = untag_ptr(this_obj);
63206         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63208         RoutingFees_free(this_obj_conv);
63209 }
63210
63211 int32_t  CS_LDK_RoutingFees_get_base_msat(int64_t this_ptr) {
63212         LDKRoutingFees this_ptr_conv;
63213         this_ptr_conv.inner = untag_ptr(this_ptr);
63214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63216         this_ptr_conv.is_owned = false;
63217         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
63218         return ret_conv;
63219 }
63220
63221 void  CS_LDK_RoutingFees_set_base_msat(int64_t this_ptr, int32_t val) {
63222         LDKRoutingFees this_ptr_conv;
63223         this_ptr_conv.inner = untag_ptr(this_ptr);
63224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63226         this_ptr_conv.is_owned = false;
63227         RoutingFees_set_base_msat(&this_ptr_conv, val);
63228 }
63229
63230 int32_t  CS_LDK_RoutingFees_get_proportional_millionths(int64_t this_ptr) {
63231         LDKRoutingFees this_ptr_conv;
63232         this_ptr_conv.inner = untag_ptr(this_ptr);
63233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63235         this_ptr_conv.is_owned = false;
63236         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
63237         return ret_conv;
63238 }
63239
63240 void  CS_LDK_RoutingFees_set_proportional_millionths(int64_t this_ptr, int32_t val) {
63241         LDKRoutingFees this_ptr_conv;
63242         this_ptr_conv.inner = untag_ptr(this_ptr);
63243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63245         this_ptr_conv.is_owned = false;
63246         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
63247 }
63248
63249 int64_t  CS_LDK_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
63250         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
63251         int64_t ret_ref = 0;
63252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63254         return ret_ref;
63255 }
63256
63257 jboolean  CS_LDK_RoutingFees_eq(int64_t a, int64_t b) {
63258         LDKRoutingFees a_conv;
63259         a_conv.inner = untag_ptr(a);
63260         a_conv.is_owned = ptr_is_owned(a);
63261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63262         a_conv.is_owned = false;
63263         LDKRoutingFees b_conv;
63264         b_conv.inner = untag_ptr(b);
63265         b_conv.is_owned = ptr_is_owned(b);
63266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63267         b_conv.is_owned = false;
63268         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
63269         return ret_conv;
63270 }
63271
63272 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
63273         LDKRoutingFees ret_var = RoutingFees_clone(arg);
63274         int64_t ret_ref = 0;
63275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63277         return ret_ref;
63278 }
63279 int64_t  CS_LDK_RoutingFees_clone_ptr(int64_t arg) {
63280         LDKRoutingFees arg_conv;
63281         arg_conv.inner = untag_ptr(arg);
63282         arg_conv.is_owned = ptr_is_owned(arg);
63283         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63284         arg_conv.is_owned = false;
63285         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
63286         return ret_conv;
63287 }
63288
63289 int64_t  CS_LDK_RoutingFees_clone(int64_t orig) {
63290         LDKRoutingFees orig_conv;
63291         orig_conv.inner = untag_ptr(orig);
63292         orig_conv.is_owned = ptr_is_owned(orig);
63293         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63294         orig_conv.is_owned = false;
63295         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
63296         int64_t ret_ref = 0;
63297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63299         return ret_ref;
63300 }
63301
63302 int64_t  CS_LDK_RoutingFees_hash(int64_t o) {
63303         LDKRoutingFees o_conv;
63304         o_conv.inner = untag_ptr(o);
63305         o_conv.is_owned = ptr_is_owned(o);
63306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63307         o_conv.is_owned = false;
63308         int64_t ret_conv = RoutingFees_hash(&o_conv);
63309         return ret_conv;
63310 }
63311
63312 int8_tArray  CS_LDK_RoutingFees_write(int64_t obj) {
63313         LDKRoutingFees obj_conv;
63314         obj_conv.inner = untag_ptr(obj);
63315         obj_conv.is_owned = ptr_is_owned(obj);
63316         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63317         obj_conv.is_owned = false;
63318         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
63319         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63320         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63321         CVec_u8Z_free(ret_var);
63322         return ret_arr;
63323 }
63324
63325 int64_t  CS_LDK_RoutingFees_read(int8_tArray ser) {
63326         LDKu8slice ser_ref;
63327         ser_ref.datalen = ser->arr_len;
63328         ser_ref.data = ser->elems;
63329         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
63330         *ret_conv = RoutingFees_read(ser_ref);
63331         FREE(ser);
63332         return tag_ptr(ret_conv, true);
63333 }
63334
63335 void  CS_LDK_NodeAnnouncementInfo_free(int64_t this_obj) {
63336         LDKNodeAnnouncementInfo this_obj_conv;
63337         this_obj_conv.inner = untag_ptr(this_obj);
63338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63340         NodeAnnouncementInfo_free(this_obj_conv);
63341 }
63342
63343 int64_t  CS_LDK_NodeAnnouncementInfo_get_features(int64_t this_ptr) {
63344         LDKNodeAnnouncementInfo this_ptr_conv;
63345         this_ptr_conv.inner = untag_ptr(this_ptr);
63346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63348         this_ptr_conv.is_owned = false;
63349         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
63350         int64_t ret_ref = 0;
63351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63353         return ret_ref;
63354 }
63355
63356 void  CS_LDK_NodeAnnouncementInfo_set_features(int64_t this_ptr, int64_t val) {
63357         LDKNodeAnnouncementInfo this_ptr_conv;
63358         this_ptr_conv.inner = untag_ptr(this_ptr);
63359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63361         this_ptr_conv.is_owned = false;
63362         LDKNodeFeatures val_conv;
63363         val_conv.inner = untag_ptr(val);
63364         val_conv.is_owned = ptr_is_owned(val);
63365         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63366         val_conv = NodeFeatures_clone(&val_conv);
63367         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
63368 }
63369
63370 int32_t  CS_LDK_NodeAnnouncementInfo_get_last_update(int64_t this_ptr) {
63371         LDKNodeAnnouncementInfo this_ptr_conv;
63372         this_ptr_conv.inner = untag_ptr(this_ptr);
63373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63375         this_ptr_conv.is_owned = false;
63376         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
63377         return ret_conv;
63378 }
63379
63380 void  CS_LDK_NodeAnnouncementInfo_set_last_update(int64_t this_ptr, int32_t val) {
63381         LDKNodeAnnouncementInfo this_ptr_conv;
63382         this_ptr_conv.inner = untag_ptr(this_ptr);
63383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63385         this_ptr_conv.is_owned = false;
63386         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
63387 }
63388
63389 int8_tArray  CS_LDK_NodeAnnouncementInfo_get_rgb(int64_t this_ptr) {
63390         LDKNodeAnnouncementInfo this_ptr_conv;
63391         this_ptr_conv.inner = untag_ptr(this_ptr);
63392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63394         this_ptr_conv.is_owned = false;
63395         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
63396         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
63397         return ret_arr;
63398 }
63399
63400 void  CS_LDK_NodeAnnouncementInfo_set_rgb(int64_t this_ptr, int8_tArray val) {
63401         LDKNodeAnnouncementInfo this_ptr_conv;
63402         this_ptr_conv.inner = untag_ptr(this_ptr);
63403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63405         this_ptr_conv.is_owned = false;
63406         LDKThreeBytes val_ref;
63407         CHECK(val->arr_len == 3);
63408         memcpy(val_ref.data, val->elems, 3); FREE(val);
63409         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
63410 }
63411
63412 int64_t  CS_LDK_NodeAnnouncementInfo_get_alias(int64_t this_ptr) {
63413         LDKNodeAnnouncementInfo this_ptr_conv;
63414         this_ptr_conv.inner = untag_ptr(this_ptr);
63415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63417         this_ptr_conv.is_owned = false;
63418         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
63419         int64_t ret_ref = 0;
63420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63422         return ret_ref;
63423 }
63424
63425 void  CS_LDK_NodeAnnouncementInfo_set_alias(int64_t this_ptr, int64_t val) {
63426         LDKNodeAnnouncementInfo this_ptr_conv;
63427         this_ptr_conv.inner = untag_ptr(this_ptr);
63428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63430         this_ptr_conv.is_owned = false;
63431         LDKNodeAlias val_conv;
63432         val_conv.inner = untag_ptr(val);
63433         val_conv.is_owned = ptr_is_owned(val);
63434         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63435         val_conv = NodeAlias_clone(&val_conv);
63436         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
63437 }
63438
63439 int64_t  CS_LDK_NodeAnnouncementInfo_get_announcement_message(int64_t this_ptr) {
63440         LDKNodeAnnouncementInfo this_ptr_conv;
63441         this_ptr_conv.inner = untag_ptr(this_ptr);
63442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63444         this_ptr_conv.is_owned = false;
63445         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
63446         int64_t ret_ref = 0;
63447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63449         return ret_ref;
63450 }
63451
63452 void  CS_LDK_NodeAnnouncementInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
63453         LDKNodeAnnouncementInfo this_ptr_conv;
63454         this_ptr_conv.inner = untag_ptr(this_ptr);
63455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63457         this_ptr_conv.is_owned = false;
63458         LDKNodeAnnouncement val_conv;
63459         val_conv.inner = untag_ptr(val);
63460         val_conv.is_owned = ptr_is_owned(val);
63461         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63462         val_conv = NodeAnnouncement_clone(&val_conv);
63463         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
63464 }
63465
63466 int64_t  CS_LDK_NodeAnnouncementInfo_new(int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_t announcement_message_arg) {
63467         LDKNodeFeatures features_arg_conv;
63468         features_arg_conv.inner = untag_ptr(features_arg);
63469         features_arg_conv.is_owned = ptr_is_owned(features_arg);
63470         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
63471         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
63472         LDKThreeBytes rgb_arg_ref;
63473         CHECK(rgb_arg->arr_len == 3);
63474         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
63475         LDKNodeAlias alias_arg_conv;
63476         alias_arg_conv.inner = untag_ptr(alias_arg);
63477         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
63478         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
63479         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
63480         LDKNodeAnnouncement announcement_message_arg_conv;
63481         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
63482         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
63483         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
63484         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
63485         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
63486         int64_t ret_ref = 0;
63487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63489         return ret_ref;
63490 }
63491
63492 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
63493         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
63494         int64_t ret_ref = 0;
63495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63497         return ret_ref;
63498 }
63499 int64_t  CS_LDK_NodeAnnouncementInfo_clone_ptr(int64_t arg) {
63500         LDKNodeAnnouncementInfo arg_conv;
63501         arg_conv.inner = untag_ptr(arg);
63502         arg_conv.is_owned = ptr_is_owned(arg);
63503         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63504         arg_conv.is_owned = false;
63505         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
63506         return ret_conv;
63507 }
63508
63509 int64_t  CS_LDK_NodeAnnouncementInfo_clone(int64_t orig) {
63510         LDKNodeAnnouncementInfo orig_conv;
63511         orig_conv.inner = untag_ptr(orig);
63512         orig_conv.is_owned = ptr_is_owned(orig);
63513         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63514         orig_conv.is_owned = false;
63515         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
63516         int64_t ret_ref = 0;
63517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63519         return ret_ref;
63520 }
63521
63522 jboolean  CS_LDK_NodeAnnouncementInfo_eq(int64_t a, int64_t b) {
63523         LDKNodeAnnouncementInfo a_conv;
63524         a_conv.inner = untag_ptr(a);
63525         a_conv.is_owned = ptr_is_owned(a);
63526         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63527         a_conv.is_owned = false;
63528         LDKNodeAnnouncementInfo b_conv;
63529         b_conv.inner = untag_ptr(b);
63530         b_conv.is_owned = ptr_is_owned(b);
63531         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63532         b_conv.is_owned = false;
63533         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
63534         return ret_conv;
63535 }
63536
63537 int64_tArray  CS_LDK_NodeAnnouncementInfo_addresses(int64_t this_arg) {
63538         LDKNodeAnnouncementInfo this_arg_conv;
63539         this_arg_conv.inner = untag_ptr(this_arg);
63540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63542         this_arg_conv.is_owned = false;
63543         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
63544         int64_tArray ret_arr = NULL;
63545         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63546         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63547         for (size_t p = 0; p < ret_var.datalen; p++) {
63548                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
63549                 *ret_conv_15_copy = ret_var.data[p];
63550                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
63551                 ret_arr_ptr[p] = ret_conv_15_ref;
63552         }
63553         
63554         FREE(ret_var.data);
63555         return ret_arr;
63556 }
63557
63558 int8_tArray  CS_LDK_NodeAnnouncementInfo_write(int64_t obj) {
63559         LDKNodeAnnouncementInfo obj_conv;
63560         obj_conv.inner = untag_ptr(obj);
63561         obj_conv.is_owned = ptr_is_owned(obj);
63562         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63563         obj_conv.is_owned = false;
63564         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
63565         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63566         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63567         CVec_u8Z_free(ret_var);
63568         return ret_arr;
63569 }
63570
63571 int64_t  CS_LDK_NodeAnnouncementInfo_read(int8_tArray ser) {
63572         LDKu8slice ser_ref;
63573         ser_ref.datalen = ser->arr_len;
63574         ser_ref.data = ser->elems;
63575         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
63576         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
63577         FREE(ser);
63578         return tag_ptr(ret_conv, true);
63579 }
63580
63581 void  CS_LDK_NodeAlias_free(int64_t this_obj) {
63582         LDKNodeAlias this_obj_conv;
63583         this_obj_conv.inner = untag_ptr(this_obj);
63584         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63586         NodeAlias_free(this_obj_conv);
63587 }
63588
63589 int8_tArray  CS_LDK_NodeAlias_get_a(int64_t this_ptr) {
63590         LDKNodeAlias this_ptr_conv;
63591         this_ptr_conv.inner = untag_ptr(this_ptr);
63592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63594         this_ptr_conv.is_owned = false;
63595         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63596         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
63597         return ret_arr;
63598 }
63599
63600 void  CS_LDK_NodeAlias_set_a(int64_t this_ptr, int8_tArray val) {
63601         LDKNodeAlias this_ptr_conv;
63602         this_ptr_conv.inner = untag_ptr(this_ptr);
63603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63605         this_ptr_conv.is_owned = false;
63606         LDKThirtyTwoBytes val_ref;
63607         CHECK(val->arr_len == 32);
63608         memcpy(val_ref.data, val->elems, 32); FREE(val);
63609         NodeAlias_set_a(&this_ptr_conv, val_ref);
63610 }
63611
63612 int64_t  CS_LDK_NodeAlias_new(int8_tArray a_arg) {
63613         LDKThirtyTwoBytes a_arg_ref;
63614         CHECK(a_arg->arr_len == 32);
63615         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63616         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
63617         int64_t ret_ref = 0;
63618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63620         return ret_ref;
63621 }
63622
63623 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
63624         LDKNodeAlias ret_var = NodeAlias_clone(arg);
63625         int64_t ret_ref = 0;
63626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63628         return ret_ref;
63629 }
63630 int64_t  CS_LDK_NodeAlias_clone_ptr(int64_t arg) {
63631         LDKNodeAlias arg_conv;
63632         arg_conv.inner = untag_ptr(arg);
63633         arg_conv.is_owned = ptr_is_owned(arg);
63634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63635         arg_conv.is_owned = false;
63636         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
63637         return ret_conv;
63638 }
63639
63640 int64_t  CS_LDK_NodeAlias_clone(int64_t orig) {
63641         LDKNodeAlias orig_conv;
63642         orig_conv.inner = untag_ptr(orig);
63643         orig_conv.is_owned = ptr_is_owned(orig);
63644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63645         orig_conv.is_owned = false;
63646         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
63647         int64_t ret_ref = 0;
63648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63650         return ret_ref;
63651 }
63652
63653 int64_t  CS_LDK_NodeAlias_hash(int64_t o) {
63654         LDKNodeAlias o_conv;
63655         o_conv.inner = untag_ptr(o);
63656         o_conv.is_owned = ptr_is_owned(o);
63657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63658         o_conv.is_owned = false;
63659         int64_t ret_conv = NodeAlias_hash(&o_conv);
63660         return ret_conv;
63661 }
63662
63663 jboolean  CS_LDK_NodeAlias_eq(int64_t a, int64_t b) {
63664         LDKNodeAlias a_conv;
63665         a_conv.inner = untag_ptr(a);
63666         a_conv.is_owned = ptr_is_owned(a);
63667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63668         a_conv.is_owned = false;
63669         LDKNodeAlias b_conv;
63670         b_conv.inner = untag_ptr(b);
63671         b_conv.is_owned = ptr_is_owned(b);
63672         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63673         b_conv.is_owned = false;
63674         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
63675         return ret_conv;
63676 }
63677
63678 int8_tArray  CS_LDK_NodeAlias_write(int64_t obj) {
63679         LDKNodeAlias obj_conv;
63680         obj_conv.inner = untag_ptr(obj);
63681         obj_conv.is_owned = ptr_is_owned(obj);
63682         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63683         obj_conv.is_owned = false;
63684         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
63685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63687         CVec_u8Z_free(ret_var);
63688         return ret_arr;
63689 }
63690
63691 int64_t  CS_LDK_NodeAlias_read(int8_tArray ser) {
63692         LDKu8slice ser_ref;
63693         ser_ref.datalen = ser->arr_len;
63694         ser_ref.data = ser->elems;
63695         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
63696         *ret_conv = NodeAlias_read(ser_ref);
63697         FREE(ser);
63698         return tag_ptr(ret_conv, true);
63699 }
63700
63701 void  CS_LDK_NodeInfo_free(int64_t this_obj) {
63702         LDKNodeInfo this_obj_conv;
63703         this_obj_conv.inner = untag_ptr(this_obj);
63704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63706         NodeInfo_free(this_obj_conv);
63707 }
63708
63709 int64_tArray  CS_LDK_NodeInfo_get_channels(int64_t this_ptr) {
63710         LDKNodeInfo this_ptr_conv;
63711         this_ptr_conv.inner = untag_ptr(this_ptr);
63712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63714         this_ptr_conv.is_owned = false;
63715         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
63716         int64_tArray ret_arr = NULL;
63717         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63718         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63719         for (size_t g = 0; g < ret_var.datalen; g++) {
63720                 int64_t ret_conv_6_conv = ret_var.data[g];
63721                 ret_arr_ptr[g] = ret_conv_6_conv;
63722         }
63723         
63724         FREE(ret_var.data);
63725         return ret_arr;
63726 }
63727
63728 void  CS_LDK_NodeInfo_set_channels(int64_t this_ptr, int64_tArray val) {
63729         LDKNodeInfo this_ptr_conv;
63730         this_ptr_conv.inner = untag_ptr(this_ptr);
63731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63733         this_ptr_conv.is_owned = false;
63734         LDKCVec_u64Z val_constr;
63735         val_constr.datalen = val->arr_len;
63736         if (val_constr.datalen > 0)
63737                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63738         else
63739                 val_constr.data = NULL;
63740         int64_t* val_vals = val->elems;
63741         for (size_t g = 0; g < val_constr.datalen; g++) {
63742                 int64_t val_conv_6 = val_vals[g];
63743                 val_constr.data[g] = val_conv_6;
63744         }
63745         FREE(val);
63746         NodeInfo_set_channels(&this_ptr_conv, val_constr);
63747 }
63748
63749 int64_t  CS_LDK_NodeInfo_get_announcement_info(int64_t this_ptr) {
63750         LDKNodeInfo this_ptr_conv;
63751         this_ptr_conv.inner = untag_ptr(this_ptr);
63752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63754         this_ptr_conv.is_owned = false;
63755         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
63756         int64_t ret_ref = 0;
63757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63759         return ret_ref;
63760 }
63761
63762 void  CS_LDK_NodeInfo_set_announcement_info(int64_t this_ptr, int64_t val) {
63763         LDKNodeInfo this_ptr_conv;
63764         this_ptr_conv.inner = untag_ptr(this_ptr);
63765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63767         this_ptr_conv.is_owned = false;
63768         LDKNodeAnnouncementInfo val_conv;
63769         val_conv.inner = untag_ptr(val);
63770         val_conv.is_owned = ptr_is_owned(val);
63771         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63772         val_conv = NodeAnnouncementInfo_clone(&val_conv);
63773         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
63774 }
63775
63776 int64_t  CS_LDK_NodeInfo_new(int64_tArray channels_arg, int64_t announcement_info_arg) {
63777         LDKCVec_u64Z channels_arg_constr;
63778         channels_arg_constr.datalen = channels_arg->arr_len;
63779         if (channels_arg_constr.datalen > 0)
63780                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63781         else
63782                 channels_arg_constr.data = NULL;
63783         int64_t* channels_arg_vals = channels_arg->elems;
63784         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
63785                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
63786                 channels_arg_constr.data[g] = channels_arg_conv_6;
63787         }
63788         FREE(channels_arg);
63789         LDKNodeAnnouncementInfo announcement_info_arg_conv;
63790         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
63791         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
63792         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
63793         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
63794         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
63795         int64_t ret_ref = 0;
63796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63798         return ret_ref;
63799 }
63800
63801 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
63802         LDKNodeInfo ret_var = NodeInfo_clone(arg);
63803         int64_t ret_ref = 0;
63804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63806         return ret_ref;
63807 }
63808 int64_t  CS_LDK_NodeInfo_clone_ptr(int64_t arg) {
63809         LDKNodeInfo arg_conv;
63810         arg_conv.inner = untag_ptr(arg);
63811         arg_conv.is_owned = ptr_is_owned(arg);
63812         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63813         arg_conv.is_owned = false;
63814         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
63815         return ret_conv;
63816 }
63817
63818 int64_t  CS_LDK_NodeInfo_clone(int64_t orig) {
63819         LDKNodeInfo orig_conv;
63820         orig_conv.inner = untag_ptr(orig);
63821         orig_conv.is_owned = ptr_is_owned(orig);
63822         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63823         orig_conv.is_owned = false;
63824         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
63825         int64_t ret_ref = 0;
63826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63828         return ret_ref;
63829 }
63830
63831 jboolean  CS_LDK_NodeInfo_eq(int64_t a, int64_t b) {
63832         LDKNodeInfo a_conv;
63833         a_conv.inner = untag_ptr(a);
63834         a_conv.is_owned = ptr_is_owned(a);
63835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63836         a_conv.is_owned = false;
63837         LDKNodeInfo b_conv;
63838         b_conv.inner = untag_ptr(b);
63839         b_conv.is_owned = ptr_is_owned(b);
63840         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63841         b_conv.is_owned = false;
63842         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
63843         return ret_conv;
63844 }
63845
63846 int8_tArray  CS_LDK_NodeInfo_write(int64_t obj) {
63847         LDKNodeInfo obj_conv;
63848         obj_conv.inner = untag_ptr(obj);
63849         obj_conv.is_owned = ptr_is_owned(obj);
63850         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63851         obj_conv.is_owned = false;
63852         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
63853         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63854         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63855         CVec_u8Z_free(ret_var);
63856         return ret_arr;
63857 }
63858
63859 int64_t  CS_LDK_NodeInfo_read(int8_tArray ser) {
63860         LDKu8slice ser_ref;
63861         ser_ref.datalen = ser->arr_len;
63862         ser_ref.data = ser->elems;
63863         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
63864         *ret_conv = NodeInfo_read(ser_ref);
63865         FREE(ser);
63866         return tag_ptr(ret_conv, true);
63867 }
63868
63869 int8_tArray  CS_LDK_NetworkGraph_write(int64_t obj) {
63870         LDKNetworkGraph obj_conv;
63871         obj_conv.inner = untag_ptr(obj);
63872         obj_conv.is_owned = ptr_is_owned(obj);
63873         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63874         obj_conv.is_owned = false;
63875         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
63876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63878         CVec_u8Z_free(ret_var);
63879         return ret_arr;
63880 }
63881
63882 int64_t  CS_LDK_NetworkGraph_read(int8_tArray ser, int64_t arg) {
63883         LDKu8slice ser_ref;
63884         ser_ref.datalen = ser->arr_len;
63885         ser_ref.data = ser->elems;
63886         void* arg_ptr = untag_ptr(arg);
63887         CHECK_ACCESS(arg_ptr);
63888         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
63889         if (arg_conv.free == LDKLogger_JCalls_free) {
63890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63891                 LDKLogger_JCalls_cloned(&arg_conv);
63892         }
63893         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
63894         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
63895         FREE(ser);
63896         return tag_ptr(ret_conv, true);
63897 }
63898
63899 int64_t  CS_LDK_NetworkGraph_new(int32_t network, int64_t logger) {
63900         LDKNetwork network_conv = LDKNetwork_from_cs(network);
63901         void* logger_ptr = untag_ptr(logger);
63902         CHECK_ACCESS(logger_ptr);
63903         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63904         if (logger_conv.free == LDKLogger_JCalls_free) {
63905                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63906                 LDKLogger_JCalls_cloned(&logger_conv);
63907         }
63908         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
63909         int64_t ret_ref = 0;
63910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63912         return ret_ref;
63913 }
63914
63915 int64_t  CS_LDK_NetworkGraph_read_only(int64_t this_arg) {
63916         LDKNetworkGraph this_arg_conv;
63917         this_arg_conv.inner = untag_ptr(this_arg);
63918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63920         this_arg_conv.is_owned = false;
63921         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
63922         int64_t ret_ref = 0;
63923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63925         return ret_ref;
63926 }
63927
63928 int64_t  CS_LDK_NetworkGraph_get_last_rapid_gossip_sync_timestamp(int64_t this_arg) {
63929         LDKNetworkGraph this_arg_conv;
63930         this_arg_conv.inner = untag_ptr(this_arg);
63931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63933         this_arg_conv.is_owned = false;
63934         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63935         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
63936         int64_t ret_ref = tag_ptr(ret_copy, true);
63937         return ret_ref;
63938 }
63939
63940 void  CS_LDK_NetworkGraph_set_last_rapid_gossip_sync_timestamp(int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
63941         LDKNetworkGraph this_arg_conv;
63942         this_arg_conv.inner = untag_ptr(this_arg);
63943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63945         this_arg_conv.is_owned = false;
63946         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
63947 }
63948
63949 int64_t  CS_LDK_NetworkGraph_update_node_from_announcement(int64_t this_arg, int64_t msg) {
63950         LDKNetworkGraph this_arg_conv;
63951         this_arg_conv.inner = untag_ptr(this_arg);
63952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63954         this_arg_conv.is_owned = false;
63955         LDKNodeAnnouncement msg_conv;
63956         msg_conv.inner = untag_ptr(msg);
63957         msg_conv.is_owned = ptr_is_owned(msg);
63958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63959         msg_conv.is_owned = false;
63960         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63961         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
63962         return tag_ptr(ret_conv, true);
63963 }
63964
63965 int64_t  CS_LDK_NetworkGraph_update_node_from_unsigned_announcement(int64_t this_arg, int64_t msg) {
63966         LDKNetworkGraph this_arg_conv;
63967         this_arg_conv.inner = untag_ptr(this_arg);
63968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63970         this_arg_conv.is_owned = false;
63971         LDKUnsignedNodeAnnouncement msg_conv;
63972         msg_conv.inner = untag_ptr(msg);
63973         msg_conv.is_owned = ptr_is_owned(msg);
63974         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63975         msg_conv.is_owned = false;
63976         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63977         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
63978         return tag_ptr(ret_conv, true);
63979 }
63980
63981 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
63982         LDKNetworkGraph this_arg_conv;
63983         this_arg_conv.inner = untag_ptr(this_arg);
63984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63986         this_arg_conv.is_owned = false;
63987         LDKChannelAnnouncement msg_conv;
63988         msg_conv.inner = untag_ptr(msg);
63989         msg_conv.is_owned = ptr_is_owned(msg);
63990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63991         msg_conv.is_owned = false;
63992         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63993         CHECK_ACCESS(utxo_lookup_ptr);
63994         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63995         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63996         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63997                 // Manually implement clone for Java trait instances
63998                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63999                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64000                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
64001                 }
64002         }
64003         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64004         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
64005         return tag_ptr(ret_conv, true);
64006 }
64007
64008 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement_no_lookup(int64_t this_arg, int64_t msg) {
64009         LDKNetworkGraph this_arg_conv;
64010         this_arg_conv.inner = untag_ptr(this_arg);
64011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64013         this_arg_conv.is_owned = false;
64014         LDKChannelAnnouncement msg_conv;
64015         msg_conv.inner = untag_ptr(msg);
64016         msg_conv.is_owned = ptr_is_owned(msg);
64017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64018         msg_conv.is_owned = false;
64019         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64020         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
64021         return tag_ptr(ret_conv, true);
64022 }
64023
64024 int64_t  CS_LDK_NetworkGraph_update_channel_from_unsigned_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
64025         LDKNetworkGraph this_arg_conv;
64026         this_arg_conv.inner = untag_ptr(this_arg);
64027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64029         this_arg_conv.is_owned = false;
64030         LDKUnsignedChannelAnnouncement msg_conv;
64031         msg_conv.inner = untag_ptr(msg);
64032         msg_conv.is_owned = ptr_is_owned(msg);
64033         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64034         msg_conv.is_owned = false;
64035         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
64036         CHECK_ACCESS(utxo_lookup_ptr);
64037         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
64038         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
64039         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
64040                 // Manually implement clone for Java trait instances
64041                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
64042                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64043                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
64044                 }
64045         }
64046         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64047         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
64048         return tag_ptr(ret_conv, true);
64049 }
64050
64051 int64_t  CS_LDK_NetworkGraph_add_channel_from_partial_announcement(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) {
64052         LDKNetworkGraph this_arg_conv;
64053         this_arg_conv.inner = untag_ptr(this_arg);
64054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64056         this_arg_conv.is_owned = false;
64057         LDKChannelFeatures features_conv;
64058         features_conv.inner = untag_ptr(features);
64059         features_conv.is_owned = ptr_is_owned(features);
64060         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
64061         features_conv = ChannelFeatures_clone(&features_conv);
64062         LDKPublicKey node_id_1_ref;
64063         CHECK(node_id_1->arr_len == 33);
64064         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
64065         LDKPublicKey node_id_2_ref;
64066         CHECK(node_id_2->arr_len == 33);
64067         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
64068         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64069         *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);
64070         return tag_ptr(ret_conv, true);
64071 }
64072
64073 void  CS_LDK_NetworkGraph_channel_failed_permanent(int64_t this_arg, int64_t short_channel_id) {
64074         LDKNetworkGraph this_arg_conv;
64075         this_arg_conv.inner = untag_ptr(this_arg);
64076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64078         this_arg_conv.is_owned = false;
64079         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
64080 }
64081
64082 void  CS_LDK_NetworkGraph_node_failed_permanent(int64_t this_arg, int8_tArray node_id) {
64083         LDKNetworkGraph this_arg_conv;
64084         this_arg_conv.inner = untag_ptr(this_arg);
64085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64087         this_arg_conv.is_owned = false;
64088         LDKPublicKey node_id_ref;
64089         CHECK(node_id->arr_len == 33);
64090         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
64091         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
64092 }
64093
64094 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking(int64_t this_arg) {
64095         LDKNetworkGraph this_arg_conv;
64096         this_arg_conv.inner = untag_ptr(this_arg);
64097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64099         this_arg_conv.is_owned = false;
64100         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
64101 }
64102
64103 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking_with_time(int64_t this_arg, int64_t current_time_unix) {
64104         LDKNetworkGraph this_arg_conv;
64105         this_arg_conv.inner = untag_ptr(this_arg);
64106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64108         this_arg_conv.is_owned = false;
64109         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
64110 }
64111
64112 int64_t  CS_LDK_NetworkGraph_update_channel(int64_t this_arg, int64_t msg) {
64113         LDKNetworkGraph this_arg_conv;
64114         this_arg_conv.inner = untag_ptr(this_arg);
64115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64117         this_arg_conv.is_owned = false;
64118         LDKChannelUpdate msg_conv;
64119         msg_conv.inner = untag_ptr(msg);
64120         msg_conv.is_owned = ptr_is_owned(msg);
64121         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64122         msg_conv.is_owned = false;
64123         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64124         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
64125         return tag_ptr(ret_conv, true);
64126 }
64127
64128 int64_t  CS_LDK_NetworkGraph_update_channel_unsigned(int64_t this_arg, int64_t msg) {
64129         LDKNetworkGraph this_arg_conv;
64130         this_arg_conv.inner = untag_ptr(this_arg);
64131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64133         this_arg_conv.is_owned = false;
64134         LDKUnsignedChannelUpdate msg_conv;
64135         msg_conv.inner = untag_ptr(msg);
64136         msg_conv.is_owned = ptr_is_owned(msg);
64137         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64138         msg_conv.is_owned = false;
64139         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64140         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
64141         return tag_ptr(ret_conv, true);
64142 }
64143
64144 int64_t  CS_LDK_NetworkGraph_verify_channel_update(int64_t this_arg, int64_t msg) {
64145         LDKNetworkGraph this_arg_conv;
64146         this_arg_conv.inner = untag_ptr(this_arg);
64147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64149         this_arg_conv.is_owned = false;
64150         LDKChannelUpdate msg_conv;
64151         msg_conv.inner = untag_ptr(msg);
64152         msg_conv.is_owned = ptr_is_owned(msg);
64153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64154         msg_conv.is_owned = false;
64155         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64156         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
64157         return tag_ptr(ret_conv, true);
64158 }
64159
64160 int64_t  CS_LDK_ReadOnlyNetworkGraph_channel(int64_t this_arg, int64_t short_channel_id) {
64161         LDKReadOnlyNetworkGraph this_arg_conv;
64162         this_arg_conv.inner = untag_ptr(this_arg);
64163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64165         this_arg_conv.is_owned = false;
64166         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
64167         int64_t ret_ref = 0;
64168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64170         return ret_ref;
64171 }
64172
64173 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_channels(int64_t this_arg) {
64174         LDKReadOnlyNetworkGraph this_arg_conv;
64175         this_arg_conv.inner = untag_ptr(this_arg);
64176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64178         this_arg_conv.is_owned = false;
64179         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
64180         int64_tArray ret_arr = NULL;
64181         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64182         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64183         for (size_t g = 0; g < ret_var.datalen; g++) {
64184                 int64_t ret_conv_6_conv = ret_var.data[g];
64185                 ret_arr_ptr[g] = ret_conv_6_conv;
64186         }
64187         
64188         FREE(ret_var.data);
64189         return ret_arr;
64190 }
64191
64192 int64_t  CS_LDK_ReadOnlyNetworkGraph_node(int64_t this_arg, int64_t node_id) {
64193         LDKReadOnlyNetworkGraph this_arg_conv;
64194         this_arg_conv.inner = untag_ptr(this_arg);
64195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64197         this_arg_conv.is_owned = false;
64198         LDKNodeId node_id_conv;
64199         node_id_conv.inner = untag_ptr(node_id);
64200         node_id_conv.is_owned = ptr_is_owned(node_id);
64201         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
64202         node_id_conv.is_owned = false;
64203         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
64204         int64_t ret_ref = 0;
64205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64207         return ret_ref;
64208 }
64209
64210 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_nodes(int64_t this_arg) {
64211         LDKReadOnlyNetworkGraph this_arg_conv;
64212         this_arg_conv.inner = untag_ptr(this_arg);
64213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64215         this_arg_conv.is_owned = false;
64216         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
64217         int64_tArray ret_arr = NULL;
64218         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64219         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64220         for (size_t i = 0; i < ret_var.datalen; i++) {
64221                 LDKNodeId ret_conv_8_var = ret_var.data[i];
64222                 int64_t ret_conv_8_ref = 0;
64223                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
64224                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
64225                 ret_arr_ptr[i] = ret_conv_8_ref;
64226         }
64227         
64228         FREE(ret_var.data);
64229         return ret_arr;
64230 }
64231
64232 int64_t  CS_LDK_ReadOnlyNetworkGraph_get_addresses(int64_t this_arg, int8_tArray pubkey) {
64233         LDKReadOnlyNetworkGraph this_arg_conv;
64234         this_arg_conv.inner = untag_ptr(this_arg);
64235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64237         this_arg_conv.is_owned = false;
64238         LDKPublicKey pubkey_ref;
64239         CHECK(pubkey->arr_len == 33);
64240         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
64241         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
64242         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
64243         int64_t ret_ref = tag_ptr(ret_copy, true);
64244         return ret_ref;
64245 }
64246
64247 void  CS_LDK_DefaultRouter_free(int64_t this_obj) {
64248         LDKDefaultRouter this_obj_conv;
64249         this_obj_conv.inner = untag_ptr(this_obj);
64250         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64252         DefaultRouter_free(this_obj_conv);
64253 }
64254
64255 int64_t  CS_LDK_DefaultRouter_new(int64_t network_graph, int64_t logger, int64_t entropy_source, int64_t scorer, int64_t score_params) {
64256         LDKNetworkGraph network_graph_conv;
64257         network_graph_conv.inner = untag_ptr(network_graph);
64258         network_graph_conv.is_owned = ptr_is_owned(network_graph);
64259         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
64260         network_graph_conv.is_owned = false;
64261         void* logger_ptr = untag_ptr(logger);
64262         CHECK_ACCESS(logger_ptr);
64263         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64264         if (logger_conv.free == LDKLogger_JCalls_free) {
64265                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64266                 LDKLogger_JCalls_cloned(&logger_conv);
64267         }
64268         void* entropy_source_ptr = untag_ptr(entropy_source);
64269         CHECK_ACCESS(entropy_source_ptr);
64270         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64271         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64272                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64273                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64274         }
64275         void* scorer_ptr = untag_ptr(scorer);
64276         CHECK_ACCESS(scorer_ptr);
64277         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
64278         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
64279                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64280                 LDKLockableScore_JCalls_cloned(&scorer_conv);
64281         }
64282         LDKProbabilisticScoringFeeParameters score_params_conv;
64283         score_params_conv.inner = untag_ptr(score_params);
64284         score_params_conv.is_owned = ptr_is_owned(score_params);
64285         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
64286         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
64287         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
64288         int64_t ret_ref = 0;
64289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64291         return ret_ref;
64292 }
64293
64294 int64_t  CS_LDK_DefaultRouter_as_Router(int64_t this_arg) {
64295         LDKDefaultRouter this_arg_conv;
64296         this_arg_conv.inner = untag_ptr(this_arg);
64297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64299         this_arg_conv.is_owned = false;
64300         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
64301         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
64302         return tag_ptr(ret_ret, true);
64303 }
64304
64305 int64_t  CS_LDK_DefaultRouter_as_MessageRouter(int64_t this_arg) {
64306         LDKDefaultRouter this_arg_conv;
64307         this_arg_conv.inner = untag_ptr(this_arg);
64308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64310         this_arg_conv.is_owned = false;
64311         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
64312         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
64313         return tag_ptr(ret_ret, true);
64314 }
64315
64316 void  CS_LDK_Router_free(int64_t this_ptr) {
64317         if (!ptr_is_owned(this_ptr)) return;
64318         void* this_ptr_ptr = untag_ptr(this_ptr);
64319         CHECK_ACCESS(this_ptr_ptr);
64320         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
64321         FREE(untag_ptr(this_ptr));
64322         Router_free(this_ptr_conv);
64323 }
64324
64325 void  CS_LDK_ScorerAccountingForInFlightHtlcs_free(int64_t this_obj) {
64326         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
64327         this_obj_conv.inner = untag_ptr(this_obj);
64328         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64330         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
64331 }
64332
64333 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_new(int64_t scorer, int64_t inflight_htlcs) {
64334         void* scorer_ptr = untag_ptr(scorer);
64335         CHECK_ACCESS(scorer_ptr);
64336         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
64337         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
64338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64339                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
64340         }
64341         LDKInFlightHtlcs inflight_htlcs_conv;
64342         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
64343         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
64344         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
64345         inflight_htlcs_conv.is_owned = false;
64346         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
64347         int64_t ret_ref = 0;
64348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64350         return ret_ref;
64351 }
64352
64353 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(int64_t this_arg) {
64354         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
64355         this_arg_conv.inner = untag_ptr(this_arg);
64356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64358         this_arg_conv.is_owned = false;
64359         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
64360         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
64361         return tag_ptr(ret_ret, true);
64362 }
64363
64364 void  CS_LDK_InFlightHtlcs_free(int64_t this_obj) {
64365         LDKInFlightHtlcs this_obj_conv;
64366         this_obj_conv.inner = untag_ptr(this_obj);
64367         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64369         InFlightHtlcs_free(this_obj_conv);
64370 }
64371
64372 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
64373         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
64374         int64_t ret_ref = 0;
64375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64377         return ret_ref;
64378 }
64379 int64_t  CS_LDK_InFlightHtlcs_clone_ptr(int64_t arg) {
64380         LDKInFlightHtlcs arg_conv;
64381         arg_conv.inner = untag_ptr(arg);
64382         arg_conv.is_owned = ptr_is_owned(arg);
64383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64384         arg_conv.is_owned = false;
64385         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
64386         return ret_conv;
64387 }
64388
64389 int64_t  CS_LDK_InFlightHtlcs_clone(int64_t orig) {
64390         LDKInFlightHtlcs orig_conv;
64391         orig_conv.inner = untag_ptr(orig);
64392         orig_conv.is_owned = ptr_is_owned(orig);
64393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64394         orig_conv.is_owned = false;
64395         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
64396         int64_t ret_ref = 0;
64397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64399         return ret_ref;
64400 }
64401
64402 int64_t  CS_LDK_InFlightHtlcs_new() {
64403         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
64404         int64_t ret_ref = 0;
64405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64407         return ret_ref;
64408 }
64409
64410 void  CS_LDK_InFlightHtlcs_process_path(int64_t this_arg, int64_t path, int8_tArray payer_node_id) {
64411         LDKInFlightHtlcs this_arg_conv;
64412         this_arg_conv.inner = untag_ptr(this_arg);
64413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64415         this_arg_conv.is_owned = false;
64416         LDKPath path_conv;
64417         path_conv.inner = untag_ptr(path);
64418         path_conv.is_owned = ptr_is_owned(path);
64419         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64420         path_conv.is_owned = false;
64421         LDKPublicKey payer_node_id_ref;
64422         CHECK(payer_node_id->arr_len == 33);
64423         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
64424         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
64425 }
64426
64427 void  CS_LDK_InFlightHtlcs_add_inflight_htlc(int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid, int64_t used_msat) {
64428         LDKInFlightHtlcs this_arg_conv;
64429         this_arg_conv.inner = untag_ptr(this_arg);
64430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64432         this_arg_conv.is_owned = false;
64433         LDKNodeId source_conv;
64434         source_conv.inner = untag_ptr(source);
64435         source_conv.is_owned = ptr_is_owned(source);
64436         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
64437         source_conv.is_owned = false;
64438         LDKNodeId target_conv;
64439         target_conv.inner = untag_ptr(target);
64440         target_conv.is_owned = ptr_is_owned(target);
64441         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
64442         target_conv.is_owned = false;
64443         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
64444 }
64445
64446 int64_t  CS_LDK_InFlightHtlcs_used_liquidity_msat(int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
64447         LDKInFlightHtlcs this_arg_conv;
64448         this_arg_conv.inner = untag_ptr(this_arg);
64449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64451         this_arg_conv.is_owned = false;
64452         LDKNodeId source_conv;
64453         source_conv.inner = untag_ptr(source);
64454         source_conv.is_owned = ptr_is_owned(source);
64455         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
64456         source_conv.is_owned = false;
64457         LDKNodeId target_conv;
64458         target_conv.inner = untag_ptr(target);
64459         target_conv.is_owned = ptr_is_owned(target);
64460         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
64461         target_conv.is_owned = false;
64462         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64463         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
64464         int64_t ret_ref = tag_ptr(ret_copy, true);
64465         return ret_ref;
64466 }
64467
64468 int8_tArray  CS_LDK_InFlightHtlcs_write(int64_t obj) {
64469         LDKInFlightHtlcs obj_conv;
64470         obj_conv.inner = untag_ptr(obj);
64471         obj_conv.is_owned = ptr_is_owned(obj);
64472         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64473         obj_conv.is_owned = false;
64474         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
64475         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64476         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64477         CVec_u8Z_free(ret_var);
64478         return ret_arr;
64479 }
64480
64481 int64_t  CS_LDK_InFlightHtlcs_read(int8_tArray ser) {
64482         LDKu8slice ser_ref;
64483         ser_ref.datalen = ser->arr_len;
64484         ser_ref.data = ser->elems;
64485         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
64486         *ret_conv = InFlightHtlcs_read(ser_ref);
64487         FREE(ser);
64488         return tag_ptr(ret_conv, true);
64489 }
64490
64491 void  CS_LDK_RouteHop_free(int64_t this_obj) {
64492         LDKRouteHop this_obj_conv;
64493         this_obj_conv.inner = untag_ptr(this_obj);
64494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64496         RouteHop_free(this_obj_conv);
64497 }
64498
64499 int8_tArray  CS_LDK_RouteHop_get_pubkey(int64_t this_ptr) {
64500         LDKRouteHop this_ptr_conv;
64501         this_ptr_conv.inner = untag_ptr(this_ptr);
64502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64504         this_ptr_conv.is_owned = false;
64505         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64506         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
64507         return ret_arr;
64508 }
64509
64510 void  CS_LDK_RouteHop_set_pubkey(int64_t this_ptr, int8_tArray val) {
64511         LDKRouteHop this_ptr_conv;
64512         this_ptr_conv.inner = untag_ptr(this_ptr);
64513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64515         this_ptr_conv.is_owned = false;
64516         LDKPublicKey val_ref;
64517         CHECK(val->arr_len == 33);
64518         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64519         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
64520 }
64521
64522 int64_t  CS_LDK_RouteHop_get_node_features(int64_t this_ptr) {
64523         LDKRouteHop this_ptr_conv;
64524         this_ptr_conv.inner = untag_ptr(this_ptr);
64525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64527         this_ptr_conv.is_owned = false;
64528         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
64529         int64_t ret_ref = 0;
64530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64532         return ret_ref;
64533 }
64534
64535 void  CS_LDK_RouteHop_set_node_features(int64_t this_ptr, int64_t val) {
64536         LDKRouteHop this_ptr_conv;
64537         this_ptr_conv.inner = untag_ptr(this_ptr);
64538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64540         this_ptr_conv.is_owned = false;
64541         LDKNodeFeatures val_conv;
64542         val_conv.inner = untag_ptr(val);
64543         val_conv.is_owned = ptr_is_owned(val);
64544         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64545         val_conv = NodeFeatures_clone(&val_conv);
64546         RouteHop_set_node_features(&this_ptr_conv, val_conv);
64547 }
64548
64549 int64_t  CS_LDK_RouteHop_get_short_channel_id(int64_t this_ptr) {
64550         LDKRouteHop this_ptr_conv;
64551         this_ptr_conv.inner = untag_ptr(this_ptr);
64552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64554         this_ptr_conv.is_owned = false;
64555         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
64556         return ret_conv;
64557 }
64558
64559 void  CS_LDK_RouteHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
64560         LDKRouteHop this_ptr_conv;
64561         this_ptr_conv.inner = untag_ptr(this_ptr);
64562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64564         this_ptr_conv.is_owned = false;
64565         RouteHop_set_short_channel_id(&this_ptr_conv, val);
64566 }
64567
64568 int64_t  CS_LDK_RouteHop_get_channel_features(int64_t this_ptr) {
64569         LDKRouteHop this_ptr_conv;
64570         this_ptr_conv.inner = untag_ptr(this_ptr);
64571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64573         this_ptr_conv.is_owned = false;
64574         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
64575         int64_t ret_ref = 0;
64576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64578         return ret_ref;
64579 }
64580
64581 void  CS_LDK_RouteHop_set_channel_features(int64_t this_ptr, int64_t val) {
64582         LDKRouteHop this_ptr_conv;
64583         this_ptr_conv.inner = untag_ptr(this_ptr);
64584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64586         this_ptr_conv.is_owned = false;
64587         LDKChannelFeatures val_conv;
64588         val_conv.inner = untag_ptr(val);
64589         val_conv.is_owned = ptr_is_owned(val);
64590         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64591         val_conv = ChannelFeatures_clone(&val_conv);
64592         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
64593 }
64594
64595 int64_t  CS_LDK_RouteHop_get_fee_msat(int64_t this_ptr) {
64596         LDKRouteHop this_ptr_conv;
64597         this_ptr_conv.inner = untag_ptr(this_ptr);
64598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64600         this_ptr_conv.is_owned = false;
64601         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
64602         return ret_conv;
64603 }
64604
64605 void  CS_LDK_RouteHop_set_fee_msat(int64_t this_ptr, int64_t val) {
64606         LDKRouteHop this_ptr_conv;
64607         this_ptr_conv.inner = untag_ptr(this_ptr);
64608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64610         this_ptr_conv.is_owned = false;
64611         RouteHop_set_fee_msat(&this_ptr_conv, val);
64612 }
64613
64614 int32_t  CS_LDK_RouteHop_get_cltv_expiry_delta(int64_t this_ptr) {
64615         LDKRouteHop this_ptr_conv;
64616         this_ptr_conv.inner = untag_ptr(this_ptr);
64617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64619         this_ptr_conv.is_owned = false;
64620         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
64621         return ret_conv;
64622 }
64623
64624 void  CS_LDK_RouteHop_set_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
64625         LDKRouteHop this_ptr_conv;
64626         this_ptr_conv.inner = untag_ptr(this_ptr);
64627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64629         this_ptr_conv.is_owned = false;
64630         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
64631 }
64632
64633 jboolean  CS_LDK_RouteHop_get_maybe_announced_channel(int64_t this_ptr) {
64634         LDKRouteHop this_ptr_conv;
64635         this_ptr_conv.inner = untag_ptr(this_ptr);
64636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64638         this_ptr_conv.is_owned = false;
64639         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
64640         return ret_conv;
64641 }
64642
64643 void  CS_LDK_RouteHop_set_maybe_announced_channel(int64_t this_ptr, jboolean val) {
64644         LDKRouteHop this_ptr_conv;
64645         this_ptr_conv.inner = untag_ptr(this_ptr);
64646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64648         this_ptr_conv.is_owned = false;
64649         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
64650 }
64651
64652 int64_t  CS_LDK_RouteHop_new(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, jboolean maybe_announced_channel_arg) {
64653         LDKPublicKey pubkey_arg_ref;
64654         CHECK(pubkey_arg->arr_len == 33);
64655         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
64656         LDKNodeFeatures node_features_arg_conv;
64657         node_features_arg_conv.inner = untag_ptr(node_features_arg);
64658         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
64659         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
64660         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
64661         LDKChannelFeatures channel_features_arg_conv;
64662         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
64663         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
64664         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
64665         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
64666         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, maybe_announced_channel_arg);
64667         int64_t ret_ref = 0;
64668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64670         return ret_ref;
64671 }
64672
64673 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
64674         LDKRouteHop ret_var = RouteHop_clone(arg);
64675         int64_t ret_ref = 0;
64676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64678         return ret_ref;
64679 }
64680 int64_t  CS_LDK_RouteHop_clone_ptr(int64_t arg) {
64681         LDKRouteHop arg_conv;
64682         arg_conv.inner = untag_ptr(arg);
64683         arg_conv.is_owned = ptr_is_owned(arg);
64684         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64685         arg_conv.is_owned = false;
64686         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
64687         return ret_conv;
64688 }
64689
64690 int64_t  CS_LDK_RouteHop_clone(int64_t orig) {
64691         LDKRouteHop orig_conv;
64692         orig_conv.inner = untag_ptr(orig);
64693         orig_conv.is_owned = ptr_is_owned(orig);
64694         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64695         orig_conv.is_owned = false;
64696         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
64697         int64_t ret_ref = 0;
64698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64700         return ret_ref;
64701 }
64702
64703 int64_t  CS_LDK_RouteHop_hash(int64_t o) {
64704         LDKRouteHop o_conv;
64705         o_conv.inner = untag_ptr(o);
64706         o_conv.is_owned = ptr_is_owned(o);
64707         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64708         o_conv.is_owned = false;
64709         int64_t ret_conv = RouteHop_hash(&o_conv);
64710         return ret_conv;
64711 }
64712
64713 jboolean  CS_LDK_RouteHop_eq(int64_t a, int64_t b) {
64714         LDKRouteHop a_conv;
64715         a_conv.inner = untag_ptr(a);
64716         a_conv.is_owned = ptr_is_owned(a);
64717         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64718         a_conv.is_owned = false;
64719         LDKRouteHop b_conv;
64720         b_conv.inner = untag_ptr(b);
64721         b_conv.is_owned = ptr_is_owned(b);
64722         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64723         b_conv.is_owned = false;
64724         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
64725         return ret_conv;
64726 }
64727
64728 int8_tArray  CS_LDK_RouteHop_write(int64_t obj) {
64729         LDKRouteHop obj_conv;
64730         obj_conv.inner = untag_ptr(obj);
64731         obj_conv.is_owned = ptr_is_owned(obj);
64732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64733         obj_conv.is_owned = false;
64734         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
64735         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64736         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64737         CVec_u8Z_free(ret_var);
64738         return ret_arr;
64739 }
64740
64741 int64_t  CS_LDK_RouteHop_read(int8_tArray ser) {
64742         LDKu8slice ser_ref;
64743         ser_ref.datalen = ser->arr_len;
64744         ser_ref.data = ser->elems;
64745         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
64746         *ret_conv = RouteHop_read(ser_ref);
64747         FREE(ser);
64748         return tag_ptr(ret_conv, true);
64749 }
64750
64751 void  CS_LDK_BlindedTail_free(int64_t this_obj) {
64752         LDKBlindedTail this_obj_conv;
64753         this_obj_conv.inner = untag_ptr(this_obj);
64754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64756         BlindedTail_free(this_obj_conv);
64757 }
64758
64759 int64_tArray  CS_LDK_BlindedTail_get_hops(int64_t this_ptr) {
64760         LDKBlindedTail this_ptr_conv;
64761         this_ptr_conv.inner = untag_ptr(this_ptr);
64762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64764         this_ptr_conv.is_owned = false;
64765         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
64766         int64_tArray ret_arr = NULL;
64767         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64768         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64769         for (size_t m = 0; m < ret_var.datalen; m++) {
64770                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64771                 int64_t ret_conv_12_ref = 0;
64772                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64773                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64774                 ret_arr_ptr[m] = ret_conv_12_ref;
64775         }
64776         
64777         FREE(ret_var.data);
64778         return ret_arr;
64779 }
64780
64781 void  CS_LDK_BlindedTail_set_hops(int64_t this_ptr, int64_tArray val) {
64782         LDKBlindedTail this_ptr_conv;
64783         this_ptr_conv.inner = untag_ptr(this_ptr);
64784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64786         this_ptr_conv.is_owned = false;
64787         LDKCVec_BlindedHopZ val_constr;
64788         val_constr.datalen = val->arr_len;
64789         if (val_constr.datalen > 0)
64790                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64791         else
64792                 val_constr.data = NULL;
64793         int64_t* val_vals = val->elems;
64794         for (size_t m = 0; m < val_constr.datalen; m++) {
64795                 int64_t val_conv_12 = val_vals[m];
64796                 LDKBlindedHop val_conv_12_conv;
64797                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64798                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64799                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64800                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64801                 val_constr.data[m] = val_conv_12_conv;
64802         }
64803         FREE(val);
64804         BlindedTail_set_hops(&this_ptr_conv, val_constr);
64805 }
64806
64807 int8_tArray  CS_LDK_BlindedTail_get_blinding_point(int64_t this_ptr) {
64808         LDKBlindedTail this_ptr_conv;
64809         this_ptr_conv.inner = untag_ptr(this_ptr);
64810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64812         this_ptr_conv.is_owned = false;
64813         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64814         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
64815         return ret_arr;
64816 }
64817
64818 void  CS_LDK_BlindedTail_set_blinding_point(int64_t this_ptr, int8_tArray val) {
64819         LDKBlindedTail this_ptr_conv;
64820         this_ptr_conv.inner = untag_ptr(this_ptr);
64821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64823         this_ptr_conv.is_owned = false;
64824         LDKPublicKey val_ref;
64825         CHECK(val->arr_len == 33);
64826         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64827         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
64828 }
64829
64830 int32_t  CS_LDK_BlindedTail_get_excess_final_cltv_expiry_delta(int64_t this_ptr) {
64831         LDKBlindedTail this_ptr_conv;
64832         this_ptr_conv.inner = untag_ptr(this_ptr);
64833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64835         this_ptr_conv.is_owned = false;
64836         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
64837         return ret_conv;
64838 }
64839
64840 void  CS_LDK_BlindedTail_set_excess_final_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
64841         LDKBlindedTail this_ptr_conv;
64842         this_ptr_conv.inner = untag_ptr(this_ptr);
64843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64845         this_ptr_conv.is_owned = false;
64846         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
64847 }
64848
64849 int64_t  CS_LDK_BlindedTail_get_final_value_msat(int64_t this_ptr) {
64850         LDKBlindedTail this_ptr_conv;
64851         this_ptr_conv.inner = untag_ptr(this_ptr);
64852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64854         this_ptr_conv.is_owned = false;
64855         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
64856         return ret_conv;
64857 }
64858
64859 void  CS_LDK_BlindedTail_set_final_value_msat(int64_t this_ptr, int64_t val) {
64860         LDKBlindedTail this_ptr_conv;
64861         this_ptr_conv.inner = untag_ptr(this_ptr);
64862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64864         this_ptr_conv.is_owned = false;
64865         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
64866 }
64867
64868 int64_t  CS_LDK_BlindedTail_new(int64_tArray hops_arg, int8_tArray blinding_point_arg, int32_t excess_final_cltv_expiry_delta_arg, int64_t final_value_msat_arg) {
64869         LDKCVec_BlindedHopZ hops_arg_constr;
64870         hops_arg_constr.datalen = hops_arg->arr_len;
64871         if (hops_arg_constr.datalen > 0)
64872                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64873         else
64874                 hops_arg_constr.data = NULL;
64875         int64_t* hops_arg_vals = hops_arg->elems;
64876         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
64877                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
64878                 LDKBlindedHop hops_arg_conv_12_conv;
64879                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
64880                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
64881                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
64882                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
64883                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
64884         }
64885         FREE(hops_arg);
64886         LDKPublicKey blinding_point_arg_ref;
64887         CHECK(blinding_point_arg->arr_len == 33);
64888         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
64889         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
64890         int64_t ret_ref = 0;
64891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64893         return ret_ref;
64894 }
64895
64896 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
64897         LDKBlindedTail ret_var = BlindedTail_clone(arg);
64898         int64_t ret_ref = 0;
64899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64901         return ret_ref;
64902 }
64903 int64_t  CS_LDK_BlindedTail_clone_ptr(int64_t arg) {
64904         LDKBlindedTail arg_conv;
64905         arg_conv.inner = untag_ptr(arg);
64906         arg_conv.is_owned = ptr_is_owned(arg);
64907         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64908         arg_conv.is_owned = false;
64909         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
64910         return ret_conv;
64911 }
64912
64913 int64_t  CS_LDK_BlindedTail_clone(int64_t orig) {
64914         LDKBlindedTail orig_conv;
64915         orig_conv.inner = untag_ptr(orig);
64916         orig_conv.is_owned = ptr_is_owned(orig);
64917         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64918         orig_conv.is_owned = false;
64919         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
64920         int64_t ret_ref = 0;
64921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64923         return ret_ref;
64924 }
64925
64926 int64_t  CS_LDK_BlindedTail_hash(int64_t o) {
64927         LDKBlindedTail o_conv;
64928         o_conv.inner = untag_ptr(o);
64929         o_conv.is_owned = ptr_is_owned(o);
64930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64931         o_conv.is_owned = false;
64932         int64_t ret_conv = BlindedTail_hash(&o_conv);
64933         return ret_conv;
64934 }
64935
64936 jboolean  CS_LDK_BlindedTail_eq(int64_t a, int64_t b) {
64937         LDKBlindedTail a_conv;
64938         a_conv.inner = untag_ptr(a);
64939         a_conv.is_owned = ptr_is_owned(a);
64940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64941         a_conv.is_owned = false;
64942         LDKBlindedTail b_conv;
64943         b_conv.inner = untag_ptr(b);
64944         b_conv.is_owned = ptr_is_owned(b);
64945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64946         b_conv.is_owned = false;
64947         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
64948         return ret_conv;
64949 }
64950
64951 int8_tArray  CS_LDK_BlindedTail_write(int64_t obj) {
64952         LDKBlindedTail obj_conv;
64953         obj_conv.inner = untag_ptr(obj);
64954         obj_conv.is_owned = ptr_is_owned(obj);
64955         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64956         obj_conv.is_owned = false;
64957         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
64958         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64959         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64960         CVec_u8Z_free(ret_var);
64961         return ret_arr;
64962 }
64963
64964 int64_t  CS_LDK_BlindedTail_read(int8_tArray ser) {
64965         LDKu8slice ser_ref;
64966         ser_ref.datalen = ser->arr_len;
64967         ser_ref.data = ser->elems;
64968         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
64969         *ret_conv = BlindedTail_read(ser_ref);
64970         FREE(ser);
64971         return tag_ptr(ret_conv, true);
64972 }
64973
64974 void  CS_LDK_Path_free(int64_t this_obj) {
64975         LDKPath this_obj_conv;
64976         this_obj_conv.inner = untag_ptr(this_obj);
64977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64979         Path_free(this_obj_conv);
64980 }
64981
64982 int64_tArray  CS_LDK_Path_get_hops(int64_t this_ptr) {
64983         LDKPath this_ptr_conv;
64984         this_ptr_conv.inner = untag_ptr(this_ptr);
64985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64987         this_ptr_conv.is_owned = false;
64988         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
64989         int64_tArray ret_arr = NULL;
64990         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64991         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64992         for (size_t k = 0; k < ret_var.datalen; k++) {
64993                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
64994                 int64_t ret_conv_10_ref = 0;
64995                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
64996                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
64997                 ret_arr_ptr[k] = ret_conv_10_ref;
64998         }
64999         
65000         FREE(ret_var.data);
65001         return ret_arr;
65002 }
65003
65004 void  CS_LDK_Path_set_hops(int64_t this_ptr, int64_tArray val) {
65005         LDKPath this_ptr_conv;
65006         this_ptr_conv.inner = untag_ptr(this_ptr);
65007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65009         this_ptr_conv.is_owned = false;
65010         LDKCVec_RouteHopZ val_constr;
65011         val_constr.datalen = val->arr_len;
65012         if (val_constr.datalen > 0)
65013                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
65014         else
65015                 val_constr.data = NULL;
65016         int64_t* val_vals = val->elems;
65017         for (size_t k = 0; k < val_constr.datalen; k++) {
65018                 int64_t val_conv_10 = val_vals[k];
65019                 LDKRouteHop val_conv_10_conv;
65020                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
65021                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
65022                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
65023                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
65024                 val_constr.data[k] = val_conv_10_conv;
65025         }
65026         FREE(val);
65027         Path_set_hops(&this_ptr_conv, val_constr);
65028 }
65029
65030 int64_t  CS_LDK_Path_get_blinded_tail(int64_t this_ptr) {
65031         LDKPath this_ptr_conv;
65032         this_ptr_conv.inner = untag_ptr(this_ptr);
65033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65035         this_ptr_conv.is_owned = false;
65036         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
65037         int64_t ret_ref = 0;
65038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65040         return ret_ref;
65041 }
65042
65043 void  CS_LDK_Path_set_blinded_tail(int64_t this_ptr, int64_t val) {
65044         LDKPath this_ptr_conv;
65045         this_ptr_conv.inner = untag_ptr(this_ptr);
65046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65048         this_ptr_conv.is_owned = false;
65049         LDKBlindedTail val_conv;
65050         val_conv.inner = untag_ptr(val);
65051         val_conv.is_owned = ptr_is_owned(val);
65052         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65053         val_conv = BlindedTail_clone(&val_conv);
65054         Path_set_blinded_tail(&this_ptr_conv, val_conv);
65055 }
65056
65057 int64_t  CS_LDK_Path_new(int64_tArray hops_arg, int64_t blinded_tail_arg) {
65058         LDKCVec_RouteHopZ hops_arg_constr;
65059         hops_arg_constr.datalen = hops_arg->arr_len;
65060         if (hops_arg_constr.datalen > 0)
65061                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
65062         else
65063                 hops_arg_constr.data = NULL;
65064         int64_t* hops_arg_vals = hops_arg->elems;
65065         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
65066                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
65067                 LDKRouteHop hops_arg_conv_10_conv;
65068                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
65069                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
65070                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
65071                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
65072                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
65073         }
65074         FREE(hops_arg);
65075         LDKBlindedTail blinded_tail_arg_conv;
65076         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
65077         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
65078         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
65079         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
65080         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
65081         int64_t ret_ref = 0;
65082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65084         return ret_ref;
65085 }
65086
65087 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
65088         LDKPath ret_var = Path_clone(arg);
65089         int64_t ret_ref = 0;
65090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65092         return ret_ref;
65093 }
65094 int64_t  CS_LDK_Path_clone_ptr(int64_t arg) {
65095         LDKPath arg_conv;
65096         arg_conv.inner = untag_ptr(arg);
65097         arg_conv.is_owned = ptr_is_owned(arg);
65098         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65099         arg_conv.is_owned = false;
65100         int64_t ret_conv = Path_clone_ptr(&arg_conv);
65101         return ret_conv;
65102 }
65103
65104 int64_t  CS_LDK_Path_clone(int64_t orig) {
65105         LDKPath orig_conv;
65106         orig_conv.inner = untag_ptr(orig);
65107         orig_conv.is_owned = ptr_is_owned(orig);
65108         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65109         orig_conv.is_owned = false;
65110         LDKPath ret_var = Path_clone(&orig_conv);
65111         int64_t ret_ref = 0;
65112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65114         return ret_ref;
65115 }
65116
65117 int64_t  CS_LDK_Path_hash(int64_t o) {
65118         LDKPath o_conv;
65119         o_conv.inner = untag_ptr(o);
65120         o_conv.is_owned = ptr_is_owned(o);
65121         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65122         o_conv.is_owned = false;
65123         int64_t ret_conv = Path_hash(&o_conv);
65124         return ret_conv;
65125 }
65126
65127 jboolean  CS_LDK_Path_eq(int64_t a, int64_t b) {
65128         LDKPath a_conv;
65129         a_conv.inner = untag_ptr(a);
65130         a_conv.is_owned = ptr_is_owned(a);
65131         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65132         a_conv.is_owned = false;
65133         LDKPath b_conv;
65134         b_conv.inner = untag_ptr(b);
65135         b_conv.is_owned = ptr_is_owned(b);
65136         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65137         b_conv.is_owned = false;
65138         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
65139         return ret_conv;
65140 }
65141
65142 int64_t  CS_LDK_Path_fee_msat(int64_t this_arg) {
65143         LDKPath this_arg_conv;
65144         this_arg_conv.inner = untag_ptr(this_arg);
65145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65147         this_arg_conv.is_owned = false;
65148         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
65149         return ret_conv;
65150 }
65151
65152 int64_t  CS_LDK_Path_final_value_msat(int64_t this_arg) {
65153         LDKPath this_arg_conv;
65154         this_arg_conv.inner = untag_ptr(this_arg);
65155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65157         this_arg_conv.is_owned = false;
65158         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
65159         return ret_conv;
65160 }
65161
65162 int64_t  CS_LDK_Path_final_cltv_expiry_delta(int64_t this_arg) {
65163         LDKPath this_arg_conv;
65164         this_arg_conv.inner = untag_ptr(this_arg);
65165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65167         this_arg_conv.is_owned = false;
65168         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
65169         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
65170         int64_t ret_ref = tag_ptr(ret_copy, true);
65171         return ret_ref;
65172 }
65173
65174 void  CS_LDK_Route_free(int64_t this_obj) {
65175         LDKRoute this_obj_conv;
65176         this_obj_conv.inner = untag_ptr(this_obj);
65177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65179         Route_free(this_obj_conv);
65180 }
65181
65182 int64_tArray  CS_LDK_Route_get_paths(int64_t this_ptr) {
65183         LDKRoute this_ptr_conv;
65184         this_ptr_conv.inner = untag_ptr(this_ptr);
65185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65187         this_ptr_conv.is_owned = false;
65188         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
65189         int64_tArray ret_arr = NULL;
65190         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65191         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65192         for (size_t g = 0; g < ret_var.datalen; g++) {
65193                 LDKPath ret_conv_6_var = ret_var.data[g];
65194                 int64_t ret_conv_6_ref = 0;
65195                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
65196                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
65197                 ret_arr_ptr[g] = ret_conv_6_ref;
65198         }
65199         
65200         FREE(ret_var.data);
65201         return ret_arr;
65202 }
65203
65204 void  CS_LDK_Route_set_paths(int64_t this_ptr, int64_tArray val) {
65205         LDKRoute this_ptr_conv;
65206         this_ptr_conv.inner = untag_ptr(this_ptr);
65207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65209         this_ptr_conv.is_owned = false;
65210         LDKCVec_PathZ val_constr;
65211         val_constr.datalen = val->arr_len;
65212         if (val_constr.datalen > 0)
65213                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
65214         else
65215                 val_constr.data = NULL;
65216         int64_t* val_vals = val->elems;
65217         for (size_t g = 0; g < val_constr.datalen; g++) {
65218                 int64_t val_conv_6 = val_vals[g];
65219                 LDKPath val_conv_6_conv;
65220                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
65221                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
65222                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
65223                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
65224                 val_constr.data[g] = val_conv_6_conv;
65225         }
65226         FREE(val);
65227         Route_set_paths(&this_ptr_conv, val_constr);
65228 }
65229
65230 int64_t  CS_LDK_Route_get_route_params(int64_t this_ptr) {
65231         LDKRoute this_ptr_conv;
65232         this_ptr_conv.inner = untag_ptr(this_ptr);
65233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65235         this_ptr_conv.is_owned = false;
65236         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
65237         int64_t ret_ref = 0;
65238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65240         return ret_ref;
65241 }
65242
65243 void  CS_LDK_Route_set_route_params(int64_t this_ptr, int64_t val) {
65244         LDKRoute this_ptr_conv;
65245         this_ptr_conv.inner = untag_ptr(this_ptr);
65246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65248         this_ptr_conv.is_owned = false;
65249         LDKRouteParameters val_conv;
65250         val_conv.inner = untag_ptr(val);
65251         val_conv.is_owned = ptr_is_owned(val);
65252         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65253         val_conv = RouteParameters_clone(&val_conv);
65254         Route_set_route_params(&this_ptr_conv, val_conv);
65255 }
65256
65257 int64_t  CS_LDK_Route_new(int64_tArray paths_arg, int64_t route_params_arg) {
65258         LDKCVec_PathZ paths_arg_constr;
65259         paths_arg_constr.datalen = paths_arg->arr_len;
65260         if (paths_arg_constr.datalen > 0)
65261                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
65262         else
65263                 paths_arg_constr.data = NULL;
65264         int64_t* paths_arg_vals = paths_arg->elems;
65265         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
65266                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
65267                 LDKPath paths_arg_conv_6_conv;
65268                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
65269                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
65270                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
65271                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
65272                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
65273         }
65274         FREE(paths_arg);
65275         LDKRouteParameters route_params_arg_conv;
65276         route_params_arg_conv.inner = untag_ptr(route_params_arg);
65277         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
65278         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
65279         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
65280         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
65281         int64_t ret_ref = 0;
65282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65284         return ret_ref;
65285 }
65286
65287 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
65288         LDKRoute ret_var = Route_clone(arg);
65289         int64_t ret_ref = 0;
65290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65292         return ret_ref;
65293 }
65294 int64_t  CS_LDK_Route_clone_ptr(int64_t arg) {
65295         LDKRoute arg_conv;
65296         arg_conv.inner = untag_ptr(arg);
65297         arg_conv.is_owned = ptr_is_owned(arg);
65298         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65299         arg_conv.is_owned = false;
65300         int64_t ret_conv = Route_clone_ptr(&arg_conv);
65301         return ret_conv;
65302 }
65303
65304 int64_t  CS_LDK_Route_clone(int64_t orig) {
65305         LDKRoute orig_conv;
65306         orig_conv.inner = untag_ptr(orig);
65307         orig_conv.is_owned = ptr_is_owned(orig);
65308         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65309         orig_conv.is_owned = false;
65310         LDKRoute ret_var = Route_clone(&orig_conv);
65311         int64_t ret_ref = 0;
65312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65314         return ret_ref;
65315 }
65316
65317 int64_t  CS_LDK_Route_hash(int64_t o) {
65318         LDKRoute o_conv;
65319         o_conv.inner = untag_ptr(o);
65320         o_conv.is_owned = ptr_is_owned(o);
65321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65322         o_conv.is_owned = false;
65323         int64_t ret_conv = Route_hash(&o_conv);
65324         return ret_conv;
65325 }
65326
65327 jboolean  CS_LDK_Route_eq(int64_t a, int64_t b) {
65328         LDKRoute a_conv;
65329         a_conv.inner = untag_ptr(a);
65330         a_conv.is_owned = ptr_is_owned(a);
65331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65332         a_conv.is_owned = false;
65333         LDKRoute b_conv;
65334         b_conv.inner = untag_ptr(b);
65335         b_conv.is_owned = ptr_is_owned(b);
65336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65337         b_conv.is_owned = false;
65338         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
65339         return ret_conv;
65340 }
65341
65342 int64_t  CS_LDK_Route_get_total_fees(int64_t this_arg) {
65343         LDKRoute this_arg_conv;
65344         this_arg_conv.inner = untag_ptr(this_arg);
65345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65347         this_arg_conv.is_owned = false;
65348         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
65349         return ret_conv;
65350 }
65351
65352 int64_t  CS_LDK_Route_get_total_amount(int64_t this_arg) {
65353         LDKRoute this_arg_conv;
65354         this_arg_conv.inner = untag_ptr(this_arg);
65355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65357         this_arg_conv.is_owned = false;
65358         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
65359         return ret_conv;
65360 }
65361
65362 int8_tArray  CS_LDK_Route_write(int64_t obj) {
65363         LDKRoute obj_conv;
65364         obj_conv.inner = untag_ptr(obj);
65365         obj_conv.is_owned = ptr_is_owned(obj);
65366         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65367         obj_conv.is_owned = false;
65368         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
65369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65371         CVec_u8Z_free(ret_var);
65372         return ret_arr;
65373 }
65374
65375 int64_t  CS_LDK_Route_read(int8_tArray ser) {
65376         LDKu8slice ser_ref;
65377         ser_ref.datalen = ser->arr_len;
65378         ser_ref.data = ser->elems;
65379         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
65380         *ret_conv = Route_read(ser_ref);
65381         FREE(ser);
65382         return tag_ptr(ret_conv, true);
65383 }
65384
65385 void  CS_LDK_RouteParameters_free(int64_t this_obj) {
65386         LDKRouteParameters this_obj_conv;
65387         this_obj_conv.inner = untag_ptr(this_obj);
65388         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65390         RouteParameters_free(this_obj_conv);
65391 }
65392
65393 int64_t  CS_LDK_RouteParameters_get_payment_params(int64_t this_ptr) {
65394         LDKRouteParameters this_ptr_conv;
65395         this_ptr_conv.inner = untag_ptr(this_ptr);
65396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65398         this_ptr_conv.is_owned = false;
65399         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
65400         int64_t ret_ref = 0;
65401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65403         return ret_ref;
65404 }
65405
65406 void  CS_LDK_RouteParameters_set_payment_params(int64_t this_ptr, int64_t val) {
65407         LDKRouteParameters this_ptr_conv;
65408         this_ptr_conv.inner = untag_ptr(this_ptr);
65409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65411         this_ptr_conv.is_owned = false;
65412         LDKPaymentParameters val_conv;
65413         val_conv.inner = untag_ptr(val);
65414         val_conv.is_owned = ptr_is_owned(val);
65415         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65416         val_conv = PaymentParameters_clone(&val_conv);
65417         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
65418 }
65419
65420 int64_t  CS_LDK_RouteParameters_get_final_value_msat(int64_t this_ptr) {
65421         LDKRouteParameters this_ptr_conv;
65422         this_ptr_conv.inner = untag_ptr(this_ptr);
65423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65425         this_ptr_conv.is_owned = false;
65426         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
65427         return ret_conv;
65428 }
65429
65430 void  CS_LDK_RouteParameters_set_final_value_msat(int64_t this_ptr, int64_t val) {
65431         LDKRouteParameters this_ptr_conv;
65432         this_ptr_conv.inner = untag_ptr(this_ptr);
65433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65435         this_ptr_conv.is_owned = false;
65436         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
65437 }
65438
65439 int64_t  CS_LDK_RouteParameters_get_max_total_routing_fee_msat(int64_t this_ptr) {
65440         LDKRouteParameters this_ptr_conv;
65441         this_ptr_conv.inner = untag_ptr(this_ptr);
65442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65444         this_ptr_conv.is_owned = false;
65445         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65446         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
65447         int64_t ret_ref = tag_ptr(ret_copy, true);
65448         return ret_ref;
65449 }
65450
65451 void  CS_LDK_RouteParameters_set_max_total_routing_fee_msat(int64_t this_ptr, int64_t val) {
65452         LDKRouteParameters this_ptr_conv;
65453         this_ptr_conv.inner = untag_ptr(this_ptr);
65454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65456         this_ptr_conv.is_owned = false;
65457         void* val_ptr = untag_ptr(val);
65458         CHECK_ACCESS(val_ptr);
65459         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65460         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65461         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
65462 }
65463
65464 int64_t  CS_LDK_RouteParameters_new(int64_t payment_params_arg, int64_t final_value_msat_arg, int64_t max_total_routing_fee_msat_arg) {
65465         LDKPaymentParameters payment_params_arg_conv;
65466         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
65467         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
65468         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
65469         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
65470         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
65471         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
65472         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
65473         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
65474         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
65475         int64_t ret_ref = 0;
65476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65478         return ret_ref;
65479 }
65480
65481 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
65482         LDKRouteParameters ret_var = RouteParameters_clone(arg);
65483         int64_t ret_ref = 0;
65484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65486         return ret_ref;
65487 }
65488 int64_t  CS_LDK_RouteParameters_clone_ptr(int64_t arg) {
65489         LDKRouteParameters arg_conv;
65490         arg_conv.inner = untag_ptr(arg);
65491         arg_conv.is_owned = ptr_is_owned(arg);
65492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65493         arg_conv.is_owned = false;
65494         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
65495         return ret_conv;
65496 }
65497
65498 int64_t  CS_LDK_RouteParameters_clone(int64_t orig) {
65499         LDKRouteParameters orig_conv;
65500         orig_conv.inner = untag_ptr(orig);
65501         orig_conv.is_owned = ptr_is_owned(orig);
65502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65503         orig_conv.is_owned = false;
65504         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
65505         int64_t ret_ref = 0;
65506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65508         return ret_ref;
65509 }
65510
65511 int64_t  CS_LDK_RouteParameters_hash(int64_t o) {
65512         LDKRouteParameters o_conv;
65513         o_conv.inner = untag_ptr(o);
65514         o_conv.is_owned = ptr_is_owned(o);
65515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65516         o_conv.is_owned = false;
65517         int64_t ret_conv = RouteParameters_hash(&o_conv);
65518         return ret_conv;
65519 }
65520
65521 jboolean  CS_LDK_RouteParameters_eq(int64_t a, int64_t b) {
65522         LDKRouteParameters a_conv;
65523         a_conv.inner = untag_ptr(a);
65524         a_conv.is_owned = ptr_is_owned(a);
65525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65526         a_conv.is_owned = false;
65527         LDKRouteParameters b_conv;
65528         b_conv.inner = untag_ptr(b);
65529         b_conv.is_owned = ptr_is_owned(b);
65530         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65531         b_conv.is_owned = false;
65532         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
65533         return ret_conv;
65534 }
65535
65536 int64_t  CS_LDK_RouteParameters_from_payment_params_and_value(int64_t payment_params, int64_t final_value_msat) {
65537         LDKPaymentParameters payment_params_conv;
65538         payment_params_conv.inner = untag_ptr(payment_params);
65539         payment_params_conv.is_owned = ptr_is_owned(payment_params);
65540         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
65541         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
65542         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
65543         int64_t ret_ref = 0;
65544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65546         return ret_ref;
65547 }
65548
65549 int8_tArray  CS_LDK_RouteParameters_write(int64_t obj) {
65550         LDKRouteParameters obj_conv;
65551         obj_conv.inner = untag_ptr(obj);
65552         obj_conv.is_owned = ptr_is_owned(obj);
65553         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65554         obj_conv.is_owned = false;
65555         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
65556         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65557         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65558         CVec_u8Z_free(ret_var);
65559         return ret_arr;
65560 }
65561
65562 int64_t  CS_LDK_RouteParameters_read(int8_tArray ser) {
65563         LDKu8slice ser_ref;
65564         ser_ref.datalen = ser->arr_len;
65565         ser_ref.data = ser->elems;
65566         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
65567         *ret_conv = RouteParameters_read(ser_ref);
65568         FREE(ser);
65569         return tag_ptr(ret_conv, true);
65570 }
65571
65572 void  CS_LDK_PaymentParameters_free(int64_t this_obj) {
65573         LDKPaymentParameters this_obj_conv;
65574         this_obj_conv.inner = untag_ptr(this_obj);
65575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65577         PaymentParameters_free(this_obj_conv);
65578 }
65579
65580 int64_t  CS_LDK_PaymentParameters_get_payee(int64_t this_ptr) {
65581         LDKPaymentParameters this_ptr_conv;
65582         this_ptr_conv.inner = untag_ptr(this_ptr);
65583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65585         this_ptr_conv.is_owned = false;
65586         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65587         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
65588         int64_t ret_ref = tag_ptr(ret_copy, true);
65589         return ret_ref;
65590 }
65591
65592 void  CS_LDK_PaymentParameters_set_payee(int64_t this_ptr, int64_t val) {
65593         LDKPaymentParameters this_ptr_conv;
65594         this_ptr_conv.inner = untag_ptr(this_ptr);
65595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65597         this_ptr_conv.is_owned = false;
65598         void* val_ptr = untag_ptr(val);
65599         CHECK_ACCESS(val_ptr);
65600         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
65601         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
65602         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
65603 }
65604
65605 int64_t  CS_LDK_PaymentParameters_get_expiry_time(int64_t this_ptr) {
65606         LDKPaymentParameters this_ptr_conv;
65607         this_ptr_conv.inner = untag_ptr(this_ptr);
65608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65610         this_ptr_conv.is_owned = false;
65611         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65612         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
65613         int64_t ret_ref = tag_ptr(ret_copy, true);
65614         return ret_ref;
65615 }
65616
65617 void  CS_LDK_PaymentParameters_set_expiry_time(int64_t this_ptr, int64_t val) {
65618         LDKPaymentParameters this_ptr_conv;
65619         this_ptr_conv.inner = untag_ptr(this_ptr);
65620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65622         this_ptr_conv.is_owned = false;
65623         void* val_ptr = untag_ptr(val);
65624         CHECK_ACCESS(val_ptr);
65625         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65626         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65627         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
65628 }
65629
65630 int32_t  CS_LDK_PaymentParameters_get_max_total_cltv_expiry_delta(int64_t this_ptr) {
65631         LDKPaymentParameters this_ptr_conv;
65632         this_ptr_conv.inner = untag_ptr(this_ptr);
65633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65635         this_ptr_conv.is_owned = false;
65636         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
65637         return ret_conv;
65638 }
65639
65640 void  CS_LDK_PaymentParameters_set_max_total_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
65641         LDKPaymentParameters this_ptr_conv;
65642         this_ptr_conv.inner = untag_ptr(this_ptr);
65643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65645         this_ptr_conv.is_owned = false;
65646         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
65647 }
65648
65649 int8_t  CS_LDK_PaymentParameters_get_max_path_count(int64_t this_ptr) {
65650         LDKPaymentParameters this_ptr_conv;
65651         this_ptr_conv.inner = untag_ptr(this_ptr);
65652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65654         this_ptr_conv.is_owned = false;
65655         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
65656         return ret_conv;
65657 }
65658
65659 void  CS_LDK_PaymentParameters_set_max_path_count(int64_t this_ptr, int8_t val) {
65660         LDKPaymentParameters this_ptr_conv;
65661         this_ptr_conv.inner = untag_ptr(this_ptr);
65662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65664         this_ptr_conv.is_owned = false;
65665         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
65666 }
65667
65668 int8_t  CS_LDK_PaymentParameters_get_max_channel_saturation_power_of_half(int64_t this_ptr) {
65669         LDKPaymentParameters this_ptr_conv;
65670         this_ptr_conv.inner = untag_ptr(this_ptr);
65671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65673         this_ptr_conv.is_owned = false;
65674         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
65675         return ret_conv;
65676 }
65677
65678 void  CS_LDK_PaymentParameters_set_max_channel_saturation_power_of_half(int64_t this_ptr, int8_t val) {
65679         LDKPaymentParameters this_ptr_conv;
65680         this_ptr_conv.inner = untag_ptr(this_ptr);
65681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65683         this_ptr_conv.is_owned = false;
65684         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
65685 }
65686
65687 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_channels(int64_t this_ptr) {
65688         LDKPaymentParameters this_ptr_conv;
65689         this_ptr_conv.inner = untag_ptr(this_ptr);
65690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65692         this_ptr_conv.is_owned = false;
65693         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
65694         int64_tArray ret_arr = NULL;
65695         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65696         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65697         for (size_t g = 0; g < ret_var.datalen; g++) {
65698                 int64_t ret_conv_6_conv = ret_var.data[g];
65699                 ret_arr_ptr[g] = ret_conv_6_conv;
65700         }
65701         
65702         FREE(ret_var.data);
65703         return ret_arr;
65704 }
65705
65706 void  CS_LDK_PaymentParameters_set_previously_failed_channels(int64_t this_ptr, int64_tArray val) {
65707         LDKPaymentParameters this_ptr_conv;
65708         this_ptr_conv.inner = untag_ptr(this_ptr);
65709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65711         this_ptr_conv.is_owned = false;
65712         LDKCVec_u64Z val_constr;
65713         val_constr.datalen = val->arr_len;
65714         if (val_constr.datalen > 0)
65715                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65716         else
65717                 val_constr.data = NULL;
65718         int64_t* val_vals = val->elems;
65719         for (size_t g = 0; g < val_constr.datalen; g++) {
65720                 int64_t val_conv_6 = val_vals[g];
65721                 val_constr.data[g] = val_conv_6;
65722         }
65723         FREE(val);
65724         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
65725 }
65726
65727 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_blinded_path_idxs(int64_t this_ptr) {
65728         LDKPaymentParameters this_ptr_conv;
65729         this_ptr_conv.inner = untag_ptr(this_ptr);
65730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65732         this_ptr_conv.is_owned = false;
65733         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
65734         int64_tArray ret_arr = NULL;
65735         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65736         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65737         for (size_t g = 0; g < ret_var.datalen; g++) {
65738                 int64_t ret_conv_6_conv = ret_var.data[g];
65739                 ret_arr_ptr[g] = ret_conv_6_conv;
65740         }
65741         
65742         FREE(ret_var.data);
65743         return ret_arr;
65744 }
65745
65746 void  CS_LDK_PaymentParameters_set_previously_failed_blinded_path_idxs(int64_t this_ptr, int64_tArray val) {
65747         LDKPaymentParameters this_ptr_conv;
65748         this_ptr_conv.inner = untag_ptr(this_ptr);
65749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65751         this_ptr_conv.is_owned = false;
65752         LDKCVec_u64Z val_constr;
65753         val_constr.datalen = val->arr_len;
65754         if (val_constr.datalen > 0)
65755                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65756         else
65757                 val_constr.data = NULL;
65758         int64_t* val_vals = val->elems;
65759         for (size_t g = 0; g < val_constr.datalen; g++) {
65760                 int64_t val_conv_6 = val_vals[g];
65761                 val_constr.data[g] = val_conv_6;
65762         }
65763         FREE(val);
65764         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
65765 }
65766
65767 int64_t  CS_LDK_PaymentParameters_new(int64_t payee_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int64_tArray previously_failed_blinded_path_idxs_arg) {
65768         void* payee_arg_ptr = untag_ptr(payee_arg);
65769         CHECK_ACCESS(payee_arg_ptr);
65770         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
65771         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
65772         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
65773         CHECK_ACCESS(expiry_time_arg_ptr);
65774         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
65775         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
65776         LDKCVec_u64Z previously_failed_channels_arg_constr;
65777         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
65778         if (previously_failed_channels_arg_constr.datalen > 0)
65779                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65780         else
65781                 previously_failed_channels_arg_constr.data = NULL;
65782         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
65783         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
65784                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
65785                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
65786         }
65787         FREE(previously_failed_channels_arg);
65788         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
65789         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
65790         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
65791                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65792         else
65793                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
65794         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
65795         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
65796                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
65797                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
65798         }
65799         FREE(previously_failed_blinded_path_idxs_arg);
65800         LDKPaymentParameters ret_var = PaymentParameters_new(payee_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr, previously_failed_blinded_path_idxs_arg_constr);
65801         int64_t ret_ref = 0;
65802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65804         return ret_ref;
65805 }
65806
65807 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
65808         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
65809         int64_t ret_ref = 0;
65810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65812         return ret_ref;
65813 }
65814 int64_t  CS_LDK_PaymentParameters_clone_ptr(int64_t arg) {
65815         LDKPaymentParameters arg_conv;
65816         arg_conv.inner = untag_ptr(arg);
65817         arg_conv.is_owned = ptr_is_owned(arg);
65818         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65819         arg_conv.is_owned = false;
65820         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
65821         return ret_conv;
65822 }
65823
65824 int64_t  CS_LDK_PaymentParameters_clone(int64_t orig) {
65825         LDKPaymentParameters orig_conv;
65826         orig_conv.inner = untag_ptr(orig);
65827         orig_conv.is_owned = ptr_is_owned(orig);
65828         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65829         orig_conv.is_owned = false;
65830         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
65831         int64_t ret_ref = 0;
65832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65834         return ret_ref;
65835 }
65836
65837 int64_t  CS_LDK_PaymentParameters_hash(int64_t o) {
65838         LDKPaymentParameters o_conv;
65839         o_conv.inner = untag_ptr(o);
65840         o_conv.is_owned = ptr_is_owned(o);
65841         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65842         o_conv.is_owned = false;
65843         int64_t ret_conv = PaymentParameters_hash(&o_conv);
65844         return ret_conv;
65845 }
65846
65847 jboolean  CS_LDK_PaymentParameters_eq(int64_t a, int64_t b) {
65848         LDKPaymentParameters a_conv;
65849         a_conv.inner = untag_ptr(a);
65850         a_conv.is_owned = ptr_is_owned(a);
65851         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65852         a_conv.is_owned = false;
65853         LDKPaymentParameters b_conv;
65854         b_conv.inner = untag_ptr(b);
65855         b_conv.is_owned = ptr_is_owned(b);
65856         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65857         b_conv.is_owned = false;
65858         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
65859         return ret_conv;
65860 }
65861
65862 int8_tArray  CS_LDK_PaymentParameters_write(int64_t obj) {
65863         LDKPaymentParameters obj_conv;
65864         obj_conv.inner = untag_ptr(obj);
65865         obj_conv.is_owned = ptr_is_owned(obj);
65866         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65867         obj_conv.is_owned = false;
65868         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
65869         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65870         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65871         CVec_u8Z_free(ret_var);
65872         return ret_arr;
65873 }
65874
65875 int64_t  CS_LDK_PaymentParameters_read(int8_tArray ser, int32_t arg) {
65876         LDKu8slice ser_ref;
65877         ser_ref.datalen = ser->arr_len;
65878         ser_ref.data = ser->elems;
65879         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
65880         *ret_conv = PaymentParameters_read(ser_ref, arg);
65881         FREE(ser);
65882         return tag_ptr(ret_conv, true);
65883 }
65884
65885 int64_t  CS_LDK_PaymentParameters_from_node_id(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
65886         LDKPublicKey payee_pubkey_ref;
65887         CHECK(payee_pubkey->arr_len == 33);
65888         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65889         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
65890         int64_t ret_ref = 0;
65891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65893         return ret_ref;
65894 }
65895
65896 int64_t  CS_LDK_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
65897         LDKPublicKey payee_pubkey_ref;
65898         CHECK(payee_pubkey->arr_len == 33);
65899         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65900         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
65901         int64_t ret_ref = 0;
65902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65904         return ret_ref;
65905 }
65906
65907 int64_t  CS_LDK_PaymentParameters_from_bolt12_invoice(int64_t invoice) {
65908         LDKBolt12Invoice invoice_conv;
65909         invoice_conv.inner = untag_ptr(invoice);
65910         invoice_conv.is_owned = ptr_is_owned(invoice);
65911         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
65912         invoice_conv.is_owned = false;
65913         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
65914         int64_t ret_ref = 0;
65915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65917         return ret_ref;
65918 }
65919
65920 int64_t  CS_LDK_PaymentParameters_blinded(int64_tArray blinded_route_hints) {
65921         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
65922         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
65923         if (blinded_route_hints_constr.datalen > 0)
65924                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65925         else
65926                 blinded_route_hints_constr.data = NULL;
65927         int64_t* blinded_route_hints_vals = blinded_route_hints->elems;
65928         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
65929                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
65930                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
65931                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
65932                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
65933                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
65934                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
65935         }
65936         FREE(blinded_route_hints);
65937         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
65938         int64_t ret_ref = 0;
65939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65941         return ret_ref;
65942 }
65943
65944 void  CS_LDK_Payee_free(int64_t this_ptr) {
65945         if (!ptr_is_owned(this_ptr)) return;
65946         void* this_ptr_ptr = untag_ptr(this_ptr);
65947         CHECK_ACCESS(this_ptr_ptr);
65948         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
65949         FREE(untag_ptr(this_ptr));
65950         Payee_free(this_ptr_conv);
65951 }
65952
65953 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
65954         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65955         *ret_copy = Payee_clone(arg);
65956         int64_t ret_ref = tag_ptr(ret_copy, true);
65957         return ret_ref;
65958 }
65959 int64_t  CS_LDK_Payee_clone_ptr(int64_t arg) {
65960         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
65961         int64_t ret_conv = Payee_clone_ptr(arg_conv);
65962         return ret_conv;
65963 }
65964
65965 int64_t  CS_LDK_Payee_clone(int64_t orig) {
65966         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
65967         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65968         *ret_copy = Payee_clone(orig_conv);
65969         int64_t ret_ref = tag_ptr(ret_copy, true);
65970         return ret_ref;
65971 }
65972
65973 int64_t  CS_LDK_Payee_blinded(int64_tArray route_hints, int64_t features) {
65974         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
65975         route_hints_constr.datalen = route_hints->arr_len;
65976         if (route_hints_constr.datalen > 0)
65977                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65978         else
65979                 route_hints_constr.data = NULL;
65980         int64_t* route_hints_vals = route_hints->elems;
65981         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65982                 int64_t route_hints_conv_37 = route_hints_vals[l];
65983                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
65984                 CHECK_ACCESS(route_hints_conv_37_ptr);
65985                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
65986                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
65987                 route_hints_constr.data[l] = route_hints_conv_37_conv;
65988         }
65989         FREE(route_hints);
65990         LDKBolt12InvoiceFeatures features_conv;
65991         features_conv.inner = untag_ptr(features);
65992         features_conv.is_owned = ptr_is_owned(features);
65993         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65994         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
65995         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65996         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
65997         int64_t ret_ref = tag_ptr(ret_copy, true);
65998         return ret_ref;
65999 }
66000
66001 int64_t  CS_LDK_Payee_clear(int8_tArray node_id, int64_tArray route_hints, int64_t features, int32_t final_cltv_expiry_delta) {
66002         LDKPublicKey node_id_ref;
66003         CHECK(node_id->arr_len == 33);
66004         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66005         LDKCVec_RouteHintZ route_hints_constr;
66006         route_hints_constr.datalen = route_hints->arr_len;
66007         if (route_hints_constr.datalen > 0)
66008                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
66009         else
66010                 route_hints_constr.data = NULL;
66011         int64_t* route_hints_vals = route_hints->elems;
66012         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
66013                 int64_t route_hints_conv_11 = route_hints_vals[l];
66014                 LDKRouteHint route_hints_conv_11_conv;
66015                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
66016                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
66017                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
66018                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
66019                 route_hints_constr.data[l] = route_hints_conv_11_conv;
66020         }
66021         FREE(route_hints);
66022         LDKBolt11InvoiceFeatures features_conv;
66023         features_conv.inner = untag_ptr(features);
66024         features_conv.is_owned = ptr_is_owned(features);
66025         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
66026         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
66027         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
66028         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
66029         int64_t ret_ref = tag_ptr(ret_copy, true);
66030         return ret_ref;
66031 }
66032
66033 int64_t  CS_LDK_Payee_hash(int64_t o) {
66034         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
66035         int64_t ret_conv = Payee_hash(o_conv);
66036         return ret_conv;
66037 }
66038
66039 jboolean  CS_LDK_Payee_eq(int64_t a, int64_t b) {
66040         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
66041         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
66042         jboolean ret_conv = Payee_eq(a_conv, b_conv);
66043         return ret_conv;
66044 }
66045
66046 void  CS_LDK_RouteHint_free(int64_t this_obj) {
66047         LDKRouteHint this_obj_conv;
66048         this_obj_conv.inner = untag_ptr(this_obj);
66049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66051         RouteHint_free(this_obj_conv);
66052 }
66053
66054 int64_tArray  CS_LDK_RouteHint_get_a(int64_t this_ptr) {
66055         LDKRouteHint this_ptr_conv;
66056         this_ptr_conv.inner = untag_ptr(this_ptr);
66057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66059         this_ptr_conv.is_owned = false;
66060         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
66061         int64_tArray ret_arr = NULL;
66062         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
66063         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
66064         for (size_t o = 0; o < ret_var.datalen; o++) {
66065                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
66066                 int64_t ret_conv_14_ref = 0;
66067                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
66068                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
66069                 ret_arr_ptr[o] = ret_conv_14_ref;
66070         }
66071         
66072         FREE(ret_var.data);
66073         return ret_arr;
66074 }
66075
66076 void  CS_LDK_RouteHint_set_a(int64_t this_ptr, int64_tArray val) {
66077         LDKRouteHint this_ptr_conv;
66078         this_ptr_conv.inner = untag_ptr(this_ptr);
66079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66081         this_ptr_conv.is_owned = false;
66082         LDKCVec_RouteHintHopZ val_constr;
66083         val_constr.datalen = val->arr_len;
66084         if (val_constr.datalen > 0)
66085                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
66086         else
66087                 val_constr.data = NULL;
66088         int64_t* val_vals = val->elems;
66089         for (size_t o = 0; o < val_constr.datalen; o++) {
66090                 int64_t val_conv_14 = val_vals[o];
66091                 LDKRouteHintHop val_conv_14_conv;
66092                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
66093                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
66094                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
66095                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
66096                 val_constr.data[o] = val_conv_14_conv;
66097         }
66098         FREE(val);
66099         RouteHint_set_a(&this_ptr_conv, val_constr);
66100 }
66101
66102 int64_t  CS_LDK_RouteHint_new(int64_tArray a_arg) {
66103         LDKCVec_RouteHintHopZ a_arg_constr;
66104         a_arg_constr.datalen = a_arg->arr_len;
66105         if (a_arg_constr.datalen > 0)
66106                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
66107         else
66108                 a_arg_constr.data = NULL;
66109         int64_t* a_arg_vals = a_arg->elems;
66110         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
66111                 int64_t a_arg_conv_14 = a_arg_vals[o];
66112                 LDKRouteHintHop a_arg_conv_14_conv;
66113                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
66114                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
66115                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
66116                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
66117                 a_arg_constr.data[o] = a_arg_conv_14_conv;
66118         }
66119         FREE(a_arg);
66120         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
66121         int64_t ret_ref = 0;
66122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66124         return ret_ref;
66125 }
66126
66127 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
66128         LDKRouteHint ret_var = RouteHint_clone(arg);
66129         int64_t ret_ref = 0;
66130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66132         return ret_ref;
66133 }
66134 int64_t  CS_LDK_RouteHint_clone_ptr(int64_t arg) {
66135         LDKRouteHint arg_conv;
66136         arg_conv.inner = untag_ptr(arg);
66137         arg_conv.is_owned = ptr_is_owned(arg);
66138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66139         arg_conv.is_owned = false;
66140         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
66141         return ret_conv;
66142 }
66143
66144 int64_t  CS_LDK_RouteHint_clone(int64_t orig) {
66145         LDKRouteHint orig_conv;
66146         orig_conv.inner = untag_ptr(orig);
66147         orig_conv.is_owned = ptr_is_owned(orig);
66148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66149         orig_conv.is_owned = false;
66150         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
66151         int64_t ret_ref = 0;
66152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66154         return ret_ref;
66155 }
66156
66157 int64_t  CS_LDK_RouteHint_hash(int64_t o) {
66158         LDKRouteHint o_conv;
66159         o_conv.inner = untag_ptr(o);
66160         o_conv.is_owned = ptr_is_owned(o);
66161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66162         o_conv.is_owned = false;
66163         int64_t ret_conv = RouteHint_hash(&o_conv);
66164         return ret_conv;
66165 }
66166
66167 jboolean  CS_LDK_RouteHint_eq(int64_t a, int64_t b) {
66168         LDKRouteHint a_conv;
66169         a_conv.inner = untag_ptr(a);
66170         a_conv.is_owned = ptr_is_owned(a);
66171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66172         a_conv.is_owned = false;
66173         LDKRouteHint b_conv;
66174         b_conv.inner = untag_ptr(b);
66175         b_conv.is_owned = ptr_is_owned(b);
66176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66177         b_conv.is_owned = false;
66178         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
66179         return ret_conv;
66180 }
66181
66182 int8_tArray  CS_LDK_RouteHint_write(int64_t obj) {
66183         LDKRouteHint obj_conv;
66184         obj_conv.inner = untag_ptr(obj);
66185         obj_conv.is_owned = ptr_is_owned(obj);
66186         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66187         obj_conv.is_owned = false;
66188         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
66189         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66190         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66191         CVec_u8Z_free(ret_var);
66192         return ret_arr;
66193 }
66194
66195 int64_t  CS_LDK_RouteHint_read(int8_tArray ser) {
66196         LDKu8slice ser_ref;
66197         ser_ref.datalen = ser->arr_len;
66198         ser_ref.data = ser->elems;
66199         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
66200         *ret_conv = RouteHint_read(ser_ref);
66201         FREE(ser);
66202         return tag_ptr(ret_conv, true);
66203 }
66204
66205 void  CS_LDK_RouteHintHop_free(int64_t this_obj) {
66206         LDKRouteHintHop this_obj_conv;
66207         this_obj_conv.inner = untag_ptr(this_obj);
66208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66210         RouteHintHop_free(this_obj_conv);
66211 }
66212
66213 int8_tArray  CS_LDK_RouteHintHop_get_src_node_id(int64_t this_ptr) {
66214         LDKRouteHintHop this_ptr_conv;
66215         this_ptr_conv.inner = untag_ptr(this_ptr);
66216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66218         this_ptr_conv.is_owned = false;
66219         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66220         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
66221         return ret_arr;
66222 }
66223
66224 void  CS_LDK_RouteHintHop_set_src_node_id(int64_t this_ptr, int8_tArray val) {
66225         LDKRouteHintHop this_ptr_conv;
66226         this_ptr_conv.inner = untag_ptr(this_ptr);
66227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66229         this_ptr_conv.is_owned = false;
66230         LDKPublicKey val_ref;
66231         CHECK(val->arr_len == 33);
66232         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
66233         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
66234 }
66235
66236 int64_t  CS_LDK_RouteHintHop_get_short_channel_id(int64_t this_ptr) {
66237         LDKRouteHintHop this_ptr_conv;
66238         this_ptr_conv.inner = untag_ptr(this_ptr);
66239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66241         this_ptr_conv.is_owned = false;
66242         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
66243         return ret_conv;
66244 }
66245
66246 void  CS_LDK_RouteHintHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
66247         LDKRouteHintHop this_ptr_conv;
66248         this_ptr_conv.inner = untag_ptr(this_ptr);
66249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66251         this_ptr_conv.is_owned = false;
66252         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
66253 }
66254
66255 int64_t  CS_LDK_RouteHintHop_get_fees(int64_t this_ptr) {
66256         LDKRouteHintHop this_ptr_conv;
66257         this_ptr_conv.inner = untag_ptr(this_ptr);
66258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66260         this_ptr_conv.is_owned = false;
66261         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
66262         int64_t ret_ref = 0;
66263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66265         return ret_ref;
66266 }
66267
66268 void  CS_LDK_RouteHintHop_set_fees(int64_t this_ptr, int64_t val) {
66269         LDKRouteHintHop this_ptr_conv;
66270         this_ptr_conv.inner = untag_ptr(this_ptr);
66271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66273         this_ptr_conv.is_owned = false;
66274         LDKRoutingFees val_conv;
66275         val_conv.inner = untag_ptr(val);
66276         val_conv.is_owned = ptr_is_owned(val);
66277         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66278         val_conv = RoutingFees_clone(&val_conv);
66279         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
66280 }
66281
66282 int16_t  CS_LDK_RouteHintHop_get_cltv_expiry_delta(int64_t this_ptr) {
66283         LDKRouteHintHop this_ptr_conv;
66284         this_ptr_conv.inner = untag_ptr(this_ptr);
66285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66287         this_ptr_conv.is_owned = false;
66288         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
66289         return ret_conv;
66290 }
66291
66292 void  CS_LDK_RouteHintHop_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
66293         LDKRouteHintHop this_ptr_conv;
66294         this_ptr_conv.inner = untag_ptr(this_ptr);
66295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66297         this_ptr_conv.is_owned = false;
66298         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
66299 }
66300
66301 int64_t  CS_LDK_RouteHintHop_get_htlc_minimum_msat(int64_t this_ptr) {
66302         LDKRouteHintHop this_ptr_conv;
66303         this_ptr_conv.inner = untag_ptr(this_ptr);
66304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66306         this_ptr_conv.is_owned = false;
66307         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66308         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
66309         int64_t ret_ref = tag_ptr(ret_copy, true);
66310         return ret_ref;
66311 }
66312
66313 void  CS_LDK_RouteHintHop_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
66314         LDKRouteHintHop this_ptr_conv;
66315         this_ptr_conv.inner = untag_ptr(this_ptr);
66316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66318         this_ptr_conv.is_owned = false;
66319         void* val_ptr = untag_ptr(val);
66320         CHECK_ACCESS(val_ptr);
66321         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
66322         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
66323         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
66324 }
66325
66326 int64_t  CS_LDK_RouteHintHop_get_htlc_maximum_msat(int64_t this_ptr) {
66327         LDKRouteHintHop this_ptr_conv;
66328         this_ptr_conv.inner = untag_ptr(this_ptr);
66329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66331         this_ptr_conv.is_owned = false;
66332         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66333         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
66334         int64_t ret_ref = tag_ptr(ret_copy, true);
66335         return ret_ref;
66336 }
66337
66338 void  CS_LDK_RouteHintHop_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
66339         LDKRouteHintHop this_ptr_conv;
66340         this_ptr_conv.inner = untag_ptr(this_ptr);
66341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66343         this_ptr_conv.is_owned = false;
66344         void* val_ptr = untag_ptr(val);
66345         CHECK_ACCESS(val_ptr);
66346         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
66347         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
66348         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
66349 }
66350
66351 int64_t  CS_LDK_RouteHintHop_new(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) {
66352         LDKPublicKey src_node_id_arg_ref;
66353         CHECK(src_node_id_arg->arr_len == 33);
66354         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
66355         LDKRoutingFees fees_arg_conv;
66356         fees_arg_conv.inner = untag_ptr(fees_arg);
66357         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
66358         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
66359         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
66360         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
66361         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
66362         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
66363         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
66364         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
66365         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
66366         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
66367         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
66368         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);
66369         int64_t ret_ref = 0;
66370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66372         return ret_ref;
66373 }
66374
66375 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
66376         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
66377         int64_t ret_ref = 0;
66378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66380         return ret_ref;
66381 }
66382 int64_t  CS_LDK_RouteHintHop_clone_ptr(int64_t arg) {
66383         LDKRouteHintHop arg_conv;
66384         arg_conv.inner = untag_ptr(arg);
66385         arg_conv.is_owned = ptr_is_owned(arg);
66386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66387         arg_conv.is_owned = false;
66388         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
66389         return ret_conv;
66390 }
66391
66392 int64_t  CS_LDK_RouteHintHop_clone(int64_t orig) {
66393         LDKRouteHintHop orig_conv;
66394         orig_conv.inner = untag_ptr(orig);
66395         orig_conv.is_owned = ptr_is_owned(orig);
66396         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66397         orig_conv.is_owned = false;
66398         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
66399         int64_t ret_ref = 0;
66400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66402         return ret_ref;
66403 }
66404
66405 int64_t  CS_LDK_RouteHintHop_hash(int64_t o) {
66406         LDKRouteHintHop o_conv;
66407         o_conv.inner = untag_ptr(o);
66408         o_conv.is_owned = ptr_is_owned(o);
66409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66410         o_conv.is_owned = false;
66411         int64_t ret_conv = RouteHintHop_hash(&o_conv);
66412         return ret_conv;
66413 }
66414
66415 jboolean  CS_LDK_RouteHintHop_eq(int64_t a, int64_t b) {
66416         LDKRouteHintHop a_conv;
66417         a_conv.inner = untag_ptr(a);
66418         a_conv.is_owned = ptr_is_owned(a);
66419         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66420         a_conv.is_owned = false;
66421         LDKRouteHintHop b_conv;
66422         b_conv.inner = untag_ptr(b);
66423         b_conv.is_owned = ptr_is_owned(b);
66424         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66425         b_conv.is_owned = false;
66426         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
66427         return ret_conv;
66428 }
66429
66430 int8_tArray  CS_LDK_RouteHintHop_write(int64_t obj) {
66431         LDKRouteHintHop obj_conv;
66432         obj_conv.inner = untag_ptr(obj);
66433         obj_conv.is_owned = ptr_is_owned(obj);
66434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66435         obj_conv.is_owned = false;
66436         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
66437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66439         CVec_u8Z_free(ret_var);
66440         return ret_arr;
66441 }
66442
66443 int64_t  CS_LDK_RouteHintHop_read(int8_tArray ser) {
66444         LDKu8slice ser_ref;
66445         ser_ref.datalen = ser->arr_len;
66446         ser_ref.data = ser->elems;
66447         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
66448         *ret_conv = RouteHintHop_read(ser_ref);
66449         FREE(ser);
66450         return tag_ptr(ret_conv, true);
66451 }
66452
66453 void  CS_LDK_FirstHopCandidate_free(int64_t this_obj) {
66454         LDKFirstHopCandidate this_obj_conv;
66455         this_obj_conv.inner = untag_ptr(this_obj);
66456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66458         FirstHopCandidate_free(this_obj_conv);
66459 }
66460
66461 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
66462         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
66463         int64_t ret_ref = 0;
66464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66466         return ret_ref;
66467 }
66468 int64_t  CS_LDK_FirstHopCandidate_clone_ptr(int64_t arg) {
66469         LDKFirstHopCandidate arg_conv;
66470         arg_conv.inner = untag_ptr(arg);
66471         arg_conv.is_owned = ptr_is_owned(arg);
66472         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66473         arg_conv.is_owned = false;
66474         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
66475         return ret_conv;
66476 }
66477
66478 int64_t  CS_LDK_FirstHopCandidate_clone(int64_t orig) {
66479         LDKFirstHopCandidate orig_conv;
66480         orig_conv.inner = untag_ptr(orig);
66481         orig_conv.is_owned = ptr_is_owned(orig);
66482         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66483         orig_conv.is_owned = false;
66484         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
66485         int64_t ret_ref = 0;
66486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66488         return ret_ref;
66489 }
66490
66491 void  CS_LDK_PublicHopCandidate_free(int64_t this_obj) {
66492         LDKPublicHopCandidate this_obj_conv;
66493         this_obj_conv.inner = untag_ptr(this_obj);
66494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66496         PublicHopCandidate_free(this_obj_conv);
66497 }
66498
66499 int64_t  CS_LDK_PublicHopCandidate_get_short_channel_id(int64_t this_ptr) {
66500         LDKPublicHopCandidate this_ptr_conv;
66501         this_ptr_conv.inner = untag_ptr(this_ptr);
66502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66504         this_ptr_conv.is_owned = false;
66505         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
66506         return ret_conv;
66507 }
66508
66509 void  CS_LDK_PublicHopCandidate_set_short_channel_id(int64_t this_ptr, int64_t val) {
66510         LDKPublicHopCandidate this_ptr_conv;
66511         this_ptr_conv.inner = untag_ptr(this_ptr);
66512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66514         this_ptr_conv.is_owned = false;
66515         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
66516 }
66517
66518 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
66519         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
66520         int64_t ret_ref = 0;
66521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66523         return ret_ref;
66524 }
66525 int64_t  CS_LDK_PublicHopCandidate_clone_ptr(int64_t arg) {
66526         LDKPublicHopCandidate arg_conv;
66527         arg_conv.inner = untag_ptr(arg);
66528         arg_conv.is_owned = ptr_is_owned(arg);
66529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66530         arg_conv.is_owned = false;
66531         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
66532         return ret_conv;
66533 }
66534
66535 int64_t  CS_LDK_PublicHopCandidate_clone(int64_t orig) {
66536         LDKPublicHopCandidate orig_conv;
66537         orig_conv.inner = untag_ptr(orig);
66538         orig_conv.is_owned = ptr_is_owned(orig);
66539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66540         orig_conv.is_owned = false;
66541         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
66542         int64_t ret_ref = 0;
66543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66545         return ret_ref;
66546 }
66547
66548 void  CS_LDK_PrivateHopCandidate_free(int64_t this_obj) {
66549         LDKPrivateHopCandidate this_obj_conv;
66550         this_obj_conv.inner = untag_ptr(this_obj);
66551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66553         PrivateHopCandidate_free(this_obj_conv);
66554 }
66555
66556 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
66557         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
66558         int64_t ret_ref = 0;
66559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66561         return ret_ref;
66562 }
66563 int64_t  CS_LDK_PrivateHopCandidate_clone_ptr(int64_t arg) {
66564         LDKPrivateHopCandidate arg_conv;
66565         arg_conv.inner = untag_ptr(arg);
66566         arg_conv.is_owned = ptr_is_owned(arg);
66567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66568         arg_conv.is_owned = false;
66569         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
66570         return ret_conv;
66571 }
66572
66573 int64_t  CS_LDK_PrivateHopCandidate_clone(int64_t orig) {
66574         LDKPrivateHopCandidate orig_conv;
66575         orig_conv.inner = untag_ptr(orig);
66576         orig_conv.is_owned = ptr_is_owned(orig);
66577         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66578         orig_conv.is_owned = false;
66579         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
66580         int64_t ret_ref = 0;
66581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66583         return ret_ref;
66584 }
66585
66586 void  CS_LDK_BlindedPathCandidate_free(int64_t this_obj) {
66587         LDKBlindedPathCandidate this_obj_conv;
66588         this_obj_conv.inner = untag_ptr(this_obj);
66589         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66591         BlindedPathCandidate_free(this_obj_conv);
66592 }
66593
66594 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
66595         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
66596         int64_t ret_ref = 0;
66597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66599         return ret_ref;
66600 }
66601 int64_t  CS_LDK_BlindedPathCandidate_clone_ptr(int64_t arg) {
66602         LDKBlindedPathCandidate arg_conv;
66603         arg_conv.inner = untag_ptr(arg);
66604         arg_conv.is_owned = ptr_is_owned(arg);
66605         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66606         arg_conv.is_owned = false;
66607         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
66608         return ret_conv;
66609 }
66610
66611 int64_t  CS_LDK_BlindedPathCandidate_clone(int64_t orig) {
66612         LDKBlindedPathCandidate orig_conv;
66613         orig_conv.inner = untag_ptr(orig);
66614         orig_conv.is_owned = ptr_is_owned(orig);
66615         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66616         orig_conv.is_owned = false;
66617         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
66618         int64_t ret_ref = 0;
66619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66621         return ret_ref;
66622 }
66623
66624 void  CS_LDK_OneHopBlindedPathCandidate_free(int64_t this_obj) {
66625         LDKOneHopBlindedPathCandidate this_obj_conv;
66626         this_obj_conv.inner = untag_ptr(this_obj);
66627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66629         OneHopBlindedPathCandidate_free(this_obj_conv);
66630 }
66631
66632 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
66633         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
66634         int64_t ret_ref = 0;
66635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66637         return ret_ref;
66638 }
66639 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone_ptr(int64_t arg) {
66640         LDKOneHopBlindedPathCandidate arg_conv;
66641         arg_conv.inner = untag_ptr(arg);
66642         arg_conv.is_owned = ptr_is_owned(arg);
66643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66644         arg_conv.is_owned = false;
66645         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
66646         return ret_conv;
66647 }
66648
66649 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone(int64_t orig) {
66650         LDKOneHopBlindedPathCandidate orig_conv;
66651         orig_conv.inner = untag_ptr(orig);
66652         orig_conv.is_owned = ptr_is_owned(orig);
66653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66654         orig_conv.is_owned = false;
66655         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
66656         int64_t ret_ref = 0;
66657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66659         return ret_ref;
66660 }
66661
66662 void  CS_LDK_CandidateRouteHop_free(int64_t this_ptr) {
66663         if (!ptr_is_owned(this_ptr)) return;
66664         void* this_ptr_ptr = untag_ptr(this_ptr);
66665         CHECK_ACCESS(this_ptr_ptr);
66666         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
66667         FREE(untag_ptr(this_ptr));
66668         CandidateRouteHop_free(this_ptr_conv);
66669 }
66670
66671 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
66672         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66673         *ret_copy = CandidateRouteHop_clone(arg);
66674         int64_t ret_ref = tag_ptr(ret_copy, true);
66675         return ret_ref;
66676 }
66677 int64_t  CS_LDK_CandidateRouteHop_clone_ptr(int64_t arg) {
66678         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
66679         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
66680         return ret_conv;
66681 }
66682
66683 int64_t  CS_LDK_CandidateRouteHop_clone(int64_t orig) {
66684         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
66685         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66686         *ret_copy = CandidateRouteHop_clone(orig_conv);
66687         int64_t ret_ref = tag_ptr(ret_copy, true);
66688         return ret_ref;
66689 }
66690
66691 int64_t  CS_LDK_CandidateRouteHop_first_hop(int64_t a) {
66692         LDKFirstHopCandidate a_conv;
66693         a_conv.inner = untag_ptr(a);
66694         a_conv.is_owned = ptr_is_owned(a);
66695         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66696         a_conv = FirstHopCandidate_clone(&a_conv);
66697         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66698         *ret_copy = CandidateRouteHop_first_hop(a_conv);
66699         int64_t ret_ref = tag_ptr(ret_copy, true);
66700         return ret_ref;
66701 }
66702
66703 int64_t  CS_LDK_CandidateRouteHop_public_hop(int64_t a) {
66704         LDKPublicHopCandidate a_conv;
66705         a_conv.inner = untag_ptr(a);
66706         a_conv.is_owned = ptr_is_owned(a);
66707         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66708         a_conv = PublicHopCandidate_clone(&a_conv);
66709         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66710         *ret_copy = CandidateRouteHop_public_hop(a_conv);
66711         int64_t ret_ref = tag_ptr(ret_copy, true);
66712         return ret_ref;
66713 }
66714
66715 int64_t  CS_LDK_CandidateRouteHop_private_hop(int64_t a) {
66716         LDKPrivateHopCandidate a_conv;
66717         a_conv.inner = untag_ptr(a);
66718         a_conv.is_owned = ptr_is_owned(a);
66719         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66720         a_conv = PrivateHopCandidate_clone(&a_conv);
66721         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66722         *ret_copy = CandidateRouteHop_private_hop(a_conv);
66723         int64_t ret_ref = tag_ptr(ret_copy, true);
66724         return ret_ref;
66725 }
66726
66727 int64_t  CS_LDK_CandidateRouteHop_blinded(int64_t a) {
66728         LDKBlindedPathCandidate a_conv;
66729         a_conv.inner = untag_ptr(a);
66730         a_conv.is_owned = ptr_is_owned(a);
66731         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66732         a_conv = BlindedPathCandidate_clone(&a_conv);
66733         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66734         *ret_copy = CandidateRouteHop_blinded(a_conv);
66735         int64_t ret_ref = tag_ptr(ret_copy, true);
66736         return ret_ref;
66737 }
66738
66739 int64_t  CS_LDK_CandidateRouteHop_one_hop_blinded(int64_t a) {
66740         LDKOneHopBlindedPathCandidate a_conv;
66741         a_conv.inner = untag_ptr(a);
66742         a_conv.is_owned = ptr_is_owned(a);
66743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66744         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
66745         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66746         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
66747         int64_t ret_ref = tag_ptr(ret_copy, true);
66748         return ret_ref;
66749 }
66750
66751 int64_t  CS_LDK_CandidateRouteHop_globally_unique_short_channel_id(int64_t this_arg) {
66752         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66753         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66754         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
66755         int64_t ret_ref = tag_ptr(ret_copy, true);
66756         return ret_ref;
66757 }
66758
66759 int32_t  CS_LDK_CandidateRouteHop_cltv_expiry_delta(int64_t this_arg) {
66760         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66761         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
66762         return ret_conv;
66763 }
66764
66765 int64_t  CS_LDK_CandidateRouteHop_htlc_minimum_msat(int64_t this_arg) {
66766         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66767         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
66768         return ret_conv;
66769 }
66770
66771 int64_t  CS_LDK_CandidateRouteHop_fees(int64_t this_arg) {
66772         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66773         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
66774         int64_t ret_ref = 0;
66775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66777         return ret_ref;
66778 }
66779
66780 int64_t  CS_LDK_CandidateRouteHop_source(int64_t this_arg) {
66781         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66782         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
66783         int64_t ret_ref = 0;
66784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66786         return ret_ref;
66787 }
66788
66789 int64_t  CS_LDK_CandidateRouteHop_target(int64_t this_arg) {
66790         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66791         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
66792         int64_t ret_ref = 0;
66793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66795         return ret_ref;
66796 }
66797
66798 int64_t  CS_LDK_find_route(int8_tArray our_node_pubkey, int64_t route_params, int64_t network_graph, int64_tArray first_hops, int64_t logger, int64_t scorer, int64_t score_params, int8_tArray random_seed_bytes) {
66799         LDKPublicKey our_node_pubkey_ref;
66800         CHECK(our_node_pubkey->arr_len == 33);
66801         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66802         LDKRouteParameters route_params_conv;
66803         route_params_conv.inner = untag_ptr(route_params);
66804         route_params_conv.is_owned = ptr_is_owned(route_params);
66805         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66806         route_params_conv.is_owned = false;
66807         LDKNetworkGraph network_graph_conv;
66808         network_graph_conv.inner = untag_ptr(network_graph);
66809         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66810         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66811         network_graph_conv.is_owned = false;
66812         LDKCVec_ChannelDetailsZ first_hops_constr;
66813         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
66814         if (first_hops != NULL) {
66815                 first_hops_constr.datalen = first_hops->arr_len;
66816                 if (first_hops_constr.datalen > 0)
66817                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
66818                 else
66819                         first_hops_constr.data = NULL;
66820                 int64_t* first_hops_vals = first_hops->elems;
66821                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
66822                         int64_t first_hops_conv_16 = first_hops_vals[q];
66823                         LDKChannelDetails first_hops_conv_16_conv;
66824                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
66825                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
66826                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
66827                         first_hops_conv_16_conv.is_owned = false;
66828                         first_hops_constr.data[q] = first_hops_conv_16_conv;
66829                 }
66830                 FREE(first_hops);
66831                 first_hops_ptr = &first_hops_constr;
66832         }
66833         void* logger_ptr = untag_ptr(logger);
66834         CHECK_ACCESS(logger_ptr);
66835         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66836         if (logger_conv.free == LDKLogger_JCalls_free) {
66837                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66838                 LDKLogger_JCalls_cloned(&logger_conv);
66839         }
66840         void* scorer_ptr = untag_ptr(scorer);
66841         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
66842         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
66843         LDKProbabilisticScoringFeeParameters score_params_conv;
66844         score_params_conv.inner = untag_ptr(score_params);
66845         score_params_conv.is_owned = ptr_is_owned(score_params);
66846         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
66847         score_params_conv.is_owned = false;
66848         uint8_t random_seed_bytes_arr[32];
66849         CHECK(random_seed_bytes->arr_len == 32);
66850         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66851         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66852         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66853         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, &score_params_conv, random_seed_bytes_ref);
66854         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
66855         return tag_ptr(ret_conv, true);
66856 }
66857
66858 int64_t  CS_LDK_build_route_from_hops(int8_tArray our_node_pubkey, ptrArray hops, int64_t route_params, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
66859         LDKPublicKey our_node_pubkey_ref;
66860         CHECK(our_node_pubkey->arr_len == 33);
66861         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66862         LDKCVec_PublicKeyZ hops_constr;
66863         hops_constr.datalen = hops->arr_len;
66864         if (hops_constr.datalen > 0)
66865                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
66866         else
66867                 hops_constr.data = NULL;
66868         int8_tArray* hops_vals = (void*) hops->elems;
66869         for (size_t i = 0; i < hops_constr.datalen; i++) {
66870                 int8_tArray hops_conv_8 = hops_vals[i];
66871                 LDKPublicKey hops_conv_8_ref;
66872                 CHECK(hops_conv_8->arr_len == 33);
66873                 memcpy(hops_conv_8_ref.compressed_form, hops_conv_8->elems, 33); FREE(hops_conv_8);
66874                 hops_constr.data[i] = hops_conv_8_ref;
66875         }
66876         FREE(hops);
66877         LDKRouteParameters route_params_conv;
66878         route_params_conv.inner = untag_ptr(route_params);
66879         route_params_conv.is_owned = ptr_is_owned(route_params);
66880         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66881         route_params_conv.is_owned = false;
66882         LDKNetworkGraph network_graph_conv;
66883         network_graph_conv.inner = untag_ptr(network_graph);
66884         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66885         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66886         network_graph_conv.is_owned = false;
66887         void* logger_ptr = untag_ptr(logger);
66888         CHECK_ACCESS(logger_ptr);
66889         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66890         if (logger_conv.free == LDKLogger_JCalls_free) {
66891                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66892                 LDKLogger_JCalls_cloned(&logger_conv);
66893         }
66894         uint8_t random_seed_bytes_arr[32];
66895         CHECK(random_seed_bytes->arr_len == 32);
66896         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66897         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66898         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66899         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
66900         return tag_ptr(ret_conv, true);
66901 }
66902
66903 void  CS_LDK_ScoreLookUp_free(int64_t this_ptr) {
66904         if (!ptr_is_owned(this_ptr)) return;
66905         void* this_ptr_ptr = untag_ptr(this_ptr);
66906         CHECK_ACCESS(this_ptr_ptr);
66907         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
66908         FREE(untag_ptr(this_ptr));
66909         ScoreLookUp_free(this_ptr_conv);
66910 }
66911
66912 void  CS_LDK_ScoreUpdate_free(int64_t this_ptr) {
66913         if (!ptr_is_owned(this_ptr)) return;
66914         void* this_ptr_ptr = untag_ptr(this_ptr);
66915         CHECK_ACCESS(this_ptr_ptr);
66916         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
66917         FREE(untag_ptr(this_ptr));
66918         ScoreUpdate_free(this_ptr_conv);
66919 }
66920
66921 void  CS_LDK_Score_free(int64_t this_ptr) {
66922         if (!ptr_is_owned(this_ptr)) return;
66923         void* this_ptr_ptr = untag_ptr(this_ptr);
66924         CHECK_ACCESS(this_ptr_ptr);
66925         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
66926         FREE(untag_ptr(this_ptr));
66927         Score_free(this_ptr_conv);
66928 }
66929
66930 void  CS_LDK_LockableScore_free(int64_t this_ptr) {
66931         if (!ptr_is_owned(this_ptr)) return;
66932         void* this_ptr_ptr = untag_ptr(this_ptr);
66933         CHECK_ACCESS(this_ptr_ptr);
66934         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
66935         FREE(untag_ptr(this_ptr));
66936         LockableScore_free(this_ptr_conv);
66937 }
66938
66939 void  CS_LDK_WriteableScore_free(int64_t this_ptr) {
66940         if (!ptr_is_owned(this_ptr)) return;
66941         void* this_ptr_ptr = untag_ptr(this_ptr);
66942         CHECK_ACCESS(this_ptr_ptr);
66943         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
66944         FREE(untag_ptr(this_ptr));
66945         WriteableScore_free(this_ptr_conv);
66946 }
66947
66948 void  CS_LDK_MultiThreadedLockableScore_free(int64_t this_obj) {
66949         LDKMultiThreadedLockableScore this_obj_conv;
66950         this_obj_conv.inner = untag_ptr(this_obj);
66951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66953         MultiThreadedLockableScore_free(this_obj_conv);
66954 }
66955
66956 int64_t  CS_LDK_MultiThreadedLockableScore_as_LockableScore(int64_t this_arg) {
66957         LDKMultiThreadedLockableScore this_arg_conv;
66958         this_arg_conv.inner = untag_ptr(this_arg);
66959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66961         this_arg_conv.is_owned = false;
66962         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
66963         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
66964         return tag_ptr(ret_ret, true);
66965 }
66966
66967 int8_tArray  CS_LDK_MultiThreadedLockableScore_write(int64_t obj) {
66968         LDKMultiThreadedLockableScore obj_conv;
66969         obj_conv.inner = untag_ptr(obj);
66970         obj_conv.is_owned = ptr_is_owned(obj);
66971         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66972         obj_conv.is_owned = false;
66973         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
66974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66976         CVec_u8Z_free(ret_var);
66977         return ret_arr;
66978 }
66979
66980 int64_t  CS_LDK_MultiThreadedLockableScore_as_WriteableScore(int64_t this_arg) {
66981         LDKMultiThreadedLockableScore this_arg_conv;
66982         this_arg_conv.inner = untag_ptr(this_arg);
66983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66985         this_arg_conv.is_owned = false;
66986         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
66987         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
66988         return tag_ptr(ret_ret, true);
66989 }
66990
66991 int64_t  CS_LDK_MultiThreadedLockableScore_new(int64_t score) {
66992         void* score_ptr = untag_ptr(score);
66993         CHECK_ACCESS(score_ptr);
66994         LDKScore score_conv = *(LDKScore*)(score_ptr);
66995         if (score_conv.free == LDKScore_JCalls_free) {
66996                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66997                 LDKScore_JCalls_cloned(&score_conv);
66998         }
66999         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
67000         int64_t ret_ref = 0;
67001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67003         return ret_ref;
67004 }
67005
67006 void  CS_LDK_MultiThreadedScoreLockRead_free(int64_t this_obj) {
67007         LDKMultiThreadedScoreLockRead this_obj_conv;
67008         this_obj_conv.inner = untag_ptr(this_obj);
67009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67011         MultiThreadedScoreLockRead_free(this_obj_conv);
67012 }
67013
67014 void  CS_LDK_MultiThreadedScoreLockWrite_free(int64_t this_obj) {
67015         LDKMultiThreadedScoreLockWrite this_obj_conv;
67016         this_obj_conv.inner = untag_ptr(this_obj);
67017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67019         MultiThreadedScoreLockWrite_free(this_obj_conv);
67020 }
67021
67022 int64_t  CS_LDK_MultiThreadedScoreLockRead_as_ScoreLookUp(int64_t this_arg) {
67023         LDKMultiThreadedScoreLockRead this_arg_conv;
67024         this_arg_conv.inner = untag_ptr(this_arg);
67025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67027         this_arg_conv.is_owned = false;
67028         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67029         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
67030         return tag_ptr(ret_ret, true);
67031 }
67032
67033 int8_tArray  CS_LDK_MultiThreadedScoreLockWrite_write(int64_t obj) {
67034         LDKMultiThreadedScoreLockWrite obj_conv;
67035         obj_conv.inner = untag_ptr(obj);
67036         obj_conv.is_owned = ptr_is_owned(obj);
67037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67038         obj_conv.is_owned = false;
67039         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
67040         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67041         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67042         CVec_u8Z_free(ret_var);
67043         return ret_arr;
67044 }
67045
67046 int64_t  CS_LDK_MultiThreadedScoreLockWrite_as_ScoreUpdate(int64_t this_arg) {
67047         LDKMultiThreadedScoreLockWrite this_arg_conv;
67048         this_arg_conv.inner = untag_ptr(this_arg);
67049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67051         this_arg_conv.is_owned = false;
67052         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67053         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
67054         return tag_ptr(ret_ret, true);
67055 }
67056
67057 void  CS_LDK_ChannelUsage_free(int64_t this_obj) {
67058         LDKChannelUsage this_obj_conv;
67059         this_obj_conv.inner = untag_ptr(this_obj);
67060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67062         ChannelUsage_free(this_obj_conv);
67063 }
67064
67065 int64_t  CS_LDK_ChannelUsage_get_amount_msat(int64_t this_ptr) {
67066         LDKChannelUsage this_ptr_conv;
67067         this_ptr_conv.inner = untag_ptr(this_ptr);
67068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67070         this_ptr_conv.is_owned = false;
67071         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
67072         return ret_conv;
67073 }
67074
67075 void  CS_LDK_ChannelUsage_set_amount_msat(int64_t this_ptr, int64_t val) {
67076         LDKChannelUsage this_ptr_conv;
67077         this_ptr_conv.inner = untag_ptr(this_ptr);
67078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67080         this_ptr_conv.is_owned = false;
67081         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
67082 }
67083
67084 int64_t  CS_LDK_ChannelUsage_get_inflight_htlc_msat(int64_t this_ptr) {
67085         LDKChannelUsage this_ptr_conv;
67086         this_ptr_conv.inner = untag_ptr(this_ptr);
67087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67089         this_ptr_conv.is_owned = false;
67090         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
67091         return ret_conv;
67092 }
67093
67094 void  CS_LDK_ChannelUsage_set_inflight_htlc_msat(int64_t this_ptr, int64_t val) {
67095         LDKChannelUsage this_ptr_conv;
67096         this_ptr_conv.inner = untag_ptr(this_ptr);
67097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67099         this_ptr_conv.is_owned = false;
67100         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
67101 }
67102
67103 int64_t  CS_LDK_ChannelUsage_get_effective_capacity(int64_t this_ptr) {
67104         LDKChannelUsage this_ptr_conv;
67105         this_ptr_conv.inner = untag_ptr(this_ptr);
67106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67108         this_ptr_conv.is_owned = false;
67109         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
67110         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
67111         int64_t ret_ref = tag_ptr(ret_copy, true);
67112         return ret_ref;
67113 }
67114
67115 void  CS_LDK_ChannelUsage_set_effective_capacity(int64_t this_ptr, int64_t val) {
67116         LDKChannelUsage this_ptr_conv;
67117         this_ptr_conv.inner = untag_ptr(this_ptr);
67118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67120         this_ptr_conv.is_owned = false;
67121         void* val_ptr = untag_ptr(val);
67122         CHECK_ACCESS(val_ptr);
67123         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
67124         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
67125         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
67126 }
67127
67128 int64_t  CS_LDK_ChannelUsage_new(int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
67129         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
67130         CHECK_ACCESS(effective_capacity_arg_ptr);
67131         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
67132         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
67133         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
67134         int64_t ret_ref = 0;
67135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67137         return ret_ref;
67138 }
67139
67140 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
67141         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
67142         int64_t ret_ref = 0;
67143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67145         return ret_ref;
67146 }
67147 int64_t  CS_LDK_ChannelUsage_clone_ptr(int64_t arg) {
67148         LDKChannelUsage arg_conv;
67149         arg_conv.inner = untag_ptr(arg);
67150         arg_conv.is_owned = ptr_is_owned(arg);
67151         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67152         arg_conv.is_owned = false;
67153         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
67154         return ret_conv;
67155 }
67156
67157 int64_t  CS_LDK_ChannelUsage_clone(int64_t orig) {
67158         LDKChannelUsage orig_conv;
67159         orig_conv.inner = untag_ptr(orig);
67160         orig_conv.is_owned = ptr_is_owned(orig);
67161         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67162         orig_conv.is_owned = false;
67163         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
67164         int64_t ret_ref = 0;
67165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67167         return ret_ref;
67168 }
67169
67170 void  CS_LDK_FixedPenaltyScorer_free(int64_t this_obj) {
67171         LDKFixedPenaltyScorer this_obj_conv;
67172         this_obj_conv.inner = untag_ptr(this_obj);
67173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67175         FixedPenaltyScorer_free(this_obj_conv);
67176 }
67177
67178 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
67179         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
67180         int64_t ret_ref = 0;
67181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67183         return ret_ref;
67184 }
67185 int64_t  CS_LDK_FixedPenaltyScorer_clone_ptr(int64_t arg) {
67186         LDKFixedPenaltyScorer arg_conv;
67187         arg_conv.inner = untag_ptr(arg);
67188         arg_conv.is_owned = ptr_is_owned(arg);
67189         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67190         arg_conv.is_owned = false;
67191         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
67192         return ret_conv;
67193 }
67194
67195 int64_t  CS_LDK_FixedPenaltyScorer_clone(int64_t orig) {
67196         LDKFixedPenaltyScorer orig_conv;
67197         orig_conv.inner = untag_ptr(orig);
67198         orig_conv.is_owned = ptr_is_owned(orig);
67199         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67200         orig_conv.is_owned = false;
67201         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
67202         int64_t ret_ref = 0;
67203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67205         return ret_ref;
67206 }
67207
67208 int64_t  CS_LDK_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
67209         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
67210         int64_t ret_ref = 0;
67211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67213         return ret_ref;
67214 }
67215
67216 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreLookUp(int64_t this_arg) {
67217         LDKFixedPenaltyScorer this_arg_conv;
67218         this_arg_conv.inner = untag_ptr(this_arg);
67219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67221         this_arg_conv.is_owned = false;
67222         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67223         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
67224         return tag_ptr(ret_ret, true);
67225 }
67226
67227 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreUpdate(int64_t this_arg) {
67228         LDKFixedPenaltyScorer this_arg_conv;
67229         this_arg_conv.inner = untag_ptr(this_arg);
67230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67232         this_arg_conv.is_owned = false;
67233         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67234         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
67235         return tag_ptr(ret_ret, true);
67236 }
67237
67238 int8_tArray  CS_LDK_FixedPenaltyScorer_write(int64_t obj) {
67239         LDKFixedPenaltyScorer obj_conv;
67240         obj_conv.inner = untag_ptr(obj);
67241         obj_conv.is_owned = ptr_is_owned(obj);
67242         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67243         obj_conv.is_owned = false;
67244         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
67245         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67246         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67247         CVec_u8Z_free(ret_var);
67248         return ret_arr;
67249 }
67250
67251 int64_t  CS_LDK_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
67252         LDKu8slice ser_ref;
67253         ser_ref.datalen = ser->arr_len;
67254         ser_ref.data = ser->elems;
67255         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
67256         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
67257         FREE(ser);
67258         return tag_ptr(ret_conv, true);
67259 }
67260
67261 void  CS_LDK_ProbabilisticScorer_free(int64_t this_obj) {
67262         LDKProbabilisticScorer this_obj_conv;
67263         this_obj_conv.inner = untag_ptr(this_obj);
67264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67266         ProbabilisticScorer_free(this_obj_conv);
67267 }
67268
67269 void  CS_LDK_ProbabilisticScoringFeeParameters_free(int64_t this_obj) {
67270         LDKProbabilisticScoringFeeParameters this_obj_conv;
67271         this_obj_conv.inner = untag_ptr(this_obj);
67272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67274         ProbabilisticScoringFeeParameters_free(this_obj_conv);
67275 }
67276
67277 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_msat(int64_t this_ptr) {
67278         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67279         this_ptr_conv.inner = untag_ptr(this_ptr);
67280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67282         this_ptr_conv.is_owned = false;
67283         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
67284         return ret_conv;
67285 }
67286
67287 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_msat(int64_t this_ptr, int64_t val) {
67288         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67289         this_ptr_conv.inner = untag_ptr(this_ptr);
67290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67292         this_ptr_conv.is_owned = false;
67293         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
67294 }
67295
67296 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(int64_t this_ptr) {
67297         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67298         this_ptr_conv.inner = untag_ptr(this_ptr);
67299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67301         this_ptr_conv.is_owned = false;
67302         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
67303         return ret_conv;
67304 }
67305
67306 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
67307         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67308         this_ptr_conv.inner = untag_ptr(this_ptr);
67309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67311         this_ptr_conv.is_owned = false;
67312         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
67313 }
67314
67315 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
67316         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67317         this_ptr_conv.inner = untag_ptr(this_ptr);
67318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67320         this_ptr_conv.is_owned = false;
67321         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
67322         return ret_conv;
67323 }
67324
67325 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
67326         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67327         this_ptr_conv.inner = untag_ptr(this_ptr);
67328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67330         this_ptr_conv.is_owned = false;
67331         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
67332 }
67333
67334 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
67335         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67336         this_ptr_conv.inner = untag_ptr(this_ptr);
67337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67339         this_ptr_conv.is_owned = false;
67340         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
67341         return ret_conv;
67342 }
67343
67344 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
67345         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67346         this_ptr_conv.inner = untag_ptr(this_ptr);
67347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67349         this_ptr_conv.is_owned = false;
67350         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
67351 }
67352
67353 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
67354         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67355         this_ptr_conv.inner = untag_ptr(this_ptr);
67356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67358         this_ptr_conv.is_owned = false;
67359         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
67360         return ret_conv;
67361 }
67362
67363 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
67364         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67365         this_ptr_conv.inner = untag_ptr(this_ptr);
67366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67368         this_ptr_conv.is_owned = false;
67369         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
67370 }
67371
67372 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
67373         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67374         this_ptr_conv.inner = untag_ptr(this_ptr);
67375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67377         this_ptr_conv.is_owned = false;
67378         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
67379         return ret_conv;
67380 }
67381
67382 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
67383         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67384         this_ptr_conv.inner = untag_ptr(this_ptr);
67385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67387         this_ptr_conv.is_owned = false;
67388         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
67389 }
67390
67391 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(int64_t this_ptr) {
67392         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67393         this_ptr_conv.inner = untag_ptr(this_ptr);
67394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67396         this_ptr_conv.is_owned = false;
67397         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
67398         return ret_conv;
67399 }
67400
67401 void  CS_LDK_ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(int64_t this_ptr, int64_t val) {
67402         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67403         this_ptr_conv.inner = untag_ptr(this_ptr);
67404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67406         this_ptr_conv.is_owned = false;
67407         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
67408 }
67409
67410 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(int64_t this_ptr) {
67411         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67412         this_ptr_conv.inner = untag_ptr(this_ptr);
67413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67415         this_ptr_conv.is_owned = false;
67416         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
67417         return ret_conv;
67418 }
67419
67420 void  CS_LDK_ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(int64_t this_ptr, int64_t val) {
67421         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67422         this_ptr_conv.inner = untag_ptr(this_ptr);
67423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67425         this_ptr_conv.is_owned = false;
67426         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
67427 }
67428
67429 jboolean  CS_LDK_ProbabilisticScoringFeeParameters_get_linear_success_probability(int64_t this_ptr) {
67430         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67431         this_ptr_conv.inner = untag_ptr(this_ptr);
67432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67434         this_ptr_conv.is_owned = false;
67435         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
67436         return ret_conv;
67437 }
67438
67439 void  CS_LDK_ProbabilisticScoringFeeParameters_set_linear_success_probability(int64_t this_ptr, jboolean val) {
67440         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67441         this_ptr_conv.inner = untag_ptr(this_ptr);
67442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67444         this_ptr_conv.is_owned = false;
67445         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
67446 }
67447
67448 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
67449         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
67450         int64_t ret_ref = 0;
67451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67453         return ret_ref;
67454 }
67455 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone_ptr(int64_t arg) {
67456         LDKProbabilisticScoringFeeParameters arg_conv;
67457         arg_conv.inner = untag_ptr(arg);
67458         arg_conv.is_owned = ptr_is_owned(arg);
67459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67460         arg_conv.is_owned = false;
67461         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
67462         return ret_conv;
67463 }
67464
67465 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone(int64_t orig) {
67466         LDKProbabilisticScoringFeeParameters orig_conv;
67467         orig_conv.inner = untag_ptr(orig);
67468         orig_conv.is_owned = ptr_is_owned(orig);
67469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67470         orig_conv.is_owned = false;
67471         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
67472         int64_t ret_ref = 0;
67473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67475         return ret_ref;
67476 }
67477
67478 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_default() {
67479         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
67480         int64_t ret_ref = 0;
67481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67483         return ret_ref;
67484 }
67485
67486 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned(int64_t this_arg, int64_t node_id) {
67487         LDKProbabilisticScoringFeeParameters this_arg_conv;
67488         this_arg_conv.inner = untag_ptr(this_arg);
67489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67491         this_arg_conv.is_owned = false;
67492         LDKNodeId node_id_conv;
67493         node_id_conv.inner = untag_ptr(node_id);
67494         node_id_conv.is_owned = ptr_is_owned(node_id);
67495         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67496         node_id_conv.is_owned = false;
67497         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
67498 }
67499
67500 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned_from_list(int64_t this_arg, int64_tArray node_ids) {
67501         LDKProbabilisticScoringFeeParameters this_arg_conv;
67502         this_arg_conv.inner = untag_ptr(this_arg);
67503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67505         this_arg_conv.is_owned = false;
67506         LDKCVec_NodeIdZ node_ids_constr;
67507         node_ids_constr.datalen = node_ids->arr_len;
67508         if (node_ids_constr.datalen > 0)
67509                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
67510         else
67511                 node_ids_constr.data = NULL;
67512         int64_t* node_ids_vals = node_ids->elems;
67513         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
67514                 int64_t node_ids_conv_8 = node_ids_vals[i];
67515                 LDKNodeId node_ids_conv_8_conv;
67516                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
67517                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
67518                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
67519                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
67520                 node_ids_constr.data[i] = node_ids_conv_8_conv;
67521         }
67522         FREE(node_ids);
67523         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
67524 }
67525
67526 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_banned(int64_t this_arg, int64_t node_id) {
67527         LDKProbabilisticScoringFeeParameters this_arg_conv;
67528         this_arg_conv.inner = untag_ptr(this_arg);
67529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67531         this_arg_conv.is_owned = false;
67532         LDKNodeId node_id_conv;
67533         node_id_conv.inner = untag_ptr(node_id);
67534         node_id_conv.is_owned = ptr_is_owned(node_id);
67535         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67536         node_id_conv.is_owned = false;
67537         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
67538 }
67539
67540 void  CS_LDK_ProbabilisticScoringFeeParameters_set_manual_penalty(int64_t this_arg, int64_t node_id, int64_t penalty) {
67541         LDKProbabilisticScoringFeeParameters this_arg_conv;
67542         this_arg_conv.inner = untag_ptr(this_arg);
67543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67545         this_arg_conv.is_owned = false;
67546         LDKNodeId node_id_conv;
67547         node_id_conv.inner = untag_ptr(node_id);
67548         node_id_conv.is_owned = ptr_is_owned(node_id);
67549         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67550         node_id_conv.is_owned = false;
67551         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
67552 }
67553
67554 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_manual_penalty(int64_t this_arg, int64_t node_id) {
67555         LDKProbabilisticScoringFeeParameters this_arg_conv;
67556         this_arg_conv.inner = untag_ptr(this_arg);
67557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67559         this_arg_conv.is_owned = false;
67560         LDKNodeId node_id_conv;
67561         node_id_conv.inner = untag_ptr(node_id);
67562         node_id_conv.is_owned = ptr_is_owned(node_id);
67563         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67564         node_id_conv.is_owned = false;
67565         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
67566 }
67567
67568 void  CS_LDK_ProbabilisticScoringFeeParameters_clear_manual_penalties(int64_t this_arg) {
67569         LDKProbabilisticScoringFeeParameters this_arg_conv;
67570         this_arg_conv.inner = untag_ptr(this_arg);
67571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67573         this_arg_conv.is_owned = false;
67574         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
67575 }
67576
67577 void  CS_LDK_ProbabilisticScoringDecayParameters_free(int64_t this_obj) {
67578         LDKProbabilisticScoringDecayParameters this_obj_conv;
67579         this_obj_conv.inner = untag_ptr(this_obj);
67580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67582         ProbabilisticScoringDecayParameters_free(this_obj_conv);
67583 }
67584
67585 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(int64_t this_ptr) {
67586         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67587         this_ptr_conv.inner = untag_ptr(this_ptr);
67588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67590         this_ptr_conv.is_owned = false;
67591         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
67592         return ret_conv;
67593 }
67594
67595 void  CS_LDK_ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(int64_t this_ptr, int64_t val) {
67596         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67597         this_ptr_conv.inner = untag_ptr(this_ptr);
67598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67600         this_ptr_conv.is_owned = false;
67601         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
67602 }
67603
67604 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(int64_t this_ptr) {
67605         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67606         this_ptr_conv.inner = untag_ptr(this_ptr);
67607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67609         this_ptr_conv.is_owned = false;
67610         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
67611         return ret_conv;
67612 }
67613
67614 void  CS_LDK_ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(int64_t this_ptr, int64_t val) {
67615         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67616         this_ptr_conv.inner = untag_ptr(this_ptr);
67617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67619         this_ptr_conv.is_owned = false;
67620         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
67621 }
67622
67623 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_new(int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
67624         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
67625         int64_t ret_ref = 0;
67626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67628         return ret_ref;
67629 }
67630
67631 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
67632         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
67633         int64_t ret_ref = 0;
67634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67636         return ret_ref;
67637 }
67638 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone_ptr(int64_t arg) {
67639         LDKProbabilisticScoringDecayParameters arg_conv;
67640         arg_conv.inner = untag_ptr(arg);
67641         arg_conv.is_owned = ptr_is_owned(arg);
67642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67643         arg_conv.is_owned = false;
67644         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
67645         return ret_conv;
67646 }
67647
67648 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone(int64_t orig) {
67649         LDKProbabilisticScoringDecayParameters orig_conv;
67650         orig_conv.inner = untag_ptr(orig);
67651         orig_conv.is_owned = ptr_is_owned(orig);
67652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67653         orig_conv.is_owned = false;
67654         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
67655         int64_t ret_ref = 0;
67656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67658         return ret_ref;
67659 }
67660
67661 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_default() {
67662         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
67663         int64_t ret_ref = 0;
67664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67666         return ret_ref;
67667 }
67668
67669 int64_t  CS_LDK_ProbabilisticScorer_new(int64_t decay_params, int64_t network_graph, int64_t logger) {
67670         LDKProbabilisticScoringDecayParameters decay_params_conv;
67671         decay_params_conv.inner = untag_ptr(decay_params);
67672         decay_params_conv.is_owned = ptr_is_owned(decay_params);
67673         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
67674         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
67675         LDKNetworkGraph network_graph_conv;
67676         network_graph_conv.inner = untag_ptr(network_graph);
67677         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67678         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67679         network_graph_conv.is_owned = false;
67680         void* logger_ptr = untag_ptr(logger);
67681         CHECK_ACCESS(logger_ptr);
67682         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67683         if (logger_conv.free == LDKLogger_JCalls_free) {
67684                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67685                 LDKLogger_JCalls_cloned(&logger_conv);
67686         }
67687         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
67688         int64_t ret_ref = 0;
67689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67691         return ret_ref;
67692 }
67693
67694 void  CS_LDK_ProbabilisticScorer_debug_log_liquidity_stats(int64_t this_arg) {
67695         LDKProbabilisticScorer this_arg_conv;
67696         this_arg_conv.inner = untag_ptr(this_arg);
67697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67699         this_arg_conv.is_owned = false;
67700         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
67701 }
67702
67703 int64_t  CS_LDK_ProbabilisticScorer_estimated_channel_liquidity_range(int64_t this_arg, int64_t scid, int64_t target) {
67704         LDKProbabilisticScorer this_arg_conv;
67705         this_arg_conv.inner = untag_ptr(this_arg);
67706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67708         this_arg_conv.is_owned = false;
67709         LDKNodeId target_conv;
67710         target_conv.inner = untag_ptr(target);
67711         target_conv.is_owned = ptr_is_owned(target);
67712         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67713         target_conv.is_owned = false;
67714         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
67715         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
67716         int64_t ret_ref = tag_ptr(ret_copy, true);
67717         return ret_ref;
67718 }
67719
67720 int64_t  CS_LDK_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(int64_t this_arg, int64_t scid, int64_t target) {
67721         LDKProbabilisticScorer this_arg_conv;
67722         this_arg_conv.inner = untag_ptr(this_arg);
67723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67725         this_arg_conv.is_owned = false;
67726         LDKNodeId target_conv;
67727         target_conv.inner = untag_ptr(target);
67728         target_conv.is_owned = ptr_is_owned(target);
67729         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67730         target_conv.is_owned = false;
67731         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
67732         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
67733         int64_t ret_ref = tag_ptr(ret_copy, true);
67734         return ret_ref;
67735 }
67736
67737 int64_t  CS_LDK_ProbabilisticScorer_historical_estimated_payment_success_probability(int64_t this_arg, int64_t scid, int64_t target, int64_t amount_msat, int64_t params) {
67738         LDKProbabilisticScorer this_arg_conv;
67739         this_arg_conv.inner = untag_ptr(this_arg);
67740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67742         this_arg_conv.is_owned = false;
67743         LDKNodeId target_conv;
67744         target_conv.inner = untag_ptr(target);
67745         target_conv.is_owned = ptr_is_owned(target);
67746         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67747         target_conv.is_owned = false;
67748         LDKProbabilisticScoringFeeParameters params_conv;
67749         params_conv.inner = untag_ptr(params);
67750         params_conv.is_owned = ptr_is_owned(params);
67751         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
67752         params_conv.is_owned = false;
67753         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
67754         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
67755         int64_t ret_ref = tag_ptr(ret_copy, true);
67756         return ret_ref;
67757 }
67758
67759 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreLookUp(int64_t this_arg) {
67760         LDKProbabilisticScorer this_arg_conv;
67761         this_arg_conv.inner = untag_ptr(this_arg);
67762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67764         this_arg_conv.is_owned = false;
67765         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67766         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
67767         return tag_ptr(ret_ret, true);
67768 }
67769
67770 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreUpdate(int64_t this_arg) {
67771         LDKProbabilisticScorer this_arg_conv;
67772         this_arg_conv.inner = untag_ptr(this_arg);
67773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67775         this_arg_conv.is_owned = false;
67776         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67777         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
67778         return tag_ptr(ret_ret, true);
67779 }
67780
67781 int64_t  CS_LDK_ProbabilisticScorer_as_Score(int64_t this_arg) {
67782         LDKProbabilisticScorer this_arg_conv;
67783         this_arg_conv.inner = untag_ptr(this_arg);
67784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67786         this_arg_conv.is_owned = false;
67787         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
67788         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
67789         return tag_ptr(ret_ret, true);
67790 }
67791
67792 int8_tArray  CS_LDK_ProbabilisticScorer_write(int64_t obj) {
67793         LDKProbabilisticScorer obj_conv;
67794         obj_conv.inner = untag_ptr(obj);
67795         obj_conv.is_owned = ptr_is_owned(obj);
67796         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67797         obj_conv.is_owned = false;
67798         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
67799         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67800         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67801         CVec_u8Z_free(ret_var);
67802         return ret_arr;
67803 }
67804
67805 int64_t  CS_LDK_ProbabilisticScorer_read(int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c) {
67806         LDKu8slice ser_ref;
67807         ser_ref.datalen = ser->arr_len;
67808         ser_ref.data = ser->elems;
67809         LDKProbabilisticScoringDecayParameters arg_a_conv;
67810         arg_a_conv.inner = untag_ptr(arg_a);
67811         arg_a_conv.is_owned = ptr_is_owned(arg_a);
67812         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
67813         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
67814         LDKNetworkGraph arg_b_conv;
67815         arg_b_conv.inner = untag_ptr(arg_b);
67816         arg_b_conv.is_owned = ptr_is_owned(arg_b);
67817         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
67818         arg_b_conv.is_owned = false;
67819         void* arg_c_ptr = untag_ptr(arg_c);
67820         CHECK_ACCESS(arg_c_ptr);
67821         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
67822         if (arg_c_conv.free == LDKLogger_JCalls_free) {
67823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67824                 LDKLogger_JCalls_cloned(&arg_c_conv);
67825         }
67826         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
67827         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
67828         FREE(ser);
67829         return tag_ptr(ret_conv, true);
67830 }
67831
67832 void  CS_LDK_DelayedPaymentOutputDescriptor_free(int64_t this_obj) {
67833         LDKDelayedPaymentOutputDescriptor this_obj_conv;
67834         this_obj_conv.inner = untag_ptr(this_obj);
67835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67837         DelayedPaymentOutputDescriptor_free(this_obj_conv);
67838 }
67839
67840 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
67841         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67842         this_ptr_conv.inner = untag_ptr(this_ptr);
67843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67845         this_ptr_conv.is_owned = false;
67846         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67847         int64_t ret_ref = 0;
67848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67850         return ret_ref;
67851 }
67852
67853 void  CS_LDK_DelayedPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
67854         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67855         this_ptr_conv.inner = untag_ptr(this_ptr);
67856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67858         this_ptr_conv.is_owned = false;
67859         LDKOutPoint val_conv;
67860         val_conv.inner = untag_ptr(val);
67861         val_conv.is_owned = ptr_is_owned(val);
67862         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67863         val_conv = OutPoint_clone(&val_conv);
67864         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67865 }
67866
67867 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_per_commitment_point(int64_t this_ptr) {
67868         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67869         this_ptr_conv.inner = untag_ptr(this_ptr);
67870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67872         this_ptr_conv.is_owned = false;
67873         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67874         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
67875         return ret_arr;
67876 }
67877
67878 void  CS_LDK_DelayedPaymentOutputDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
67879         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67880         this_ptr_conv.inner = untag_ptr(this_ptr);
67881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67883         this_ptr_conv.is_owned = false;
67884         LDKPublicKey val_ref;
67885         CHECK(val->arr_len == 33);
67886         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
67887         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
67888 }
67889
67890 int16_t  CS_LDK_DelayedPaymentOutputDescriptor_get_to_self_delay(int64_t this_ptr) {
67891         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67892         this_ptr_conv.inner = untag_ptr(this_ptr);
67893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67895         this_ptr_conv.is_owned = false;
67896         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
67897         return ret_conv;
67898 }
67899
67900 void  CS_LDK_DelayedPaymentOutputDescriptor_set_to_self_delay(int64_t this_ptr, int16_t val) {
67901         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67902         this_ptr_conv.inner = untag_ptr(this_ptr);
67903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67905         this_ptr_conv.is_owned = false;
67906         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
67907 }
67908
67909 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_output(int64_t this_ptr) {
67910         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67911         this_ptr_conv.inner = untag_ptr(this_ptr);
67912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67914         this_ptr_conv.is_owned = false;
67915         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67916         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
67917         return tag_ptr(ret_ref, true);
67918 }
67919
67920 void  CS_LDK_DelayedPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
67921         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67922         this_ptr_conv.inner = untag_ptr(this_ptr);
67923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67925         this_ptr_conv.is_owned = false;
67926         void* val_ptr = untag_ptr(val);
67927         CHECK_ACCESS(val_ptr);
67928         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67929         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67930         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67931 }
67932
67933 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_revocation_pubkey(int64_t this_ptr) {
67934         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67935         this_ptr_conv.inner = untag_ptr(this_ptr);
67936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67938         this_ptr_conv.is_owned = false;
67939         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
67940         int64_t ret_ref = 0;
67941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67943         return ret_ref;
67944 }
67945
67946 void  CS_LDK_DelayedPaymentOutputDescriptor_set_revocation_pubkey(int64_t this_ptr, int64_t val) {
67947         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67948         this_ptr_conv.inner = untag_ptr(this_ptr);
67949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67951         this_ptr_conv.is_owned = false;
67952         LDKRevocationKey val_conv;
67953         val_conv.inner = untag_ptr(val);
67954         val_conv.is_owned = ptr_is_owned(val);
67955         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67956         val_conv = RevocationKey_clone(&val_conv);
67957         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
67958 }
67959
67960 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
67961         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67962         this_ptr_conv.inner = untag_ptr(this_ptr);
67963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67965         this_ptr_conv.is_owned = false;
67966         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67967         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
67968         return ret_arr;
67969 }
67970
67971 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
67972         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67973         this_ptr_conv.inner = untag_ptr(this_ptr);
67974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67976         this_ptr_conv.is_owned = false;
67977         LDKThirtyTwoBytes val_ref;
67978         CHECK(val->arr_len == 32);
67979         memcpy(val_ref.data, val->elems, 32); FREE(val);
67980         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67981 }
67982
67983 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
67984         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67985         this_ptr_conv.inner = untag_ptr(this_ptr);
67986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67988         this_ptr_conv.is_owned = false;
67989         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67990         return ret_conv;
67991 }
67992
67993 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
67994         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67995         this_ptr_conv.inner = untag_ptr(this_ptr);
67996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67998         this_ptr_conv.is_owned = false;
67999         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
68000 }
68001
68002 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_new(int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int64_t revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
68003         LDKOutPoint outpoint_arg_conv;
68004         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
68005         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
68006         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
68007         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
68008         LDKPublicKey per_commitment_point_arg_ref;
68009         CHECK(per_commitment_point_arg->arr_len == 33);
68010         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
68011         void* output_arg_ptr = untag_ptr(output_arg);
68012         CHECK_ACCESS(output_arg_ptr);
68013         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
68014         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
68015         LDKRevocationKey revocation_pubkey_arg_conv;
68016         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
68017         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
68018         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
68019         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
68020         LDKThirtyTwoBytes channel_keys_id_arg_ref;
68021         CHECK(channel_keys_id_arg->arr_len == 32);
68022         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
68023         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
68024         int64_t ret_ref = 0;
68025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68027         return ret_ref;
68028 }
68029
68030 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
68031         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
68032         int64_t ret_ref = 0;
68033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68035         return ret_ref;
68036 }
68037 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone_ptr(int64_t arg) {
68038         LDKDelayedPaymentOutputDescriptor arg_conv;
68039         arg_conv.inner = untag_ptr(arg);
68040         arg_conv.is_owned = ptr_is_owned(arg);
68041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68042         arg_conv.is_owned = false;
68043         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
68044         return ret_conv;
68045 }
68046
68047 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone(int64_t orig) {
68048         LDKDelayedPaymentOutputDescriptor orig_conv;
68049         orig_conv.inner = untag_ptr(orig);
68050         orig_conv.is_owned = ptr_is_owned(orig);
68051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68052         orig_conv.is_owned = false;
68053         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
68054         int64_t ret_ref = 0;
68055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68057         return ret_ref;
68058 }
68059
68060 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_hash(int64_t o) {
68061         LDKDelayedPaymentOutputDescriptor o_conv;
68062         o_conv.inner = untag_ptr(o);
68063         o_conv.is_owned = ptr_is_owned(o);
68064         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68065         o_conv.is_owned = false;
68066         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
68067         return ret_conv;
68068 }
68069
68070 jboolean  CS_LDK_DelayedPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
68071         LDKDelayedPaymentOutputDescriptor a_conv;
68072         a_conv.inner = untag_ptr(a);
68073         a_conv.is_owned = ptr_is_owned(a);
68074         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68075         a_conv.is_owned = false;
68076         LDKDelayedPaymentOutputDescriptor b_conv;
68077         b_conv.inner = untag_ptr(b);
68078         b_conv.is_owned = ptr_is_owned(b);
68079         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68080         b_conv.is_owned = false;
68081         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
68082         return ret_conv;
68083 }
68084
68085 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_write(int64_t obj) {
68086         LDKDelayedPaymentOutputDescriptor obj_conv;
68087         obj_conv.inner = untag_ptr(obj);
68088         obj_conv.is_owned = ptr_is_owned(obj);
68089         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68090         obj_conv.is_owned = false;
68091         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
68092         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68093         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68094         CVec_u8Z_free(ret_var);
68095         return ret_arr;
68096 }
68097
68098 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
68099         LDKu8slice ser_ref;
68100         ser_ref.datalen = ser->arr_len;
68101         ser_ref.data = ser->elems;
68102         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
68103         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
68104         FREE(ser);
68105         return tag_ptr(ret_conv, true);
68106 }
68107
68108 void  CS_LDK_StaticPaymentOutputDescriptor_free(int64_t this_obj) {
68109         LDKStaticPaymentOutputDescriptor this_obj_conv;
68110         this_obj_conv.inner = untag_ptr(this_obj);
68111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68113         StaticPaymentOutputDescriptor_free(this_obj_conv);
68114 }
68115
68116 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
68117         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68118         this_ptr_conv.inner = untag_ptr(this_ptr);
68119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68121         this_ptr_conv.is_owned = false;
68122         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
68123         int64_t ret_ref = 0;
68124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68126         return ret_ref;
68127 }
68128
68129 void  CS_LDK_StaticPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
68130         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68131         this_ptr_conv.inner = untag_ptr(this_ptr);
68132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68134         this_ptr_conv.is_owned = false;
68135         LDKOutPoint val_conv;
68136         val_conv.inner = untag_ptr(val);
68137         val_conv.is_owned = ptr_is_owned(val);
68138         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68139         val_conv = OutPoint_clone(&val_conv);
68140         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
68141 }
68142
68143 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_output(int64_t this_ptr) {
68144         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68145         this_ptr_conv.inner = untag_ptr(this_ptr);
68146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68148         this_ptr_conv.is_owned = false;
68149         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68150         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
68151         return tag_ptr(ret_ref, true);
68152 }
68153
68154 void  CS_LDK_StaticPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
68155         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68156         this_ptr_conv.inner = untag_ptr(this_ptr);
68157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68159         this_ptr_conv.is_owned = false;
68160         void* val_ptr = untag_ptr(val);
68161         CHECK_ACCESS(val_ptr);
68162         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
68163         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
68164         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
68165 }
68166
68167 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
68168         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68169         this_ptr_conv.inner = untag_ptr(this_ptr);
68170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68172         this_ptr_conv.is_owned = false;
68173         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68174         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
68175         return ret_arr;
68176 }
68177
68178 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
68179         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68180         this_ptr_conv.inner = untag_ptr(this_ptr);
68181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68183         this_ptr_conv.is_owned = false;
68184         LDKThirtyTwoBytes val_ref;
68185         CHECK(val->arr_len == 32);
68186         memcpy(val_ref.data, val->elems, 32); FREE(val);
68187         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
68188 }
68189
68190 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
68191         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68192         this_ptr_conv.inner = untag_ptr(this_ptr);
68193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68195         this_ptr_conv.is_owned = false;
68196         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
68197         return ret_conv;
68198 }
68199
68200 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
68201         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68202         this_ptr_conv.inner = untag_ptr(this_ptr);
68203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68205         this_ptr_conv.is_owned = false;
68206         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
68207 }
68208
68209 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(int64_t this_ptr) {
68210         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68211         this_ptr_conv.inner = untag_ptr(this_ptr);
68212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68214         this_ptr_conv.is_owned = false;
68215         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
68216         int64_t ret_ref = 0;
68217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68219         return ret_ref;
68220 }
68221
68222 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(int64_t this_ptr, int64_t val) {
68223         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68224         this_ptr_conv.inner = untag_ptr(this_ptr);
68225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68227         this_ptr_conv.is_owned = false;
68228         LDKChannelTransactionParameters val_conv;
68229         val_conv.inner = untag_ptr(val);
68230         val_conv.is_owned = ptr_is_owned(val);
68231         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68232         val_conv = ChannelTransactionParameters_clone(&val_conv);
68233         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
68234 }
68235
68236 int64_t  CS_LDK_StaticPaymentOutputDescriptor_new(int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, int64_t channel_transaction_parameters_arg) {
68237         LDKOutPoint outpoint_arg_conv;
68238         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
68239         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
68240         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
68241         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
68242         void* output_arg_ptr = untag_ptr(output_arg);
68243         CHECK_ACCESS(output_arg_ptr);
68244         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
68245         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
68246         LDKThirtyTwoBytes channel_keys_id_arg_ref;
68247         CHECK(channel_keys_id_arg->arr_len == 32);
68248         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
68249         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
68250         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
68251         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
68252         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
68253         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
68254         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
68255         int64_t ret_ref = 0;
68256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68258         return ret_ref;
68259 }
68260
68261 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
68262         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
68263         int64_t ret_ref = 0;
68264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68266         return ret_ref;
68267 }
68268 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone_ptr(int64_t arg) {
68269         LDKStaticPaymentOutputDescriptor arg_conv;
68270         arg_conv.inner = untag_ptr(arg);
68271         arg_conv.is_owned = ptr_is_owned(arg);
68272         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68273         arg_conv.is_owned = false;
68274         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
68275         return ret_conv;
68276 }
68277
68278 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone(int64_t orig) {
68279         LDKStaticPaymentOutputDescriptor orig_conv;
68280         orig_conv.inner = untag_ptr(orig);
68281         orig_conv.is_owned = ptr_is_owned(orig);
68282         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68283         orig_conv.is_owned = false;
68284         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
68285         int64_t ret_ref = 0;
68286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68288         return ret_ref;
68289 }
68290
68291 int64_t  CS_LDK_StaticPaymentOutputDescriptor_hash(int64_t o) {
68292         LDKStaticPaymentOutputDescriptor o_conv;
68293         o_conv.inner = untag_ptr(o);
68294         o_conv.is_owned = ptr_is_owned(o);
68295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68296         o_conv.is_owned = false;
68297         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
68298         return ret_conv;
68299 }
68300
68301 jboolean  CS_LDK_StaticPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
68302         LDKStaticPaymentOutputDescriptor a_conv;
68303         a_conv.inner = untag_ptr(a);
68304         a_conv.is_owned = ptr_is_owned(a);
68305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68306         a_conv.is_owned = false;
68307         LDKStaticPaymentOutputDescriptor b_conv;
68308         b_conv.inner = untag_ptr(b);
68309         b_conv.is_owned = ptr_is_owned(b);
68310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68311         b_conv.is_owned = false;
68312         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
68313         return ret_conv;
68314 }
68315
68316 int64_t  CS_LDK_StaticPaymentOutputDescriptor_witness_script(int64_t this_arg) {
68317         LDKStaticPaymentOutputDescriptor this_arg_conv;
68318         this_arg_conv.inner = untag_ptr(this_arg);
68319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68321         this_arg_conv.is_owned = false;
68322         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68323         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
68324         int64_t ret_ref = tag_ptr(ret_copy, true);
68325         return ret_ref;
68326 }
68327
68328 int64_t  CS_LDK_StaticPaymentOutputDescriptor_max_witness_length(int64_t this_arg) {
68329         LDKStaticPaymentOutputDescriptor this_arg_conv;
68330         this_arg_conv.inner = untag_ptr(this_arg);
68331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68333         this_arg_conv.is_owned = false;
68334         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
68335         return ret_conv;
68336 }
68337
68338 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_write(int64_t obj) {
68339         LDKStaticPaymentOutputDescriptor obj_conv;
68340         obj_conv.inner = untag_ptr(obj);
68341         obj_conv.is_owned = ptr_is_owned(obj);
68342         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68343         obj_conv.is_owned = false;
68344         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
68345         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68346         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68347         CVec_u8Z_free(ret_var);
68348         return ret_arr;
68349 }
68350
68351 int64_t  CS_LDK_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
68352         LDKu8slice ser_ref;
68353         ser_ref.datalen = ser->arr_len;
68354         ser_ref.data = ser->elems;
68355         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
68356         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
68357         FREE(ser);
68358         return tag_ptr(ret_conv, true);
68359 }
68360
68361 void  CS_LDK_SpendableOutputDescriptor_free(int64_t this_ptr) {
68362         if (!ptr_is_owned(this_ptr)) return;
68363         void* this_ptr_ptr = untag_ptr(this_ptr);
68364         CHECK_ACCESS(this_ptr_ptr);
68365         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
68366         FREE(untag_ptr(this_ptr));
68367         SpendableOutputDescriptor_free(this_ptr_conv);
68368 }
68369
68370 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
68371         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68372         *ret_copy = SpendableOutputDescriptor_clone(arg);
68373         int64_t ret_ref = tag_ptr(ret_copy, true);
68374         return ret_ref;
68375 }
68376 int64_t  CS_LDK_SpendableOutputDescriptor_clone_ptr(int64_t arg) {
68377         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
68378         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
68379         return ret_conv;
68380 }
68381
68382 int64_t  CS_LDK_SpendableOutputDescriptor_clone(int64_t orig) {
68383         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
68384         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68385         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
68386         int64_t ret_ref = tag_ptr(ret_copy, true);
68387         return ret_ref;
68388 }
68389
68390 int64_t  CS_LDK_SpendableOutputDescriptor_static_output(int64_t outpoint, int64_t output, int8_tArray channel_keys_id) {
68391         LDKOutPoint outpoint_conv;
68392         outpoint_conv.inner = untag_ptr(outpoint);
68393         outpoint_conv.is_owned = ptr_is_owned(outpoint);
68394         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
68395         outpoint_conv = OutPoint_clone(&outpoint_conv);
68396         void* output_ptr = untag_ptr(output);
68397         CHECK_ACCESS(output_ptr);
68398         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
68399         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
68400         LDKThirtyTwoBytes channel_keys_id_ref;
68401         CHECK(channel_keys_id->arr_len == 32);
68402         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
68403         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68404         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
68405         int64_t ret_ref = tag_ptr(ret_copy, true);
68406         return ret_ref;
68407 }
68408
68409 int64_t  CS_LDK_SpendableOutputDescriptor_delayed_payment_output(int64_t a) {
68410         LDKDelayedPaymentOutputDescriptor a_conv;
68411         a_conv.inner = untag_ptr(a);
68412         a_conv.is_owned = ptr_is_owned(a);
68413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68414         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
68415         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68416         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
68417         int64_t ret_ref = tag_ptr(ret_copy, true);
68418         return ret_ref;
68419 }
68420
68421 int64_t  CS_LDK_SpendableOutputDescriptor_static_payment_output(int64_t a) {
68422         LDKStaticPaymentOutputDescriptor a_conv;
68423         a_conv.inner = untag_ptr(a);
68424         a_conv.is_owned = ptr_is_owned(a);
68425         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68426         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
68427         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68428         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
68429         int64_t ret_ref = tag_ptr(ret_copy, true);
68430         return ret_ref;
68431 }
68432
68433 int64_t  CS_LDK_SpendableOutputDescriptor_hash(int64_t o) {
68434         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
68435         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
68436         return ret_conv;
68437 }
68438
68439 jboolean  CS_LDK_SpendableOutputDescriptor_eq(int64_t a, int64_t b) {
68440         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
68441         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
68442         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
68443         return ret_conv;
68444 }
68445
68446 int8_tArray  CS_LDK_SpendableOutputDescriptor_write(int64_t obj) {
68447         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
68448         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
68449         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68450         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68451         CVec_u8Z_free(ret_var);
68452         return ret_arr;
68453 }
68454
68455 int64_t  CS_LDK_SpendableOutputDescriptor_read(int8_tArray ser) {
68456         LDKu8slice ser_ref;
68457         ser_ref.datalen = ser->arr_len;
68458         ser_ref.data = ser->elems;
68459         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
68460         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
68461         FREE(ser);
68462         return tag_ptr(ret_conv, true);
68463 }
68464
68465 int64_t  CS_LDK_SpendableOutputDescriptor_create_spendable_outputs_psbt(int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
68466         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68467         descriptors_constr.datalen = descriptors->arr_len;
68468         if (descriptors_constr.datalen > 0)
68469                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68470         else
68471                 descriptors_constr.data = NULL;
68472         int64_t* descriptors_vals = descriptors->elems;
68473         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68474                 int64_t descriptors_conv_27 = descriptors_vals[b];
68475                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68476                 CHECK_ACCESS(descriptors_conv_27_ptr);
68477                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68478                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68479                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68480         }
68481         FREE(descriptors);
68482         LDKCVec_TxOutZ outputs_constr;
68483         outputs_constr.datalen = outputs->arr_len;
68484         if (outputs_constr.datalen > 0)
68485                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68486         else
68487                 outputs_constr.data = NULL;
68488         int64_t* outputs_vals = outputs->elems;
68489         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68490                 int64_t outputs_conv_7 = outputs_vals[h];
68491                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68492                 CHECK_ACCESS(outputs_conv_7_ptr);
68493                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68494                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68495                 outputs_constr.data[h] = outputs_conv_7_conv;
68496         }
68497         FREE(outputs);
68498         LDKCVec_u8Z change_destination_script_ref;
68499         change_destination_script_ref.datalen = change_destination_script->arr_len;
68500         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68501         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
68502         void* locktime_ptr = untag_ptr(locktime);
68503         CHECK_ACCESS(locktime_ptr);
68504         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68505         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68506         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
68507         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68508         return tag_ptr(ret_conv, true);
68509 }
68510
68511 void  CS_LDK_ChannelDerivationParameters_free(int64_t this_obj) {
68512         LDKChannelDerivationParameters this_obj_conv;
68513         this_obj_conv.inner = untag_ptr(this_obj);
68514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68516         ChannelDerivationParameters_free(this_obj_conv);
68517 }
68518
68519 int64_t  CS_LDK_ChannelDerivationParameters_get_value_satoshis(int64_t this_ptr) {
68520         LDKChannelDerivationParameters this_ptr_conv;
68521         this_ptr_conv.inner = untag_ptr(this_ptr);
68522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68524         this_ptr_conv.is_owned = false;
68525         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
68526         return ret_conv;
68527 }
68528
68529 void  CS_LDK_ChannelDerivationParameters_set_value_satoshis(int64_t this_ptr, int64_t val) {
68530         LDKChannelDerivationParameters this_ptr_conv;
68531         this_ptr_conv.inner = untag_ptr(this_ptr);
68532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68534         this_ptr_conv.is_owned = false;
68535         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
68536 }
68537
68538 int8_tArray  CS_LDK_ChannelDerivationParameters_get_keys_id(int64_t this_ptr) {
68539         LDKChannelDerivationParameters this_ptr_conv;
68540         this_ptr_conv.inner = untag_ptr(this_ptr);
68541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68543         this_ptr_conv.is_owned = false;
68544         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68545         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
68546         return ret_arr;
68547 }
68548
68549 void  CS_LDK_ChannelDerivationParameters_set_keys_id(int64_t this_ptr, int8_tArray val) {
68550         LDKChannelDerivationParameters this_ptr_conv;
68551         this_ptr_conv.inner = untag_ptr(this_ptr);
68552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68554         this_ptr_conv.is_owned = false;
68555         LDKThirtyTwoBytes val_ref;
68556         CHECK(val->arr_len == 32);
68557         memcpy(val_ref.data, val->elems, 32); FREE(val);
68558         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
68559 }
68560
68561 int64_t  CS_LDK_ChannelDerivationParameters_get_transaction_parameters(int64_t this_ptr) {
68562         LDKChannelDerivationParameters this_ptr_conv;
68563         this_ptr_conv.inner = untag_ptr(this_ptr);
68564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68566         this_ptr_conv.is_owned = false;
68567         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
68568         int64_t ret_ref = 0;
68569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68571         return ret_ref;
68572 }
68573
68574 void  CS_LDK_ChannelDerivationParameters_set_transaction_parameters(int64_t this_ptr, int64_t val) {
68575         LDKChannelDerivationParameters this_ptr_conv;
68576         this_ptr_conv.inner = untag_ptr(this_ptr);
68577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68579         this_ptr_conv.is_owned = false;
68580         LDKChannelTransactionParameters val_conv;
68581         val_conv.inner = untag_ptr(val);
68582         val_conv.is_owned = ptr_is_owned(val);
68583         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68584         val_conv = ChannelTransactionParameters_clone(&val_conv);
68585         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
68586 }
68587
68588 int64_t  CS_LDK_ChannelDerivationParameters_new(int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) {
68589         LDKThirtyTwoBytes keys_id_arg_ref;
68590         CHECK(keys_id_arg->arr_len == 32);
68591         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
68592         LDKChannelTransactionParameters transaction_parameters_arg_conv;
68593         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
68594         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
68595         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
68596         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
68597         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
68598         int64_t ret_ref = 0;
68599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68601         return ret_ref;
68602 }
68603
68604 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
68605         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
68606         int64_t ret_ref = 0;
68607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68609         return ret_ref;
68610 }
68611 int64_t  CS_LDK_ChannelDerivationParameters_clone_ptr(int64_t arg) {
68612         LDKChannelDerivationParameters arg_conv;
68613         arg_conv.inner = untag_ptr(arg);
68614         arg_conv.is_owned = ptr_is_owned(arg);
68615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68616         arg_conv.is_owned = false;
68617         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
68618         return ret_conv;
68619 }
68620
68621 int64_t  CS_LDK_ChannelDerivationParameters_clone(int64_t orig) {
68622         LDKChannelDerivationParameters orig_conv;
68623         orig_conv.inner = untag_ptr(orig);
68624         orig_conv.is_owned = ptr_is_owned(orig);
68625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68626         orig_conv.is_owned = false;
68627         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
68628         int64_t ret_ref = 0;
68629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68631         return ret_ref;
68632 }
68633
68634 jboolean  CS_LDK_ChannelDerivationParameters_eq(int64_t a, int64_t b) {
68635         LDKChannelDerivationParameters a_conv;
68636         a_conv.inner = untag_ptr(a);
68637         a_conv.is_owned = ptr_is_owned(a);
68638         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68639         a_conv.is_owned = false;
68640         LDKChannelDerivationParameters b_conv;
68641         b_conv.inner = untag_ptr(b);
68642         b_conv.is_owned = ptr_is_owned(b);
68643         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68644         b_conv.is_owned = false;
68645         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
68646         return ret_conv;
68647 }
68648
68649 int8_tArray  CS_LDK_ChannelDerivationParameters_write(int64_t obj) {
68650         LDKChannelDerivationParameters obj_conv;
68651         obj_conv.inner = untag_ptr(obj);
68652         obj_conv.is_owned = ptr_is_owned(obj);
68653         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68654         obj_conv.is_owned = false;
68655         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
68656         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68657         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68658         CVec_u8Z_free(ret_var);
68659         return ret_arr;
68660 }
68661
68662 int64_t  CS_LDK_ChannelDerivationParameters_read(int8_tArray ser) {
68663         LDKu8slice ser_ref;
68664         ser_ref.datalen = ser->arr_len;
68665         ser_ref.data = ser->elems;
68666         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
68667         *ret_conv = ChannelDerivationParameters_read(ser_ref);
68668         FREE(ser);
68669         return tag_ptr(ret_conv, true);
68670 }
68671
68672 void  CS_LDK_HTLCDescriptor_free(int64_t this_obj) {
68673         LDKHTLCDescriptor this_obj_conv;
68674         this_obj_conv.inner = untag_ptr(this_obj);
68675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68677         HTLCDescriptor_free(this_obj_conv);
68678 }
68679
68680 int64_t  CS_LDK_HTLCDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
68681         LDKHTLCDescriptor this_ptr_conv;
68682         this_ptr_conv.inner = untag_ptr(this_ptr);
68683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68685         this_ptr_conv.is_owned = false;
68686         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
68687         int64_t ret_ref = 0;
68688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68690         return ret_ref;
68691 }
68692
68693 void  CS_LDK_HTLCDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
68694         LDKHTLCDescriptor this_ptr_conv;
68695         this_ptr_conv.inner = untag_ptr(this_ptr);
68696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68698         this_ptr_conv.is_owned = false;
68699         LDKChannelDerivationParameters val_conv;
68700         val_conv.inner = untag_ptr(val);
68701         val_conv.is_owned = ptr_is_owned(val);
68702         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68703         val_conv = ChannelDerivationParameters_clone(&val_conv);
68704         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
68705 }
68706
68707 int64_t  CS_LDK_HTLCDescriptor_get_per_commitment_number(int64_t this_ptr) {
68708         LDKHTLCDescriptor this_ptr_conv;
68709         this_ptr_conv.inner = untag_ptr(this_ptr);
68710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68712         this_ptr_conv.is_owned = false;
68713         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
68714         return ret_conv;
68715 }
68716
68717 void  CS_LDK_HTLCDescriptor_set_per_commitment_number(int64_t this_ptr, int64_t val) {
68718         LDKHTLCDescriptor this_ptr_conv;
68719         this_ptr_conv.inner = untag_ptr(this_ptr);
68720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68722         this_ptr_conv.is_owned = false;
68723         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
68724 }
68725
68726 int8_tArray  CS_LDK_HTLCDescriptor_get_per_commitment_point(int64_t this_ptr) {
68727         LDKHTLCDescriptor this_ptr_conv;
68728         this_ptr_conv.inner = untag_ptr(this_ptr);
68729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68731         this_ptr_conv.is_owned = false;
68732         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68733         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
68734         return ret_arr;
68735 }
68736
68737 void  CS_LDK_HTLCDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
68738         LDKHTLCDescriptor this_ptr_conv;
68739         this_ptr_conv.inner = untag_ptr(this_ptr);
68740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68742         this_ptr_conv.is_owned = false;
68743         LDKPublicKey val_ref;
68744         CHECK(val->arr_len == 33);
68745         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68746         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
68747 }
68748
68749 int32_t  CS_LDK_HTLCDescriptor_get_feerate_per_kw(int64_t this_ptr) {
68750         LDKHTLCDescriptor this_ptr_conv;
68751         this_ptr_conv.inner = untag_ptr(this_ptr);
68752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68754         this_ptr_conv.is_owned = false;
68755         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
68756         return ret_conv;
68757 }
68758
68759 void  CS_LDK_HTLCDescriptor_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
68760         LDKHTLCDescriptor this_ptr_conv;
68761         this_ptr_conv.inner = untag_ptr(this_ptr);
68762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68764         this_ptr_conv.is_owned = false;
68765         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
68766 }
68767
68768 int64_t  CS_LDK_HTLCDescriptor_get_htlc(int64_t this_ptr) {
68769         LDKHTLCDescriptor this_ptr_conv;
68770         this_ptr_conv.inner = untag_ptr(this_ptr);
68771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68773         this_ptr_conv.is_owned = false;
68774         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
68775         int64_t ret_ref = 0;
68776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68778         return ret_ref;
68779 }
68780
68781 void  CS_LDK_HTLCDescriptor_set_htlc(int64_t this_ptr, int64_t val) {
68782         LDKHTLCDescriptor this_ptr_conv;
68783         this_ptr_conv.inner = untag_ptr(this_ptr);
68784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68786         this_ptr_conv.is_owned = false;
68787         LDKHTLCOutputInCommitment val_conv;
68788         val_conv.inner = untag_ptr(val);
68789         val_conv.is_owned = ptr_is_owned(val);
68790         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68791         val_conv = HTLCOutputInCommitment_clone(&val_conv);
68792         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
68793 }
68794
68795 int64_t  CS_LDK_HTLCDescriptor_get_preimage(int64_t this_ptr) {
68796         LDKHTLCDescriptor this_ptr_conv;
68797         this_ptr_conv.inner = untag_ptr(this_ptr);
68798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68800         this_ptr_conv.is_owned = false;
68801         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
68802         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
68803         int64_t ret_ref = tag_ptr(ret_copy, true);
68804         return ret_ref;
68805 }
68806
68807 void  CS_LDK_HTLCDescriptor_set_preimage(int64_t this_ptr, int64_t val) {
68808         LDKHTLCDescriptor this_ptr_conv;
68809         this_ptr_conv.inner = untag_ptr(this_ptr);
68810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68812         this_ptr_conv.is_owned = false;
68813         void* val_ptr = untag_ptr(val);
68814         CHECK_ACCESS(val_ptr);
68815         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
68816         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
68817         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
68818 }
68819
68820 int8_tArray  CS_LDK_HTLCDescriptor_get_counterparty_sig(int64_t this_ptr) {
68821         LDKHTLCDescriptor this_ptr_conv;
68822         this_ptr_conv.inner = untag_ptr(this_ptr);
68823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68825         this_ptr_conv.is_owned = false;
68826         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
68827         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
68828         return ret_arr;
68829 }
68830
68831 void  CS_LDK_HTLCDescriptor_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
68832         LDKHTLCDescriptor this_ptr_conv;
68833         this_ptr_conv.inner = untag_ptr(this_ptr);
68834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68836         this_ptr_conv.is_owned = false;
68837         LDKECDSASignature val_ref;
68838         CHECK(val->arr_len == 64);
68839         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
68840         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
68841 }
68842
68843 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
68844         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
68845         int64_t ret_ref = 0;
68846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68848         return ret_ref;
68849 }
68850 int64_t  CS_LDK_HTLCDescriptor_clone_ptr(int64_t arg) {
68851         LDKHTLCDescriptor arg_conv;
68852         arg_conv.inner = untag_ptr(arg);
68853         arg_conv.is_owned = ptr_is_owned(arg);
68854         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68855         arg_conv.is_owned = false;
68856         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
68857         return ret_conv;
68858 }
68859
68860 int64_t  CS_LDK_HTLCDescriptor_clone(int64_t orig) {
68861         LDKHTLCDescriptor orig_conv;
68862         orig_conv.inner = untag_ptr(orig);
68863         orig_conv.is_owned = ptr_is_owned(orig);
68864         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68865         orig_conv.is_owned = false;
68866         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
68867         int64_t ret_ref = 0;
68868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68870         return ret_ref;
68871 }
68872
68873 jboolean  CS_LDK_HTLCDescriptor_eq(int64_t a, int64_t b) {
68874         LDKHTLCDescriptor a_conv;
68875         a_conv.inner = untag_ptr(a);
68876         a_conv.is_owned = ptr_is_owned(a);
68877         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68878         a_conv.is_owned = false;
68879         LDKHTLCDescriptor b_conv;
68880         b_conv.inner = untag_ptr(b);
68881         b_conv.is_owned = ptr_is_owned(b);
68882         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68883         b_conv.is_owned = false;
68884         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
68885         return ret_conv;
68886 }
68887
68888 int8_tArray  CS_LDK_HTLCDescriptor_write(int64_t obj) {
68889         LDKHTLCDescriptor obj_conv;
68890         obj_conv.inner = untag_ptr(obj);
68891         obj_conv.is_owned = ptr_is_owned(obj);
68892         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68893         obj_conv.is_owned = false;
68894         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
68895         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68896         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68897         CVec_u8Z_free(ret_var);
68898         return ret_arr;
68899 }
68900
68901 int64_t  CS_LDK_HTLCDescriptor_read(int8_tArray ser) {
68902         LDKu8slice ser_ref;
68903         ser_ref.datalen = ser->arr_len;
68904         ser_ref.data = ser->elems;
68905         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
68906         *ret_conv = HTLCDescriptor_read(ser_ref);
68907         FREE(ser);
68908         return tag_ptr(ret_conv, true);
68909 }
68910
68911 int64_t  CS_LDK_HTLCDescriptor_outpoint(int64_t this_arg) {
68912         LDKHTLCDescriptor this_arg_conv;
68913         this_arg_conv.inner = untag_ptr(this_arg);
68914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68916         this_arg_conv.is_owned = false;
68917         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
68918         int64_t ret_ref = 0;
68919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68921         return ret_ref;
68922 }
68923
68924 int64_t  CS_LDK_HTLCDescriptor_previous_utxo(int64_t this_arg) {
68925         LDKHTLCDescriptor this_arg_conv;
68926         this_arg_conv.inner = untag_ptr(this_arg);
68927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68929         this_arg_conv.is_owned = false;
68930         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68931         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
68932         return tag_ptr(ret_ref, true);
68933 }
68934
68935 int64_t  CS_LDK_HTLCDescriptor_unsigned_tx_input(int64_t this_arg) {
68936         LDKHTLCDescriptor this_arg_conv;
68937         this_arg_conv.inner = untag_ptr(this_arg);
68938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68940         this_arg_conv.is_owned = false;
68941         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
68942         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
68943         return tag_ptr(ret_ref, true);
68944 }
68945
68946 int64_t  CS_LDK_HTLCDescriptor_tx_output(int64_t this_arg) {
68947         LDKHTLCDescriptor this_arg_conv;
68948         this_arg_conv.inner = untag_ptr(this_arg);
68949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68951         this_arg_conv.is_owned = false;
68952         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68953         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
68954         return tag_ptr(ret_ref, true);
68955 }
68956
68957 int8_tArray  CS_LDK_HTLCDescriptor_witness_script(int64_t this_arg) {
68958         LDKHTLCDescriptor this_arg_conv;
68959         this_arg_conv.inner = untag_ptr(this_arg);
68960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68962         this_arg_conv.is_owned = false;
68963         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
68964         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68965         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68966         CVec_u8Z_free(ret_var);
68967         return ret_arr;
68968 }
68969
68970 int8_tArray  CS_LDK_HTLCDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
68971         LDKHTLCDescriptor this_arg_conv;
68972         this_arg_conv.inner = untag_ptr(this_arg);
68973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68975         this_arg_conv.is_owned = false;
68976         LDKECDSASignature signature_ref;
68977         CHECK(signature->arr_len == 64);
68978         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
68979         LDKu8slice witness_script_ref;
68980         witness_script_ref.datalen = witness_script->arr_len;
68981         witness_script_ref.data = witness_script->elems;
68982         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
68983         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68984         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68985         Witness_free(ret_var);
68986         FREE(witness_script);
68987         return ret_arr;
68988 }
68989
68990 int64_t  CS_LDK_HTLCDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
68991         LDKHTLCDescriptor this_arg_conv;
68992         this_arg_conv.inner = untag_ptr(this_arg);
68993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68995         this_arg_conv.is_owned = false;
68996         void* signer_provider_ptr = untag_ptr(signer_provider);
68997         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
68998         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
68999         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69000         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
69001         return tag_ptr(ret_ret, true);
69002 }
69003
69004 void  CS_LDK_ChannelSigner_free(int64_t this_ptr) {
69005         if (!ptr_is_owned(this_ptr)) return;
69006         void* this_ptr_ptr = untag_ptr(this_ptr);
69007         CHECK_ACCESS(this_ptr_ptr);
69008         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
69009         FREE(untag_ptr(this_ptr));
69010         ChannelSigner_free(this_ptr_conv);
69011 }
69012
69013 int32_t  CS_LDK_Recipient_clone(int64_t orig) {
69014         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
69015         int32_t ret_conv = LDKRecipient_to_cs(Recipient_clone(orig_conv));
69016         return ret_conv;
69017 }
69018
69019 int32_t  CS_LDK_Recipient_node() {
69020         int32_t ret_conv = LDKRecipient_to_cs(Recipient_node());
69021         return ret_conv;
69022 }
69023
69024 int32_t  CS_LDK_Recipient_phantom_node() {
69025         int32_t ret_conv = LDKRecipient_to_cs(Recipient_phantom_node());
69026         return ret_conv;
69027 }
69028
69029 void  CS_LDK_EntropySource_free(int64_t this_ptr) {
69030         if (!ptr_is_owned(this_ptr)) return;
69031         void* this_ptr_ptr = untag_ptr(this_ptr);
69032         CHECK_ACCESS(this_ptr_ptr);
69033         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
69034         FREE(untag_ptr(this_ptr));
69035         EntropySource_free(this_ptr_conv);
69036 }
69037
69038 void  CS_LDK_NodeSigner_free(int64_t this_ptr) {
69039         if (!ptr_is_owned(this_ptr)) return;
69040         void* this_ptr_ptr = untag_ptr(this_ptr);
69041         CHECK_ACCESS(this_ptr_ptr);
69042         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
69043         FREE(untag_ptr(this_ptr));
69044         NodeSigner_free(this_ptr_conv);
69045 }
69046
69047 void  CS_LDK_SignerProvider_free(int64_t this_ptr) {
69048         if (!ptr_is_owned(this_ptr)) return;
69049         void* this_ptr_ptr = untag_ptr(this_ptr);
69050         CHECK_ACCESS(this_ptr_ptr);
69051         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
69052         FREE(untag_ptr(this_ptr));
69053         SignerProvider_free(this_ptr_conv);
69054 }
69055
69056 void  CS_LDK_InMemorySigner_free(int64_t this_obj) {
69057         LDKInMemorySigner this_obj_conv;
69058         this_obj_conv.inner = untag_ptr(this_obj);
69059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69061         InMemorySigner_free(this_obj_conv);
69062 }
69063
69064 int8_tArray  CS_LDK_InMemorySigner_get_funding_key(int64_t this_ptr) {
69065         LDKInMemorySigner this_ptr_conv;
69066         this_ptr_conv.inner = untag_ptr(this_ptr);
69067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69069         this_ptr_conv.is_owned = false;
69070         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69071         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
69072         return ret_arr;
69073 }
69074
69075 void  CS_LDK_InMemorySigner_set_funding_key(int64_t this_ptr, int8_tArray val) {
69076         LDKInMemorySigner this_ptr_conv;
69077         this_ptr_conv.inner = untag_ptr(this_ptr);
69078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69080         this_ptr_conv.is_owned = false;
69081         LDKSecretKey val_ref;
69082         CHECK(val->arr_len == 32);
69083         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69084         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
69085 }
69086
69087 int8_tArray  CS_LDK_InMemorySigner_get_revocation_base_key(int64_t this_ptr) {
69088         LDKInMemorySigner this_ptr_conv;
69089         this_ptr_conv.inner = untag_ptr(this_ptr);
69090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69092         this_ptr_conv.is_owned = false;
69093         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69094         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
69095         return ret_arr;
69096 }
69097
69098 void  CS_LDK_InMemorySigner_set_revocation_base_key(int64_t this_ptr, int8_tArray val) {
69099         LDKInMemorySigner this_ptr_conv;
69100         this_ptr_conv.inner = untag_ptr(this_ptr);
69101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69103         this_ptr_conv.is_owned = false;
69104         LDKSecretKey val_ref;
69105         CHECK(val->arr_len == 32);
69106         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69107         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
69108 }
69109
69110 int8_tArray  CS_LDK_InMemorySigner_get_payment_key(int64_t this_ptr) {
69111         LDKInMemorySigner this_ptr_conv;
69112         this_ptr_conv.inner = untag_ptr(this_ptr);
69113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69115         this_ptr_conv.is_owned = false;
69116         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69117         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
69118         return ret_arr;
69119 }
69120
69121 void  CS_LDK_InMemorySigner_set_payment_key(int64_t this_ptr, int8_tArray val) {
69122         LDKInMemorySigner this_ptr_conv;
69123         this_ptr_conv.inner = untag_ptr(this_ptr);
69124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69126         this_ptr_conv.is_owned = false;
69127         LDKSecretKey val_ref;
69128         CHECK(val->arr_len == 32);
69129         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69130         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
69131 }
69132
69133 int8_tArray  CS_LDK_InMemorySigner_get_delayed_payment_base_key(int64_t this_ptr) {
69134         LDKInMemorySigner this_ptr_conv;
69135         this_ptr_conv.inner = untag_ptr(this_ptr);
69136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69138         this_ptr_conv.is_owned = false;
69139         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69140         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
69141         return ret_arr;
69142 }
69143
69144 void  CS_LDK_InMemorySigner_set_delayed_payment_base_key(int64_t this_ptr, int8_tArray val) {
69145         LDKInMemorySigner this_ptr_conv;
69146         this_ptr_conv.inner = untag_ptr(this_ptr);
69147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69149         this_ptr_conv.is_owned = false;
69150         LDKSecretKey val_ref;
69151         CHECK(val->arr_len == 32);
69152         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69153         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
69154 }
69155
69156 int8_tArray  CS_LDK_InMemorySigner_get_htlc_base_key(int64_t this_ptr) {
69157         LDKInMemorySigner this_ptr_conv;
69158         this_ptr_conv.inner = untag_ptr(this_ptr);
69159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69161         this_ptr_conv.is_owned = false;
69162         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69163         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
69164         return ret_arr;
69165 }
69166
69167 void  CS_LDK_InMemorySigner_set_htlc_base_key(int64_t this_ptr, int8_tArray val) {
69168         LDKInMemorySigner this_ptr_conv;
69169         this_ptr_conv.inner = untag_ptr(this_ptr);
69170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69172         this_ptr_conv.is_owned = false;
69173         LDKSecretKey val_ref;
69174         CHECK(val->arr_len == 32);
69175         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69176         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
69177 }
69178
69179 int8_tArray  CS_LDK_InMemorySigner_get_commitment_seed(int64_t this_ptr) {
69180         LDKInMemorySigner this_ptr_conv;
69181         this_ptr_conv.inner = untag_ptr(this_ptr);
69182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69184         this_ptr_conv.is_owned = false;
69185         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69186         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
69187         return ret_arr;
69188 }
69189
69190 void  CS_LDK_InMemorySigner_set_commitment_seed(int64_t this_ptr, int8_tArray val) {
69191         LDKInMemorySigner this_ptr_conv;
69192         this_ptr_conv.inner = untag_ptr(this_ptr);
69193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69195         this_ptr_conv.is_owned = false;
69196         LDKThirtyTwoBytes val_ref;
69197         CHECK(val->arr_len == 32);
69198         memcpy(val_ref.data, val->elems, 32); FREE(val);
69199         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
69200 }
69201
69202 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
69203         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
69204         int64_t ret_ref = 0;
69205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69207         return ret_ref;
69208 }
69209 int64_t  CS_LDK_InMemorySigner_clone_ptr(int64_t arg) {
69210         LDKInMemorySigner arg_conv;
69211         arg_conv.inner = untag_ptr(arg);
69212         arg_conv.is_owned = ptr_is_owned(arg);
69213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69214         arg_conv.is_owned = false;
69215         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
69216         return ret_conv;
69217 }
69218
69219 int64_t  CS_LDK_InMemorySigner_clone(int64_t orig) {
69220         LDKInMemorySigner orig_conv;
69221         orig_conv.inner = untag_ptr(orig);
69222         orig_conv.is_owned = ptr_is_owned(orig);
69223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69224         orig_conv.is_owned = false;
69225         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
69226         int64_t ret_ref = 0;
69227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69229         return ret_ref;
69230 }
69231
69232 int64_t  CS_LDK_InMemorySigner_new(int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id, int8_tArray rand_bytes_unique_start) {
69233         LDKSecretKey funding_key_ref;
69234         CHECK(funding_key->arr_len == 32);
69235         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
69236         LDKSecretKey revocation_base_key_ref;
69237         CHECK(revocation_base_key->arr_len == 32);
69238         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
69239         LDKSecretKey payment_key_ref;
69240         CHECK(payment_key->arr_len == 32);
69241         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
69242         LDKSecretKey delayed_payment_base_key_ref;
69243         CHECK(delayed_payment_base_key->arr_len == 32);
69244         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
69245         LDKSecretKey htlc_base_key_ref;
69246         CHECK(htlc_base_key->arr_len == 32);
69247         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
69248         LDKThirtyTwoBytes commitment_seed_ref;
69249         CHECK(commitment_seed->arr_len == 32);
69250         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
69251         LDKThirtyTwoBytes channel_keys_id_ref;
69252         CHECK(channel_keys_id->arr_len == 32);
69253         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
69254         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
69255         CHECK(rand_bytes_unique_start->arr_len == 32);
69256         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
69257         LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref, rand_bytes_unique_start_ref);
69258         int64_t ret_ref = 0;
69259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69261         return ret_ref;
69262 }
69263
69264 int64_t  CS_LDK_InMemorySigner_counterparty_pubkeys(int64_t this_arg) {
69265         LDKInMemorySigner this_arg_conv;
69266         this_arg_conv.inner = untag_ptr(this_arg);
69267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69269         this_arg_conv.is_owned = false;
69270         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
69271         int64_t ret_ref = 0;
69272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69274         return ret_ref;
69275 }
69276
69277 int64_t  CS_LDK_InMemorySigner_counterparty_selected_contest_delay(int64_t this_arg) {
69278         LDKInMemorySigner this_arg_conv;
69279         this_arg_conv.inner = untag_ptr(this_arg);
69280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69282         this_arg_conv.is_owned = false;
69283         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
69284         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
69285         int64_t ret_ref = tag_ptr(ret_copy, true);
69286         return ret_ref;
69287 }
69288
69289 int64_t  CS_LDK_InMemorySigner_holder_selected_contest_delay(int64_t this_arg) {
69290         LDKInMemorySigner this_arg_conv;
69291         this_arg_conv.inner = untag_ptr(this_arg);
69292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69294         this_arg_conv.is_owned = false;
69295         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
69296         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
69297         int64_t ret_ref = tag_ptr(ret_copy, true);
69298         return ret_ref;
69299 }
69300
69301 int64_t  CS_LDK_InMemorySigner_is_outbound(int64_t this_arg) {
69302         LDKInMemorySigner this_arg_conv;
69303         this_arg_conv.inner = untag_ptr(this_arg);
69304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69306         this_arg_conv.is_owned = false;
69307         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
69308         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
69309         int64_t ret_ref = tag_ptr(ret_copy, true);
69310         return ret_ref;
69311 }
69312
69313 int64_t  CS_LDK_InMemorySigner_funding_outpoint(int64_t this_arg) {
69314         LDKInMemorySigner this_arg_conv;
69315         this_arg_conv.inner = untag_ptr(this_arg);
69316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69318         this_arg_conv.is_owned = false;
69319         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
69320         int64_t ret_ref = 0;
69321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69323         return ret_ref;
69324 }
69325
69326 int64_t  CS_LDK_InMemorySigner_get_channel_parameters(int64_t this_arg) {
69327         LDKInMemorySigner this_arg_conv;
69328         this_arg_conv.inner = untag_ptr(this_arg);
69329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69331         this_arg_conv.is_owned = false;
69332         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
69333         int64_t ret_ref = 0;
69334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69336         return ret_ref;
69337 }
69338
69339 int64_t  CS_LDK_InMemorySigner_channel_type_features(int64_t this_arg) {
69340         LDKInMemorySigner this_arg_conv;
69341         this_arg_conv.inner = untag_ptr(this_arg);
69342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69344         this_arg_conv.is_owned = false;
69345         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
69346         int64_t ret_ref = 0;
69347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69349         return ret_ref;
69350 }
69351
69352 int64_t  CS_LDK_InMemorySigner_sign_counterparty_payment_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
69353         LDKInMemorySigner this_arg_conv;
69354         this_arg_conv.inner = untag_ptr(this_arg);
69355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69357         this_arg_conv.is_owned = false;
69358         LDKTransaction spend_tx_ref;
69359         spend_tx_ref.datalen = spend_tx->arr_len;
69360         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
69361         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
69362         spend_tx_ref.data_is_owned = true;
69363         LDKStaticPaymentOutputDescriptor descriptor_conv;
69364         descriptor_conv.inner = untag_ptr(descriptor);
69365         descriptor_conv.is_owned = ptr_is_owned(descriptor);
69366         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
69367         descriptor_conv.is_owned = false;
69368         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
69369         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
69370         return tag_ptr(ret_conv, true);
69371 }
69372
69373 int64_t  CS_LDK_InMemorySigner_sign_dynamic_p2wsh_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
69374         LDKInMemorySigner this_arg_conv;
69375         this_arg_conv.inner = untag_ptr(this_arg);
69376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69378         this_arg_conv.is_owned = false;
69379         LDKTransaction spend_tx_ref;
69380         spend_tx_ref.datalen = spend_tx->arr_len;
69381         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
69382         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
69383         spend_tx_ref.data_is_owned = true;
69384         LDKDelayedPaymentOutputDescriptor descriptor_conv;
69385         descriptor_conv.inner = untag_ptr(descriptor);
69386         descriptor_conv.is_owned = ptr_is_owned(descriptor);
69387         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
69388         descriptor_conv.is_owned = false;
69389         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
69390         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
69391         return tag_ptr(ret_conv, true);
69392 }
69393
69394 int64_t  CS_LDK_InMemorySigner_as_EntropySource(int64_t this_arg) {
69395         LDKInMemorySigner this_arg_conv;
69396         this_arg_conv.inner = untag_ptr(this_arg);
69397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69399         this_arg_conv.is_owned = false;
69400         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69401         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
69402         return tag_ptr(ret_ret, true);
69403 }
69404
69405 int64_t  CS_LDK_InMemorySigner_as_ChannelSigner(int64_t this_arg) {
69406         LDKInMemorySigner this_arg_conv;
69407         this_arg_conv.inner = untag_ptr(this_arg);
69408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69410         this_arg_conv.is_owned = false;
69411         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
69412         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
69413         return tag_ptr(ret_ret, true);
69414 }
69415
69416 int64_t  CS_LDK_InMemorySigner_as_EcdsaChannelSigner(int64_t this_arg) {
69417         LDKInMemorySigner this_arg_conv;
69418         this_arg_conv.inner = untag_ptr(this_arg);
69419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69421         this_arg_conv.is_owned = false;
69422         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
69423         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
69424         return tag_ptr(ret_ret, true);
69425 }
69426
69427 int64_t  CS_LDK_InMemorySigner_as_WriteableEcdsaChannelSigner(int64_t this_arg) {
69428         LDKInMemorySigner this_arg_conv;
69429         this_arg_conv.inner = untag_ptr(this_arg);
69430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69432         this_arg_conv.is_owned = false;
69433         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69434         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
69435         return tag_ptr(ret_ret, true);
69436 }
69437
69438 int8_tArray  CS_LDK_InMemorySigner_write(int64_t obj) {
69439         LDKInMemorySigner obj_conv;
69440         obj_conv.inner = untag_ptr(obj);
69441         obj_conv.is_owned = ptr_is_owned(obj);
69442         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69443         obj_conv.is_owned = false;
69444         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
69445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69447         CVec_u8Z_free(ret_var);
69448         return ret_arr;
69449 }
69450
69451 int64_t  CS_LDK_InMemorySigner_read(int8_tArray ser, int64_t arg) {
69452         LDKu8slice ser_ref;
69453         ser_ref.datalen = ser->arr_len;
69454         ser_ref.data = ser->elems;
69455         void* arg_ptr = untag_ptr(arg);
69456         CHECK_ACCESS(arg_ptr);
69457         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
69458         if (arg_conv.free == LDKEntropySource_JCalls_free) {
69459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69460                 LDKEntropySource_JCalls_cloned(&arg_conv);
69461         }
69462         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
69463         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
69464         FREE(ser);
69465         return tag_ptr(ret_conv, true);
69466 }
69467
69468 void  CS_LDK_KeysManager_free(int64_t this_obj) {
69469         LDKKeysManager this_obj_conv;
69470         this_obj_conv.inner = untag_ptr(this_obj);
69471         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69473         KeysManager_free(this_obj_conv);
69474 }
69475
69476 int64_t  CS_LDK_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
69477         uint8_t seed_arr[32];
69478         CHECK(seed->arr_len == 32);
69479         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69480         uint8_t (*seed_ref)[32] = &seed_arr;
69481         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
69482         int64_t ret_ref = 0;
69483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69485         return ret_ref;
69486 }
69487
69488 int8_tArray  CS_LDK_KeysManager_get_node_secret_key(int64_t this_arg) {
69489         LDKKeysManager this_arg_conv;
69490         this_arg_conv.inner = untag_ptr(this_arg);
69491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69493         this_arg_conv.is_owned = false;
69494         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69495         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69496         return ret_arr;
69497 }
69498
69499 int64_t  CS_LDK_KeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
69500         LDKKeysManager this_arg_conv;
69501         this_arg_conv.inner = untag_ptr(this_arg);
69502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69504         this_arg_conv.is_owned = false;
69505         uint8_t params_arr[32];
69506         CHECK(params->arr_len == 32);
69507         memcpy(params_arr, params->elems, 32); FREE(params);
69508         uint8_t (*params_ref)[32] = &params_arr;
69509         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69510         int64_t ret_ref = 0;
69511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69513         return ret_ref;
69514 }
69515
69516 int64_t  CS_LDK_KeysManager_sign_spendable_outputs_psbt(int64_t this_arg, int64_tArray descriptors, int8_tArray psbt) {
69517         LDKKeysManager this_arg_conv;
69518         this_arg_conv.inner = untag_ptr(this_arg);
69519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69521         this_arg_conv.is_owned = false;
69522         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69523         descriptors_constr.datalen = descriptors->arr_len;
69524         if (descriptors_constr.datalen > 0)
69525                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69526         else
69527                 descriptors_constr.data = NULL;
69528         int64_t* descriptors_vals = descriptors->elems;
69529         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69530                 int64_t descriptors_conv_27 = descriptors_vals[b];
69531                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69532                 CHECK_ACCESS(descriptors_conv_27_ptr);
69533                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69534                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69535                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69536         }
69537         FREE(descriptors);
69538         LDKCVec_u8Z psbt_ref;
69539         psbt_ref.datalen = psbt->arr_len;
69540         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
69541         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
69542         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
69543         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
69544         return tag_ptr(ret_conv, true);
69545 }
69546
69547 int64_t  CS_LDK_KeysManager_spend_spendable_outputs(int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
69548         LDKKeysManager this_arg_conv;
69549         this_arg_conv.inner = untag_ptr(this_arg);
69550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69552         this_arg_conv.is_owned = false;
69553         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69554         descriptors_constr.datalen = descriptors->arr_len;
69555         if (descriptors_constr.datalen > 0)
69556                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69557         else
69558                 descriptors_constr.data = NULL;
69559         int64_t* descriptors_vals = descriptors->elems;
69560         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69561                 int64_t descriptors_conv_27 = descriptors_vals[b];
69562                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69563                 CHECK_ACCESS(descriptors_conv_27_ptr);
69564                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69565                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69566                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69567         }
69568         FREE(descriptors);
69569         LDKCVec_TxOutZ outputs_constr;
69570         outputs_constr.datalen = outputs->arr_len;
69571         if (outputs_constr.datalen > 0)
69572                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69573         else
69574                 outputs_constr.data = NULL;
69575         int64_t* outputs_vals = outputs->elems;
69576         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69577                 int64_t outputs_conv_7 = outputs_vals[h];
69578                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69579                 CHECK_ACCESS(outputs_conv_7_ptr);
69580                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69581                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69582                 outputs_constr.data[h] = outputs_conv_7_conv;
69583         }
69584         FREE(outputs);
69585         LDKCVec_u8Z change_destination_script_ref;
69586         change_destination_script_ref.datalen = change_destination_script->arr_len;
69587         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69588         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69589         void* locktime_ptr = untag_ptr(locktime);
69590         CHECK_ACCESS(locktime_ptr);
69591         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69592         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69593         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69594         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69595         return tag_ptr(ret_conv, true);
69596 }
69597
69598 int64_t  CS_LDK_KeysManager_as_EntropySource(int64_t this_arg) {
69599         LDKKeysManager this_arg_conv;
69600         this_arg_conv.inner = untag_ptr(this_arg);
69601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69603         this_arg_conv.is_owned = false;
69604         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69605         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
69606         return tag_ptr(ret_ret, true);
69607 }
69608
69609 int64_t  CS_LDK_KeysManager_as_NodeSigner(int64_t this_arg) {
69610         LDKKeysManager this_arg_conv;
69611         this_arg_conv.inner = untag_ptr(this_arg);
69612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69614         this_arg_conv.is_owned = false;
69615         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69616         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
69617         return tag_ptr(ret_ret, true);
69618 }
69619
69620 int64_t  CS_LDK_KeysManager_as_SignerProvider(int64_t this_arg) {
69621         LDKKeysManager this_arg_conv;
69622         this_arg_conv.inner = untag_ptr(this_arg);
69623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69625         this_arg_conv.is_owned = false;
69626         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69627         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
69628         return tag_ptr(ret_ret, true);
69629 }
69630
69631 void  CS_LDK_PhantomKeysManager_free(int64_t this_obj) {
69632         LDKPhantomKeysManager this_obj_conv;
69633         this_obj_conv.inner = untag_ptr(this_obj);
69634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69636         PhantomKeysManager_free(this_obj_conv);
69637 }
69638
69639 int64_t  CS_LDK_PhantomKeysManager_as_EntropySource(int64_t this_arg) {
69640         LDKPhantomKeysManager this_arg_conv;
69641         this_arg_conv.inner = untag_ptr(this_arg);
69642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69644         this_arg_conv.is_owned = false;
69645         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69646         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
69647         return tag_ptr(ret_ret, true);
69648 }
69649
69650 int64_t  CS_LDK_PhantomKeysManager_as_NodeSigner(int64_t this_arg) {
69651         LDKPhantomKeysManager this_arg_conv;
69652         this_arg_conv.inner = untag_ptr(this_arg);
69653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69655         this_arg_conv.is_owned = false;
69656         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69657         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
69658         return tag_ptr(ret_ret, true);
69659 }
69660
69661 int64_t  CS_LDK_PhantomKeysManager_as_SignerProvider(int64_t this_arg) {
69662         LDKPhantomKeysManager this_arg_conv;
69663         this_arg_conv.inner = untag_ptr(this_arg);
69664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69666         this_arg_conv.is_owned = false;
69667         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69668         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
69669         return tag_ptr(ret_ret, true);
69670 }
69671
69672 int64_t  CS_LDK_PhantomKeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
69673         uint8_t seed_arr[32];
69674         CHECK(seed->arr_len == 32);
69675         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69676         uint8_t (*seed_ref)[32] = &seed_arr;
69677         uint8_t cross_node_seed_arr[32];
69678         CHECK(cross_node_seed->arr_len == 32);
69679         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
69680         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
69681         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
69682         int64_t ret_ref = 0;
69683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69685         return ret_ref;
69686 }
69687
69688 int64_t  CS_LDK_PhantomKeysManager_spend_spendable_outputs(int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
69689         LDKPhantomKeysManager this_arg_conv;
69690         this_arg_conv.inner = untag_ptr(this_arg);
69691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69693         this_arg_conv.is_owned = false;
69694         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69695         descriptors_constr.datalen = descriptors->arr_len;
69696         if (descriptors_constr.datalen > 0)
69697                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69698         else
69699                 descriptors_constr.data = NULL;
69700         int64_t* descriptors_vals = descriptors->elems;
69701         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69702                 int64_t descriptors_conv_27 = descriptors_vals[b];
69703                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69704                 CHECK_ACCESS(descriptors_conv_27_ptr);
69705                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69706                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69707                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69708         }
69709         FREE(descriptors);
69710         LDKCVec_TxOutZ outputs_constr;
69711         outputs_constr.datalen = outputs->arr_len;
69712         if (outputs_constr.datalen > 0)
69713                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69714         else
69715                 outputs_constr.data = NULL;
69716         int64_t* outputs_vals = outputs->elems;
69717         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69718                 int64_t outputs_conv_7 = outputs_vals[h];
69719                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69720                 CHECK_ACCESS(outputs_conv_7_ptr);
69721                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69722                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69723                 outputs_constr.data[h] = outputs_conv_7_conv;
69724         }
69725         FREE(outputs);
69726         LDKCVec_u8Z change_destination_script_ref;
69727         change_destination_script_ref.datalen = change_destination_script->arr_len;
69728         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69729         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69730         void* locktime_ptr = untag_ptr(locktime);
69731         CHECK_ACCESS(locktime_ptr);
69732         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69733         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69734         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69735         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69736         return tag_ptr(ret_conv, true);
69737 }
69738
69739 int64_t  CS_LDK_PhantomKeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
69740         LDKPhantomKeysManager this_arg_conv;
69741         this_arg_conv.inner = untag_ptr(this_arg);
69742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69744         this_arg_conv.is_owned = false;
69745         uint8_t params_arr[32];
69746         CHECK(params->arr_len == 32);
69747         memcpy(params_arr, params->elems, 32); FREE(params);
69748         uint8_t (*params_ref)[32] = &params_arr;
69749         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69750         int64_t ret_ref = 0;
69751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69753         return ret_ref;
69754 }
69755
69756 int8_tArray  CS_LDK_PhantomKeysManager_get_node_secret_key(int64_t this_arg) {
69757         LDKPhantomKeysManager this_arg_conv;
69758         this_arg_conv.inner = untag_ptr(this_arg);
69759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69761         this_arg_conv.is_owned = false;
69762         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69763         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69764         return ret_arr;
69765 }
69766
69767 int8_tArray  CS_LDK_PhantomKeysManager_get_phantom_node_secret_key(int64_t this_arg) {
69768         LDKPhantomKeysManager this_arg_conv;
69769         this_arg_conv.inner = untag_ptr(this_arg);
69770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69772         this_arg_conv.is_owned = false;
69773         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69774         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
69775         return ret_arr;
69776 }
69777
69778 void  CS_LDK_EcdsaChannelSigner_free(int64_t this_ptr) {
69779         if (!ptr_is_owned(this_ptr)) return;
69780         void* this_ptr_ptr = untag_ptr(this_ptr);
69781         CHECK_ACCESS(this_ptr_ptr);
69782         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
69783         FREE(untag_ptr(this_ptr));
69784         EcdsaChannelSigner_free(this_ptr_conv);
69785 }
69786
69787 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
69788         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69789         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
69790         return tag_ptr(ret_ret, true);
69791 }
69792 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone_ptr(int64_t arg) {
69793         void* arg_ptr = untag_ptr(arg);
69794         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69795         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
69796         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
69797         return ret_conv;
69798 }
69799
69800 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone(int64_t orig) {
69801         void* orig_ptr = untag_ptr(orig);
69802         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69803         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
69804         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69805         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
69806         return tag_ptr(ret_ret, true);
69807 }
69808
69809 void  CS_LDK_WriteableEcdsaChannelSigner_free(int64_t this_ptr) {
69810         if (!ptr_is_owned(this_ptr)) return;
69811         void* this_ptr_ptr = untag_ptr(this_ptr);
69812         CHECK_ACCESS(this_ptr_ptr);
69813         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
69814         FREE(untag_ptr(this_ptr));
69815         WriteableEcdsaChannelSigner_free(this_ptr_conv);
69816 }
69817
69818 void  CS_LDK_OnionMessenger_free(int64_t this_obj) {
69819         LDKOnionMessenger this_obj_conv;
69820         this_obj_conv.inner = untag_ptr(this_obj);
69821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69823         OnionMessenger_free(this_obj_conv);
69824 }
69825
69826 void  CS_LDK_MessageRouter_free(int64_t this_ptr) {
69827         if (!ptr_is_owned(this_ptr)) return;
69828         void* this_ptr_ptr = untag_ptr(this_ptr);
69829         CHECK_ACCESS(this_ptr_ptr);
69830         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
69831         FREE(untag_ptr(this_ptr));
69832         MessageRouter_free(this_ptr_conv);
69833 }
69834
69835 void  CS_LDK_DefaultMessageRouter_free(int64_t this_obj) {
69836         LDKDefaultMessageRouter this_obj_conv;
69837         this_obj_conv.inner = untag_ptr(this_obj);
69838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69840         DefaultMessageRouter_free(this_obj_conv);
69841 }
69842
69843 int64_t  CS_LDK_DefaultMessageRouter_new(int64_t network_graph, int64_t entropy_source) {
69844         LDKNetworkGraph network_graph_conv;
69845         network_graph_conv.inner = untag_ptr(network_graph);
69846         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69847         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69848         network_graph_conv.is_owned = false;
69849         void* entropy_source_ptr = untag_ptr(entropy_source);
69850         CHECK_ACCESS(entropy_source_ptr);
69851         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69852         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69853                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69854                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69855         }
69856         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
69857         int64_t ret_ref = 0;
69858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69860         return ret_ref;
69861 }
69862
69863 int64_t  CS_LDK_DefaultMessageRouter_as_MessageRouter(int64_t this_arg) {
69864         LDKDefaultMessageRouter this_arg_conv;
69865         this_arg_conv.inner = untag_ptr(this_arg);
69866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69868         this_arg_conv.is_owned = false;
69869         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69870         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
69871         return tag_ptr(ret_ret, true);
69872 }
69873
69874 void  CS_LDK_OnionMessagePath_free(int64_t this_obj) {
69875         LDKOnionMessagePath this_obj_conv;
69876         this_obj_conv.inner = untag_ptr(this_obj);
69877         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69879         OnionMessagePath_free(this_obj_conv);
69880 }
69881
69882 ptrArray  CS_LDK_OnionMessagePath_get_intermediate_nodes(int64_t this_ptr) {
69883         LDKOnionMessagePath this_ptr_conv;
69884         this_ptr_conv.inner = untag_ptr(this_ptr);
69885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69887         this_ptr_conv.is_owned = false;
69888         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
69889         ptrArray ret_arr = NULL;
69890         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69891         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
69892         for (size_t i = 0; i < ret_var.datalen; i++) {
69893                 int8_tArray ret_conv_8_arr = init_int8_tArray(33, __LINE__);
69894                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compressed_form, 33);
69895                 ret_arr_ptr[i] = ret_conv_8_arr;
69896         }
69897         
69898         FREE(ret_var.data);
69899         return ret_arr;
69900 }
69901
69902 void  CS_LDK_OnionMessagePath_set_intermediate_nodes(int64_t this_ptr, ptrArray val) {
69903         LDKOnionMessagePath this_ptr_conv;
69904         this_ptr_conv.inner = untag_ptr(this_ptr);
69905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69907         this_ptr_conv.is_owned = false;
69908         LDKCVec_PublicKeyZ val_constr;
69909         val_constr.datalen = val->arr_len;
69910         if (val_constr.datalen > 0)
69911                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69912         else
69913                 val_constr.data = NULL;
69914         int8_tArray* val_vals = (void*) val->elems;
69915         for (size_t i = 0; i < val_constr.datalen; i++) {
69916                 int8_tArray val_conv_8 = val_vals[i];
69917                 LDKPublicKey val_conv_8_ref;
69918                 CHECK(val_conv_8->arr_len == 33);
69919                 memcpy(val_conv_8_ref.compressed_form, val_conv_8->elems, 33); FREE(val_conv_8);
69920                 val_constr.data[i] = val_conv_8_ref;
69921         }
69922         FREE(val);
69923         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
69924 }
69925
69926 int64_t  CS_LDK_OnionMessagePath_get_destination(int64_t this_ptr) {
69927         LDKOnionMessagePath this_ptr_conv;
69928         this_ptr_conv.inner = untag_ptr(this_ptr);
69929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69931         this_ptr_conv.is_owned = false;
69932         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69933         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
69934         int64_t ret_ref = tag_ptr(ret_copy, true);
69935         return ret_ref;
69936 }
69937
69938 void  CS_LDK_OnionMessagePath_set_destination(int64_t this_ptr, int64_t val) {
69939         LDKOnionMessagePath this_ptr_conv;
69940         this_ptr_conv.inner = untag_ptr(this_ptr);
69941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69943         this_ptr_conv.is_owned = false;
69944         void* val_ptr = untag_ptr(val);
69945         CHECK_ACCESS(val_ptr);
69946         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
69947         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
69948         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
69949 }
69950
69951 int64_t  CS_LDK_OnionMessagePath_get_first_node_addresses(int64_t this_ptr) {
69952         LDKOnionMessagePath this_ptr_conv;
69953         this_ptr_conv.inner = untag_ptr(this_ptr);
69954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69956         this_ptr_conv.is_owned = false;
69957         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69958         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
69959         int64_t ret_ref = tag_ptr(ret_copy, true);
69960         return ret_ref;
69961 }
69962
69963 void  CS_LDK_OnionMessagePath_set_first_node_addresses(int64_t this_ptr, int64_t val) {
69964         LDKOnionMessagePath this_ptr_conv;
69965         this_ptr_conv.inner = untag_ptr(this_ptr);
69966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69968         this_ptr_conv.is_owned = false;
69969         void* val_ptr = untag_ptr(val);
69970         CHECK_ACCESS(val_ptr);
69971         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
69972         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
69973         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
69974 }
69975
69976 int64_t  CS_LDK_OnionMessagePath_new(ptrArray intermediate_nodes_arg, int64_t destination_arg, int64_t first_node_addresses_arg) {
69977         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
69978         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
69979         if (intermediate_nodes_arg_constr.datalen > 0)
69980                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69981         else
69982                 intermediate_nodes_arg_constr.data = NULL;
69983         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
69984         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
69985                 int8_tArray intermediate_nodes_arg_conv_8 = intermediate_nodes_arg_vals[i];
69986                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
69987                 CHECK(intermediate_nodes_arg_conv_8->arr_len == 33);
69988                 memcpy(intermediate_nodes_arg_conv_8_ref.compressed_form, intermediate_nodes_arg_conv_8->elems, 33); FREE(intermediate_nodes_arg_conv_8);
69989                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
69990         }
69991         FREE(intermediate_nodes_arg);
69992         void* destination_arg_ptr = untag_ptr(destination_arg);
69993         CHECK_ACCESS(destination_arg_ptr);
69994         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
69995         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
69996         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
69997         CHECK_ACCESS(first_node_addresses_arg_ptr);
69998         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
69999         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
70000         int64_t ret_ref = 0;
70001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70003         return ret_ref;
70004 }
70005
70006 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
70007         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
70008         int64_t ret_ref = 0;
70009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70011         return ret_ref;
70012 }
70013 int64_t  CS_LDK_OnionMessagePath_clone_ptr(int64_t arg) {
70014         LDKOnionMessagePath arg_conv;
70015         arg_conv.inner = untag_ptr(arg);
70016         arg_conv.is_owned = ptr_is_owned(arg);
70017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70018         arg_conv.is_owned = false;
70019         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
70020         return ret_conv;
70021 }
70022
70023 int64_t  CS_LDK_OnionMessagePath_clone(int64_t orig) {
70024         LDKOnionMessagePath orig_conv;
70025         orig_conv.inner = untag_ptr(orig);
70026         orig_conv.is_owned = ptr_is_owned(orig);
70027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70028         orig_conv.is_owned = false;
70029         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
70030         int64_t ret_ref = 0;
70031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70033         return ret_ref;
70034 }
70035
70036 int8_tArray  CS_LDK_OnionMessagePath_first_node(int64_t this_arg) {
70037         LDKOnionMessagePath this_arg_conv;
70038         this_arg_conv.inner = untag_ptr(this_arg);
70039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70041         this_arg_conv.is_owned = false;
70042         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70043         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
70044         return ret_arr;
70045 }
70046
70047 void  CS_LDK_Destination_free(int64_t this_ptr) {
70048         if (!ptr_is_owned(this_ptr)) return;
70049         void* this_ptr_ptr = untag_ptr(this_ptr);
70050         CHECK_ACCESS(this_ptr_ptr);
70051         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
70052         FREE(untag_ptr(this_ptr));
70053         Destination_free(this_ptr_conv);
70054 }
70055
70056 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
70057         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70058         *ret_copy = Destination_clone(arg);
70059         int64_t ret_ref = tag_ptr(ret_copy, true);
70060         return ret_ref;
70061 }
70062 int64_t  CS_LDK_Destination_clone_ptr(int64_t arg) {
70063         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
70064         int64_t ret_conv = Destination_clone_ptr(arg_conv);
70065         return ret_conv;
70066 }
70067
70068 int64_t  CS_LDK_Destination_clone(int64_t orig) {
70069         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
70070         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70071         *ret_copy = Destination_clone(orig_conv);
70072         int64_t ret_ref = tag_ptr(ret_copy, true);
70073         return ret_ref;
70074 }
70075
70076 int64_t  CS_LDK_Destination_node(int8_tArray a) {
70077         LDKPublicKey a_ref;
70078         CHECK(a->arr_len == 33);
70079         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70080         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70081         *ret_copy = Destination_node(a_ref);
70082         int64_t ret_ref = tag_ptr(ret_copy, true);
70083         return ret_ref;
70084 }
70085
70086 int64_t  CS_LDK_Destination_blinded_path(int64_t a) {
70087         LDKBlindedPath a_conv;
70088         a_conv.inner = untag_ptr(a);
70089         a_conv.is_owned = ptr_is_owned(a);
70090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70091         a_conv = BlindedPath_clone(&a_conv);
70092         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70093         *ret_copy = Destination_blinded_path(a_conv);
70094         int64_t ret_ref = tag_ptr(ret_copy, true);
70095         return ret_ref;
70096 }
70097
70098 void  CS_LDK_SendSuccess_free(int64_t this_ptr) {
70099         if (!ptr_is_owned(this_ptr)) return;
70100         void* this_ptr_ptr = untag_ptr(this_ptr);
70101         CHECK_ACCESS(this_ptr_ptr);
70102         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
70103         FREE(untag_ptr(this_ptr));
70104         SendSuccess_free(this_ptr_conv);
70105 }
70106
70107 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
70108         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70109         *ret_copy = SendSuccess_clone(arg);
70110         int64_t ret_ref = tag_ptr(ret_copy, true);
70111         return ret_ref;
70112 }
70113 int64_t  CS_LDK_SendSuccess_clone_ptr(int64_t arg) {
70114         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
70115         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
70116         return ret_conv;
70117 }
70118
70119 int64_t  CS_LDK_SendSuccess_clone(int64_t orig) {
70120         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
70121         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70122         *ret_copy = SendSuccess_clone(orig_conv);
70123         int64_t ret_ref = tag_ptr(ret_copy, true);
70124         return ret_ref;
70125 }
70126
70127 int64_t  CS_LDK_SendSuccess_buffered() {
70128         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70129         *ret_copy = SendSuccess_buffered();
70130         int64_t ret_ref = tag_ptr(ret_copy, true);
70131         return ret_ref;
70132 }
70133
70134 int64_t  CS_LDK_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
70135         LDKPublicKey a_ref;
70136         CHECK(a->arr_len == 33);
70137         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70138         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70139         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
70140         int64_t ret_ref = tag_ptr(ret_copy, true);
70141         return ret_ref;
70142 }
70143
70144 jboolean  CS_LDK_SendSuccess_eq(int64_t a, int64_t b) {
70145         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
70146         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
70147         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
70148         return ret_conv;
70149 }
70150
70151 void  CS_LDK_SendError_free(int64_t this_ptr) {
70152         if (!ptr_is_owned(this_ptr)) return;
70153         void* this_ptr_ptr = untag_ptr(this_ptr);
70154         CHECK_ACCESS(this_ptr_ptr);
70155         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
70156         FREE(untag_ptr(this_ptr));
70157         SendError_free(this_ptr_conv);
70158 }
70159
70160 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
70161         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70162         *ret_copy = SendError_clone(arg);
70163         int64_t ret_ref = tag_ptr(ret_copy, true);
70164         return ret_ref;
70165 }
70166 int64_t  CS_LDK_SendError_clone_ptr(int64_t arg) {
70167         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
70168         int64_t ret_conv = SendError_clone_ptr(arg_conv);
70169         return ret_conv;
70170 }
70171
70172 int64_t  CS_LDK_SendError_clone(int64_t orig) {
70173         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
70174         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70175         *ret_copy = SendError_clone(orig_conv);
70176         int64_t ret_ref = tag_ptr(ret_copy, true);
70177         return ret_ref;
70178 }
70179
70180 int64_t  CS_LDK_SendError_secp256k1(int32_t a) {
70181         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
70182         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70183         *ret_copy = SendError_secp256k1(a_conv);
70184         int64_t ret_ref = tag_ptr(ret_copy, true);
70185         return ret_ref;
70186 }
70187
70188 int64_t  CS_LDK_SendError_too_big_packet() {
70189         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70190         *ret_copy = SendError_too_big_packet();
70191         int64_t ret_ref = tag_ptr(ret_copy, true);
70192         return ret_ref;
70193 }
70194
70195 int64_t  CS_LDK_SendError_too_few_blinded_hops() {
70196         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70197         *ret_copy = SendError_too_few_blinded_hops();
70198         int64_t ret_ref = tag_ptr(ret_copy, true);
70199         return ret_ref;
70200 }
70201
70202 int64_t  CS_LDK_SendError_invalid_first_hop(int8_tArray a) {
70203         LDKPublicKey a_ref;
70204         CHECK(a->arr_len == 33);
70205         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70206         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70207         *ret_copy = SendError_invalid_first_hop(a_ref);
70208         int64_t ret_ref = tag_ptr(ret_copy, true);
70209         return ret_ref;
70210 }
70211
70212 int64_t  CS_LDK_SendError_path_not_found() {
70213         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70214         *ret_copy = SendError_path_not_found();
70215         int64_t ret_ref = tag_ptr(ret_copy, true);
70216         return ret_ref;
70217 }
70218
70219 int64_t  CS_LDK_SendError_invalid_message() {
70220         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70221         *ret_copy = SendError_invalid_message();
70222         int64_t ret_ref = tag_ptr(ret_copy, true);
70223         return ret_ref;
70224 }
70225
70226 int64_t  CS_LDK_SendError_buffer_full() {
70227         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70228         *ret_copy = SendError_buffer_full();
70229         int64_t ret_ref = tag_ptr(ret_copy, true);
70230         return ret_ref;
70231 }
70232
70233 int64_t  CS_LDK_SendError_get_node_id_failed() {
70234         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70235         *ret_copy = SendError_get_node_id_failed();
70236         int64_t ret_ref = tag_ptr(ret_copy, true);
70237         return ret_ref;
70238 }
70239
70240 int64_t  CS_LDK_SendError_blinded_path_advance_failed() {
70241         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70242         *ret_copy = SendError_blinded_path_advance_failed();
70243         int64_t ret_ref = tag_ptr(ret_copy, true);
70244         return ret_ref;
70245 }
70246
70247 jboolean  CS_LDK_SendError_eq(int64_t a, int64_t b) {
70248         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
70249         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
70250         jboolean ret_conv = SendError_eq(a_conv, b_conv);
70251         return ret_conv;
70252 }
70253
70254 void  CS_LDK_CustomOnionMessageHandler_free(int64_t this_ptr) {
70255         if (!ptr_is_owned(this_ptr)) return;
70256         void* this_ptr_ptr = untag_ptr(this_ptr);
70257         CHECK_ACCESS(this_ptr_ptr);
70258         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
70259         FREE(untag_ptr(this_ptr));
70260         CustomOnionMessageHandler_free(this_ptr_conv);
70261 }
70262
70263 void  CS_LDK_PeeledOnion_free(int64_t this_ptr) {
70264         if (!ptr_is_owned(this_ptr)) return;
70265         void* this_ptr_ptr = untag_ptr(this_ptr);
70266         CHECK_ACCESS(this_ptr_ptr);
70267         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
70268         FREE(untag_ptr(this_ptr));
70269         PeeledOnion_free(this_ptr_conv);
70270 }
70271
70272 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
70273         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70274         *ret_copy = PeeledOnion_clone(arg);
70275         int64_t ret_ref = tag_ptr(ret_copy, true);
70276         return ret_ref;
70277 }
70278 int64_t  CS_LDK_PeeledOnion_clone_ptr(int64_t arg) {
70279         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
70280         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
70281         return ret_conv;
70282 }
70283
70284 int64_t  CS_LDK_PeeledOnion_clone(int64_t orig) {
70285         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
70286         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70287         *ret_copy = PeeledOnion_clone(orig_conv);
70288         int64_t ret_ref = tag_ptr(ret_copy, true);
70289         return ret_ref;
70290 }
70291
70292 int64_t  CS_LDK_PeeledOnion_forward(int8_tArray a, int64_t b) {
70293         LDKPublicKey a_ref;
70294         CHECK(a->arr_len == 33);
70295         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70296         LDKOnionMessage b_conv;
70297         b_conv.inner = untag_ptr(b);
70298         b_conv.is_owned = ptr_is_owned(b);
70299         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70300         b_conv = OnionMessage_clone(&b_conv);
70301         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70302         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
70303         int64_t ret_ref = tag_ptr(ret_copy, true);
70304         return ret_ref;
70305 }
70306
70307 int64_t  CS_LDK_PeeledOnion_receive(int64_t a, int8_tArray b, int64_t c) {
70308         void* a_ptr = untag_ptr(a);
70309         CHECK_ACCESS(a_ptr);
70310         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
70311         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
70312         LDKThirtyTwoBytes b_ref;
70313         CHECK(b->arr_len == 32);
70314         memcpy(b_ref.data, b->elems, 32); FREE(b);
70315         LDKBlindedPath c_conv;
70316         c_conv.inner = untag_ptr(c);
70317         c_conv.is_owned = ptr_is_owned(c);
70318         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
70319         c_conv = BlindedPath_clone(&c_conv);
70320         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70321         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
70322         int64_t ret_ref = tag_ptr(ret_copy, true);
70323         return ret_ref;
70324 }
70325
70326 int64_t  CS_LDK_create_onion_message(int64_t entropy_source, int64_t node_signer, int64_t path, int64_t contents, int64_t reply_path) {
70327         void* entropy_source_ptr = untag_ptr(entropy_source);
70328         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70329         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70330         void* node_signer_ptr = untag_ptr(node_signer);
70331         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
70332         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
70333         LDKOnionMessagePath path_conv;
70334         path_conv.inner = untag_ptr(path);
70335         path_conv.is_owned = ptr_is_owned(path);
70336         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70337         path_conv = OnionMessagePath_clone(&path_conv);
70338         void* contents_ptr = untag_ptr(contents);
70339         CHECK_ACCESS(contents_ptr);
70340         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
70341         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
70342                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70343                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
70344         }
70345         LDKBlindedPath reply_path_conv;
70346         reply_path_conv.inner = untag_ptr(reply_path);
70347         reply_path_conv.is_owned = ptr_is_owned(reply_path);
70348         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
70349         reply_path_conv = BlindedPath_clone(&reply_path_conv);
70350         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
70351         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
70352         return tag_ptr(ret_conv, true);
70353 }
70354
70355 int64_t  CS_LDK_peel_onion_message(int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) {
70356         LDKOnionMessage msg_conv;
70357         msg_conv.inner = untag_ptr(msg);
70358         msg_conv.is_owned = ptr_is_owned(msg);
70359         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70360         msg_conv.is_owned = false;
70361         void* node_signer_ptr = untag_ptr(node_signer);
70362         CHECK_ACCESS(node_signer_ptr);
70363         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70364         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70365                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70366                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70367         }
70368         void* logger_ptr = untag_ptr(logger);
70369         CHECK_ACCESS(logger_ptr);
70370         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70371         if (logger_conv.free == LDKLogger_JCalls_free) {
70372                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70373                 LDKLogger_JCalls_cloned(&logger_conv);
70374         }
70375         void* custom_handler_ptr = untag_ptr(custom_handler);
70376         CHECK_ACCESS(custom_handler_ptr);
70377         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
70378         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
70379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70380                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
70381         }
70382         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
70383         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
70384         return tag_ptr(ret_conv, true);
70385 }
70386
70387 int64_t  CS_LDK_OnionMessenger_new(int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
70388         void* entropy_source_ptr = untag_ptr(entropy_source);
70389         CHECK_ACCESS(entropy_source_ptr);
70390         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70391         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
70392                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70393                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
70394         }
70395         void* node_signer_ptr = untag_ptr(node_signer);
70396         CHECK_ACCESS(node_signer_ptr);
70397         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70398         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70399                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70400                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70401         }
70402         void* logger_ptr = untag_ptr(logger);
70403         CHECK_ACCESS(logger_ptr);
70404         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70405         if (logger_conv.free == LDKLogger_JCalls_free) {
70406                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70407                 LDKLogger_JCalls_cloned(&logger_conv);
70408         }
70409         void* message_router_ptr = untag_ptr(message_router);
70410         CHECK_ACCESS(message_router_ptr);
70411         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
70412         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
70413                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70414                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
70415         }
70416         void* offers_handler_ptr = untag_ptr(offers_handler);
70417         CHECK_ACCESS(offers_handler_ptr);
70418         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
70419         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
70420                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70421                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
70422         }
70423         void* custom_handler_ptr = untag_ptr(custom_handler);
70424         CHECK_ACCESS(custom_handler_ptr);
70425         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
70426         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
70427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70428                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
70429         }
70430         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
70431         int64_t ret_ref = 0;
70432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70434         return ret_ref;
70435 }
70436
70437 int64_t  CS_LDK_OnionMessenger_send_onion_message(int64_t this_arg, int64_t contents, int64_t destination, int64_t reply_path) {
70438         LDKOnionMessenger this_arg_conv;
70439         this_arg_conv.inner = untag_ptr(this_arg);
70440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70442         this_arg_conv.is_owned = false;
70443         void* contents_ptr = untag_ptr(contents);
70444         CHECK_ACCESS(contents_ptr);
70445         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
70446         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
70447                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70448                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
70449         }
70450         void* destination_ptr = untag_ptr(destination);
70451         CHECK_ACCESS(destination_ptr);
70452         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
70453         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
70454         LDKBlindedPath reply_path_conv;
70455         reply_path_conv.inner = untag_ptr(reply_path);
70456         reply_path_conv.is_owned = ptr_is_owned(reply_path);
70457         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
70458         reply_path_conv = BlindedPath_clone(&reply_path_conv);
70459         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
70460         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
70461         return tag_ptr(ret_conv, true);
70462 }
70463
70464 int64_t  CS_LDK_OnionMessenger_as_OnionMessageHandler(int64_t this_arg) {
70465         LDKOnionMessenger this_arg_conv;
70466         this_arg_conv.inner = untag_ptr(this_arg);
70467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70469         this_arg_conv.is_owned = false;
70470         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
70471         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
70472         return tag_ptr(ret_ret, true);
70473 }
70474
70475 void  CS_LDK_OffersMessageHandler_free(int64_t this_ptr) {
70476         if (!ptr_is_owned(this_ptr)) return;
70477         void* this_ptr_ptr = untag_ptr(this_ptr);
70478         CHECK_ACCESS(this_ptr_ptr);
70479         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
70480         FREE(untag_ptr(this_ptr));
70481         OffersMessageHandler_free(this_ptr_conv);
70482 }
70483
70484 void  CS_LDK_OffersMessage_free(int64_t this_ptr) {
70485         if (!ptr_is_owned(this_ptr)) return;
70486         void* this_ptr_ptr = untag_ptr(this_ptr);
70487         CHECK_ACCESS(this_ptr_ptr);
70488         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
70489         FREE(untag_ptr(this_ptr));
70490         OffersMessage_free(this_ptr_conv);
70491 }
70492
70493 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
70494         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70495         *ret_copy = OffersMessage_clone(arg);
70496         int64_t ret_ref = tag_ptr(ret_copy, true);
70497         return ret_ref;
70498 }
70499 int64_t  CS_LDK_OffersMessage_clone_ptr(int64_t arg) {
70500         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
70501         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
70502         return ret_conv;
70503 }
70504
70505 int64_t  CS_LDK_OffersMessage_clone(int64_t orig) {
70506         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
70507         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70508         *ret_copy = OffersMessage_clone(orig_conv);
70509         int64_t ret_ref = tag_ptr(ret_copy, true);
70510         return ret_ref;
70511 }
70512
70513 int64_t  CS_LDK_OffersMessage_invoice_request(int64_t a) {
70514         LDKInvoiceRequest a_conv;
70515         a_conv.inner = untag_ptr(a);
70516         a_conv.is_owned = ptr_is_owned(a);
70517         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70518         a_conv = InvoiceRequest_clone(&a_conv);
70519         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70520         *ret_copy = OffersMessage_invoice_request(a_conv);
70521         int64_t ret_ref = tag_ptr(ret_copy, true);
70522         return ret_ref;
70523 }
70524
70525 int64_t  CS_LDK_OffersMessage_invoice(int64_t a) {
70526         LDKBolt12Invoice a_conv;
70527         a_conv.inner = untag_ptr(a);
70528         a_conv.is_owned = ptr_is_owned(a);
70529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70530         a_conv = Bolt12Invoice_clone(&a_conv);
70531         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70532         *ret_copy = OffersMessage_invoice(a_conv);
70533         int64_t ret_ref = tag_ptr(ret_copy, true);
70534         return ret_ref;
70535 }
70536
70537 int64_t  CS_LDK_OffersMessage_invoice_error(int64_t a) {
70538         LDKInvoiceError a_conv;
70539         a_conv.inner = untag_ptr(a);
70540         a_conv.is_owned = ptr_is_owned(a);
70541         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70542         a_conv = InvoiceError_clone(&a_conv);
70543         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70544         *ret_copy = OffersMessage_invoice_error(a_conv);
70545         int64_t ret_ref = tag_ptr(ret_copy, true);
70546         return ret_ref;
70547 }
70548
70549 jboolean  CS_LDK_OffersMessage_is_known_type(int64_t tlv_type) {
70550         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
70551         return ret_conv;
70552 }
70553
70554 int64_t  CS_LDK_OffersMessage_as_OnionMessageContents(int64_t this_arg) {
70555         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
70556         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70557         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
70558         return tag_ptr(ret_ret, true);
70559 }
70560
70561 int8_tArray  CS_LDK_OffersMessage_write(int64_t obj) {
70562         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
70563         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
70564         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70565         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70566         CVec_u8Z_free(ret_var);
70567         return ret_arr;
70568 }
70569
70570 int64_t  CS_LDK_OffersMessage_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
70571         LDKu8slice ser_ref;
70572         ser_ref.datalen = ser->arr_len;
70573         ser_ref.data = ser->elems;
70574         void* arg_b_ptr = untag_ptr(arg_b);
70575         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
70576         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
70577         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
70578         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
70579         FREE(ser);
70580         return tag_ptr(ret_conv, true);
70581 }
70582
70583 void  CS_LDK_Packet_free(int64_t this_obj) {
70584         LDKPacket this_obj_conv;
70585         this_obj_conv.inner = untag_ptr(this_obj);
70586         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70588         Packet_free(this_obj_conv);
70589 }
70590
70591 int8_t  CS_LDK_Packet_get_version(int64_t this_ptr) {
70592         LDKPacket this_ptr_conv;
70593         this_ptr_conv.inner = untag_ptr(this_ptr);
70594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70596         this_ptr_conv.is_owned = false;
70597         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
70598         return ret_conv;
70599 }
70600
70601 void  CS_LDK_Packet_set_version(int64_t this_ptr, int8_t val) {
70602         LDKPacket this_ptr_conv;
70603         this_ptr_conv.inner = untag_ptr(this_ptr);
70604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70606         this_ptr_conv.is_owned = false;
70607         Packet_set_version(&this_ptr_conv, val);
70608 }
70609
70610 int8_tArray  CS_LDK_Packet_get_public_key(int64_t this_ptr) {
70611         LDKPacket this_ptr_conv;
70612         this_ptr_conv.inner = untag_ptr(this_ptr);
70613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70615         this_ptr_conv.is_owned = false;
70616         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70617         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
70618         return ret_arr;
70619 }
70620
70621 void  CS_LDK_Packet_set_public_key(int64_t this_ptr, int8_tArray val) {
70622         LDKPacket this_ptr_conv;
70623         this_ptr_conv.inner = untag_ptr(this_ptr);
70624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70626         this_ptr_conv.is_owned = false;
70627         LDKPublicKey val_ref;
70628         CHECK(val->arr_len == 33);
70629         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70630         Packet_set_public_key(&this_ptr_conv, val_ref);
70631 }
70632
70633 int8_tArray  CS_LDK_Packet_get_hop_data(int64_t this_ptr) {
70634         LDKPacket this_ptr_conv;
70635         this_ptr_conv.inner = untag_ptr(this_ptr);
70636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70638         this_ptr_conv.is_owned = false;
70639         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
70640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70642         CVec_u8Z_free(ret_var);
70643         return ret_arr;
70644 }
70645
70646 void  CS_LDK_Packet_set_hop_data(int64_t this_ptr, int8_tArray val) {
70647         LDKPacket this_ptr_conv;
70648         this_ptr_conv.inner = untag_ptr(this_ptr);
70649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70651         this_ptr_conv.is_owned = false;
70652         LDKCVec_u8Z val_ref;
70653         val_ref.datalen = val->arr_len;
70654         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70655         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
70656         Packet_set_hop_data(&this_ptr_conv, val_ref);
70657 }
70658
70659 int8_tArray  CS_LDK_Packet_get_hmac(int64_t this_ptr) {
70660         LDKPacket this_ptr_conv;
70661         this_ptr_conv.inner = untag_ptr(this_ptr);
70662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70664         this_ptr_conv.is_owned = false;
70665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
70666         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
70667         return ret_arr;
70668 }
70669
70670 void  CS_LDK_Packet_set_hmac(int64_t this_ptr, int8_tArray val) {
70671         LDKPacket this_ptr_conv;
70672         this_ptr_conv.inner = untag_ptr(this_ptr);
70673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70675         this_ptr_conv.is_owned = false;
70676         LDKThirtyTwoBytes val_ref;
70677         CHECK(val->arr_len == 32);
70678         memcpy(val_ref.data, val->elems, 32); FREE(val);
70679         Packet_set_hmac(&this_ptr_conv, val_ref);
70680 }
70681
70682 int64_t  CS_LDK_Packet_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
70683         LDKPublicKey public_key_arg_ref;
70684         CHECK(public_key_arg->arr_len == 33);
70685         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
70686         LDKCVec_u8Z hop_data_arg_ref;
70687         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
70688         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70689         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
70690         LDKThirtyTwoBytes hmac_arg_ref;
70691         CHECK(hmac_arg->arr_len == 32);
70692         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
70693         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
70694         int64_t ret_ref = 0;
70695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70697         return ret_ref;
70698 }
70699
70700 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
70701         LDKPacket ret_var = Packet_clone(arg);
70702         int64_t ret_ref = 0;
70703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70705         return ret_ref;
70706 }
70707 int64_t  CS_LDK_Packet_clone_ptr(int64_t arg) {
70708         LDKPacket arg_conv;
70709         arg_conv.inner = untag_ptr(arg);
70710         arg_conv.is_owned = ptr_is_owned(arg);
70711         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70712         arg_conv.is_owned = false;
70713         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
70714         return ret_conv;
70715 }
70716
70717 int64_t  CS_LDK_Packet_clone(int64_t orig) {
70718         LDKPacket orig_conv;
70719         orig_conv.inner = untag_ptr(orig);
70720         orig_conv.is_owned = ptr_is_owned(orig);
70721         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70722         orig_conv.is_owned = false;
70723         LDKPacket ret_var = Packet_clone(&orig_conv);
70724         int64_t ret_ref = 0;
70725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70727         return ret_ref;
70728 }
70729
70730 int64_t  CS_LDK_Packet_hash(int64_t o) {
70731         LDKPacket o_conv;
70732         o_conv.inner = untag_ptr(o);
70733         o_conv.is_owned = ptr_is_owned(o);
70734         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70735         o_conv.is_owned = false;
70736         int64_t ret_conv = Packet_hash(&o_conv);
70737         return ret_conv;
70738 }
70739
70740 jboolean  CS_LDK_Packet_eq(int64_t a, int64_t b) {
70741         LDKPacket a_conv;
70742         a_conv.inner = untag_ptr(a);
70743         a_conv.is_owned = ptr_is_owned(a);
70744         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70745         a_conv.is_owned = false;
70746         LDKPacket b_conv;
70747         b_conv.inner = untag_ptr(b);
70748         b_conv.is_owned = ptr_is_owned(b);
70749         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70750         b_conv.is_owned = false;
70751         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
70752         return ret_conv;
70753 }
70754
70755 int8_tArray  CS_LDK_Packet_write(int64_t obj) {
70756         LDKPacket obj_conv;
70757         obj_conv.inner = untag_ptr(obj);
70758         obj_conv.is_owned = ptr_is_owned(obj);
70759         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70760         obj_conv.is_owned = false;
70761         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
70762         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70763         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70764         CVec_u8Z_free(ret_var);
70765         return ret_arr;
70766 }
70767
70768 void  CS_LDK_ParsedOnionMessageContents_free(int64_t this_ptr) {
70769         if (!ptr_is_owned(this_ptr)) return;
70770         void* this_ptr_ptr = untag_ptr(this_ptr);
70771         CHECK_ACCESS(this_ptr_ptr);
70772         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
70773         FREE(untag_ptr(this_ptr));
70774         ParsedOnionMessageContents_free(this_ptr_conv);
70775 }
70776
70777 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
70778         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70779         *ret_copy = ParsedOnionMessageContents_clone(arg);
70780         int64_t ret_ref = tag_ptr(ret_copy, true);
70781         return ret_ref;
70782 }
70783 int64_t  CS_LDK_ParsedOnionMessageContents_clone_ptr(int64_t arg) {
70784         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
70785         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
70786         return ret_conv;
70787 }
70788
70789 int64_t  CS_LDK_ParsedOnionMessageContents_clone(int64_t orig) {
70790         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
70791         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70792         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
70793         int64_t ret_ref = tag_ptr(ret_copy, true);
70794         return ret_ref;
70795 }
70796
70797 int64_t  CS_LDK_ParsedOnionMessageContents_offers(int64_t a) {
70798         void* a_ptr = untag_ptr(a);
70799         CHECK_ACCESS(a_ptr);
70800         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
70801         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
70802         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70803         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
70804         int64_t ret_ref = tag_ptr(ret_copy, true);
70805         return ret_ref;
70806 }
70807
70808 int64_t  CS_LDK_ParsedOnionMessageContents_custom(int64_t a) {
70809         void* a_ptr = untag_ptr(a);
70810         CHECK_ACCESS(a_ptr);
70811         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
70812         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
70813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70814                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
70815         }
70816         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70817         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
70818         int64_t ret_ref = tag_ptr(ret_copy, true);
70819         return ret_ref;
70820 }
70821
70822 int64_t  CS_LDK_ParsedOnionMessageContents_as_OnionMessageContents(int64_t this_arg) {
70823         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
70824         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70825         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
70826         return tag_ptr(ret_ret, true);
70827 }
70828
70829 int8_tArray  CS_LDK_ParsedOnionMessageContents_write(int64_t obj) {
70830         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
70831         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
70832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70834         CVec_u8Z_free(ret_var);
70835         return ret_arr;
70836 }
70837
70838 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
70839         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70840         *ret_ret = OnionMessageContents_clone(arg);
70841         return tag_ptr(ret_ret, true);
70842 }
70843 int64_t  CS_LDK_OnionMessageContents_clone_ptr(int64_t arg) {
70844         void* arg_ptr = untag_ptr(arg);
70845         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
70846         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
70847         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
70848         return ret_conv;
70849 }
70850
70851 int64_t  CS_LDK_OnionMessageContents_clone(int64_t orig) {
70852         void* orig_ptr = untag_ptr(orig);
70853         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
70854         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
70855         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70856         *ret_ret = OnionMessageContents_clone(orig_conv);
70857         return tag_ptr(ret_ret, true);
70858 }
70859
70860 void  CS_LDK_OnionMessageContents_free(int64_t this_ptr) {
70861         if (!ptr_is_owned(this_ptr)) return;
70862         void* this_ptr_ptr = untag_ptr(this_ptr);
70863         CHECK_ACCESS(this_ptr_ptr);
70864         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
70865         FREE(untag_ptr(this_ptr));
70866         OnionMessageContents_free(this_ptr_conv);
70867 }
70868
70869 void  CS_LDK_BlindedPath_free(int64_t this_obj) {
70870         LDKBlindedPath this_obj_conv;
70871         this_obj_conv.inner = untag_ptr(this_obj);
70872         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70874         BlindedPath_free(this_obj_conv);
70875 }
70876
70877 int8_tArray  CS_LDK_BlindedPath_get_introduction_node_id(int64_t this_ptr) {
70878         LDKBlindedPath this_ptr_conv;
70879         this_ptr_conv.inner = untag_ptr(this_ptr);
70880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70882         this_ptr_conv.is_owned = false;
70883         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70884         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
70885         return ret_arr;
70886 }
70887
70888 void  CS_LDK_BlindedPath_set_introduction_node_id(int64_t this_ptr, int8_tArray val) {
70889         LDKBlindedPath this_ptr_conv;
70890         this_ptr_conv.inner = untag_ptr(this_ptr);
70891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70893         this_ptr_conv.is_owned = false;
70894         LDKPublicKey val_ref;
70895         CHECK(val->arr_len == 33);
70896         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70897         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
70898 }
70899
70900 int8_tArray  CS_LDK_BlindedPath_get_blinding_point(int64_t this_ptr) {
70901         LDKBlindedPath this_ptr_conv;
70902         this_ptr_conv.inner = untag_ptr(this_ptr);
70903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70905         this_ptr_conv.is_owned = false;
70906         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70907         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
70908         return ret_arr;
70909 }
70910
70911 void  CS_LDK_BlindedPath_set_blinding_point(int64_t this_ptr, int8_tArray val) {
70912         LDKBlindedPath this_ptr_conv;
70913         this_ptr_conv.inner = untag_ptr(this_ptr);
70914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70916         this_ptr_conv.is_owned = false;
70917         LDKPublicKey val_ref;
70918         CHECK(val->arr_len == 33);
70919         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70920         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
70921 }
70922
70923 int64_tArray  CS_LDK_BlindedPath_get_blinded_hops(int64_t this_ptr) {
70924         LDKBlindedPath this_ptr_conv;
70925         this_ptr_conv.inner = untag_ptr(this_ptr);
70926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70928         this_ptr_conv.is_owned = false;
70929         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
70930         int64_tArray ret_arr = NULL;
70931         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70932         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70933         for (size_t m = 0; m < ret_var.datalen; m++) {
70934                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70935                 int64_t ret_conv_12_ref = 0;
70936                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70937                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70938                 ret_arr_ptr[m] = ret_conv_12_ref;
70939         }
70940         
70941         FREE(ret_var.data);
70942         return ret_arr;
70943 }
70944
70945 void  CS_LDK_BlindedPath_set_blinded_hops(int64_t this_ptr, int64_tArray val) {
70946         LDKBlindedPath this_ptr_conv;
70947         this_ptr_conv.inner = untag_ptr(this_ptr);
70948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70950         this_ptr_conv.is_owned = false;
70951         LDKCVec_BlindedHopZ val_constr;
70952         val_constr.datalen = val->arr_len;
70953         if (val_constr.datalen > 0)
70954                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70955         else
70956                 val_constr.data = NULL;
70957         int64_t* val_vals = val->elems;
70958         for (size_t m = 0; m < val_constr.datalen; m++) {
70959                 int64_t val_conv_12 = val_vals[m];
70960                 LDKBlindedHop val_conv_12_conv;
70961                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70962                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70963                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70964                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70965                 val_constr.data[m] = val_conv_12_conv;
70966         }
70967         FREE(val);
70968         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
70969 }
70970
70971 int64_t  CS_LDK_BlindedPath_new(int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
70972         LDKPublicKey introduction_node_id_arg_ref;
70973         CHECK(introduction_node_id_arg->arr_len == 33);
70974         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
70975         LDKPublicKey blinding_point_arg_ref;
70976         CHECK(blinding_point_arg->arr_len == 33);
70977         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
70978         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
70979         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
70980         if (blinded_hops_arg_constr.datalen > 0)
70981                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70982         else
70983                 blinded_hops_arg_constr.data = NULL;
70984         int64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
70985         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
70986                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
70987                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
70988                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
70989                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
70990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
70991                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
70992                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
70993         }
70994         FREE(blinded_hops_arg);
70995         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
70996         int64_t ret_ref = 0;
70997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70999         return ret_ref;
71000 }
71001
71002 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
71003         LDKBlindedPath ret_var = BlindedPath_clone(arg);
71004         int64_t ret_ref = 0;
71005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71007         return ret_ref;
71008 }
71009 int64_t  CS_LDK_BlindedPath_clone_ptr(int64_t arg) {
71010         LDKBlindedPath arg_conv;
71011         arg_conv.inner = untag_ptr(arg);
71012         arg_conv.is_owned = ptr_is_owned(arg);
71013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71014         arg_conv.is_owned = false;
71015         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
71016         return ret_conv;
71017 }
71018
71019 int64_t  CS_LDK_BlindedPath_clone(int64_t orig) {
71020         LDKBlindedPath orig_conv;
71021         orig_conv.inner = untag_ptr(orig);
71022         orig_conv.is_owned = ptr_is_owned(orig);
71023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71024         orig_conv.is_owned = false;
71025         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
71026         int64_t ret_ref = 0;
71027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71029         return ret_ref;
71030 }
71031
71032 int64_t  CS_LDK_BlindedPath_hash(int64_t o) {
71033         LDKBlindedPath o_conv;
71034         o_conv.inner = untag_ptr(o);
71035         o_conv.is_owned = ptr_is_owned(o);
71036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71037         o_conv.is_owned = false;
71038         int64_t ret_conv = BlindedPath_hash(&o_conv);
71039         return ret_conv;
71040 }
71041
71042 jboolean  CS_LDK_BlindedPath_eq(int64_t a, int64_t b) {
71043         LDKBlindedPath a_conv;
71044         a_conv.inner = untag_ptr(a);
71045         a_conv.is_owned = ptr_is_owned(a);
71046         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71047         a_conv.is_owned = false;
71048         LDKBlindedPath b_conv;
71049         b_conv.inner = untag_ptr(b);
71050         b_conv.is_owned = ptr_is_owned(b);
71051         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71052         b_conv.is_owned = false;
71053         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
71054         return ret_conv;
71055 }
71056
71057 void  CS_LDK_BlindedHop_free(int64_t this_obj) {
71058         LDKBlindedHop this_obj_conv;
71059         this_obj_conv.inner = untag_ptr(this_obj);
71060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71062         BlindedHop_free(this_obj_conv);
71063 }
71064
71065 int8_tArray  CS_LDK_BlindedHop_get_blinded_node_id(int64_t this_ptr) {
71066         LDKBlindedHop this_ptr_conv;
71067         this_ptr_conv.inner = untag_ptr(this_ptr);
71068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71070         this_ptr_conv.is_owned = false;
71071         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71072         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
71073         return ret_arr;
71074 }
71075
71076 void  CS_LDK_BlindedHop_set_blinded_node_id(int64_t this_ptr, int8_tArray val) {
71077         LDKBlindedHop this_ptr_conv;
71078         this_ptr_conv.inner = untag_ptr(this_ptr);
71079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71081         this_ptr_conv.is_owned = false;
71082         LDKPublicKey val_ref;
71083         CHECK(val->arr_len == 33);
71084         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71085         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
71086 }
71087
71088 int8_tArray  CS_LDK_BlindedHop_get_encrypted_payload(int64_t this_ptr) {
71089         LDKBlindedHop this_ptr_conv;
71090         this_ptr_conv.inner = untag_ptr(this_ptr);
71091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71093         this_ptr_conv.is_owned = false;
71094         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
71095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71097         CVec_u8Z_free(ret_var);
71098         return ret_arr;
71099 }
71100
71101 void  CS_LDK_BlindedHop_set_encrypted_payload(int64_t this_ptr, int8_tArray val) {
71102         LDKBlindedHop this_ptr_conv;
71103         this_ptr_conv.inner = untag_ptr(this_ptr);
71104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71106         this_ptr_conv.is_owned = false;
71107         LDKCVec_u8Z val_ref;
71108         val_ref.datalen = val->arr_len;
71109         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
71110         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
71111         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
71112 }
71113
71114 int64_t  CS_LDK_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
71115         LDKPublicKey blinded_node_id_arg_ref;
71116         CHECK(blinded_node_id_arg->arr_len == 33);
71117         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
71118         LDKCVec_u8Z encrypted_payload_arg_ref;
71119         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
71120         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
71121         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
71122         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
71123         int64_t ret_ref = 0;
71124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71126         return ret_ref;
71127 }
71128
71129 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
71130         LDKBlindedHop ret_var = BlindedHop_clone(arg);
71131         int64_t ret_ref = 0;
71132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71134         return ret_ref;
71135 }
71136 int64_t  CS_LDK_BlindedHop_clone_ptr(int64_t arg) {
71137         LDKBlindedHop arg_conv;
71138         arg_conv.inner = untag_ptr(arg);
71139         arg_conv.is_owned = ptr_is_owned(arg);
71140         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71141         arg_conv.is_owned = false;
71142         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
71143         return ret_conv;
71144 }
71145
71146 int64_t  CS_LDK_BlindedHop_clone(int64_t orig) {
71147         LDKBlindedHop orig_conv;
71148         orig_conv.inner = untag_ptr(orig);
71149         orig_conv.is_owned = ptr_is_owned(orig);
71150         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71151         orig_conv.is_owned = false;
71152         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
71153         int64_t ret_ref = 0;
71154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71156         return ret_ref;
71157 }
71158
71159 int64_t  CS_LDK_BlindedHop_hash(int64_t o) {
71160         LDKBlindedHop o_conv;
71161         o_conv.inner = untag_ptr(o);
71162         o_conv.is_owned = ptr_is_owned(o);
71163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71164         o_conv.is_owned = false;
71165         int64_t ret_conv = BlindedHop_hash(&o_conv);
71166         return ret_conv;
71167 }
71168
71169 jboolean  CS_LDK_BlindedHop_eq(int64_t a, int64_t b) {
71170         LDKBlindedHop a_conv;
71171         a_conv.inner = untag_ptr(a);
71172         a_conv.is_owned = ptr_is_owned(a);
71173         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71174         a_conv.is_owned = false;
71175         LDKBlindedHop b_conv;
71176         b_conv.inner = untag_ptr(b);
71177         b_conv.is_owned = ptr_is_owned(b);
71178         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71179         b_conv.is_owned = false;
71180         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
71181         return ret_conv;
71182 }
71183
71184 int64_t  CS_LDK_BlindedPath_one_hop_for_message(int8_tArray recipient_node_id, int64_t entropy_source) {
71185         LDKPublicKey recipient_node_id_ref;
71186         CHECK(recipient_node_id->arr_len == 33);
71187         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
71188         void* entropy_source_ptr = untag_ptr(entropy_source);
71189         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71190         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71191         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
71192         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
71193         return tag_ptr(ret_conv, true);
71194 }
71195
71196 int64_t  CS_LDK_BlindedPath_new_for_message(ptrArray node_pks, int64_t entropy_source) {
71197         LDKCVec_PublicKeyZ node_pks_constr;
71198         node_pks_constr.datalen = node_pks->arr_len;
71199         if (node_pks_constr.datalen > 0)
71200                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
71201         else
71202                 node_pks_constr.data = NULL;
71203         int8_tArray* node_pks_vals = (void*) node_pks->elems;
71204         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
71205                 int8_tArray node_pks_conv_8 = node_pks_vals[i];
71206                 LDKPublicKey node_pks_conv_8_ref;
71207                 CHECK(node_pks_conv_8->arr_len == 33);
71208                 memcpy(node_pks_conv_8_ref.compressed_form, node_pks_conv_8->elems, 33); FREE(node_pks_conv_8);
71209                 node_pks_constr.data[i] = node_pks_conv_8_ref;
71210         }
71211         FREE(node_pks);
71212         void* entropy_source_ptr = untag_ptr(entropy_source);
71213         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71214         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71215         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
71216         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
71217         return tag_ptr(ret_conv, true);
71218 }
71219
71220 int64_t  CS_LDK_BlindedPath_one_hop_for_payment(int8_tArray payee_node_id, int64_t payee_tlvs, int64_t entropy_source) {
71221         LDKPublicKey payee_node_id_ref;
71222         CHECK(payee_node_id->arr_len == 33);
71223         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
71224         LDKReceiveTlvs payee_tlvs_conv;
71225         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
71226         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
71227         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
71228         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
71229         void* entropy_source_ptr = untag_ptr(entropy_source);
71230         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71231         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71232         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
71233         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
71234         return tag_ptr(ret_conv, true);
71235 }
71236
71237 int64_t  CS_LDK_BlindedPath_new_for_payment(int64_tArray intermediate_nodes, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t htlc_maximum_msat, int64_t entropy_source) {
71238         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
71239         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
71240         if (intermediate_nodes_constr.datalen > 0)
71241                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
71242         else
71243                 intermediate_nodes_constr.data = NULL;
71244         int64_t* intermediate_nodes_vals = intermediate_nodes->elems;
71245         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
71246                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
71247                 LDKForwardNode intermediate_nodes_conv_13_conv;
71248                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
71249                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
71250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
71251                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
71252                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
71253         }
71254         FREE(intermediate_nodes);
71255         LDKPublicKey payee_node_id_ref;
71256         CHECK(payee_node_id->arr_len == 33);
71257         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
71258         LDKReceiveTlvs payee_tlvs_conv;
71259         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
71260         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
71261         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
71262         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
71263         void* entropy_source_ptr = untag_ptr(entropy_source);
71264         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71265         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71266         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
71267         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, entropy_source_conv);
71268         return tag_ptr(ret_conv, true);
71269 }
71270
71271 int8_tArray  CS_LDK_BlindedPath_write(int64_t obj) {
71272         LDKBlindedPath obj_conv;
71273         obj_conv.inner = untag_ptr(obj);
71274         obj_conv.is_owned = ptr_is_owned(obj);
71275         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71276         obj_conv.is_owned = false;
71277         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
71278         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71279         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71280         CVec_u8Z_free(ret_var);
71281         return ret_arr;
71282 }
71283
71284 int64_t  CS_LDK_BlindedPath_read(int8_tArray ser) {
71285         LDKu8slice ser_ref;
71286         ser_ref.datalen = ser->arr_len;
71287         ser_ref.data = ser->elems;
71288         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
71289         *ret_conv = BlindedPath_read(ser_ref);
71290         FREE(ser);
71291         return tag_ptr(ret_conv, true);
71292 }
71293
71294 int8_tArray  CS_LDK_BlindedHop_write(int64_t obj) {
71295         LDKBlindedHop obj_conv;
71296         obj_conv.inner = untag_ptr(obj);
71297         obj_conv.is_owned = ptr_is_owned(obj);
71298         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71299         obj_conv.is_owned = false;
71300         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
71301         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71302         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71303         CVec_u8Z_free(ret_var);
71304         return ret_arr;
71305 }
71306
71307 int64_t  CS_LDK_BlindedHop_read(int8_tArray ser) {
71308         LDKu8slice ser_ref;
71309         ser_ref.datalen = ser->arr_len;
71310         ser_ref.data = ser->elems;
71311         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
71312         *ret_conv = BlindedHop_read(ser_ref);
71313         FREE(ser);
71314         return tag_ptr(ret_conv, true);
71315 }
71316
71317 void  CS_LDK_ForwardNode_free(int64_t this_obj) {
71318         LDKForwardNode this_obj_conv;
71319         this_obj_conv.inner = untag_ptr(this_obj);
71320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71322         ForwardNode_free(this_obj_conv);
71323 }
71324
71325 int64_t  CS_LDK_ForwardNode_get_tlvs(int64_t this_ptr) {
71326         LDKForwardNode this_ptr_conv;
71327         this_ptr_conv.inner = untag_ptr(this_ptr);
71328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71330         this_ptr_conv.is_owned = false;
71331         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
71332         int64_t ret_ref = 0;
71333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71335         return ret_ref;
71336 }
71337
71338 void  CS_LDK_ForwardNode_set_tlvs(int64_t this_ptr, int64_t val) {
71339         LDKForwardNode this_ptr_conv;
71340         this_ptr_conv.inner = untag_ptr(this_ptr);
71341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71343         this_ptr_conv.is_owned = false;
71344         LDKForwardTlvs val_conv;
71345         val_conv.inner = untag_ptr(val);
71346         val_conv.is_owned = ptr_is_owned(val);
71347         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71348         val_conv = ForwardTlvs_clone(&val_conv);
71349         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
71350 }
71351
71352 int8_tArray  CS_LDK_ForwardNode_get_node_id(int64_t this_ptr) {
71353         LDKForwardNode this_ptr_conv;
71354         this_ptr_conv.inner = untag_ptr(this_ptr);
71355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71357         this_ptr_conv.is_owned = false;
71358         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71359         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
71360         return ret_arr;
71361 }
71362
71363 void  CS_LDK_ForwardNode_set_node_id(int64_t this_ptr, int8_tArray val) {
71364         LDKForwardNode this_ptr_conv;
71365         this_ptr_conv.inner = untag_ptr(this_ptr);
71366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71368         this_ptr_conv.is_owned = false;
71369         LDKPublicKey val_ref;
71370         CHECK(val->arr_len == 33);
71371         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71372         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
71373 }
71374
71375 int64_t  CS_LDK_ForwardNode_get_htlc_maximum_msat(int64_t this_ptr) {
71376         LDKForwardNode this_ptr_conv;
71377         this_ptr_conv.inner = untag_ptr(this_ptr);
71378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71380         this_ptr_conv.is_owned = false;
71381         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
71382         return ret_conv;
71383 }
71384
71385 void  CS_LDK_ForwardNode_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
71386         LDKForwardNode this_ptr_conv;
71387         this_ptr_conv.inner = untag_ptr(this_ptr);
71388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71390         this_ptr_conv.is_owned = false;
71391         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
71392 }
71393
71394 int64_t  CS_LDK_ForwardNode_new(int64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
71395         LDKForwardTlvs tlvs_arg_conv;
71396         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
71397         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
71398         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
71399         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
71400         LDKPublicKey node_id_arg_ref;
71401         CHECK(node_id_arg->arr_len == 33);
71402         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
71403         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
71404         int64_t ret_ref = 0;
71405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71407         return ret_ref;
71408 }
71409
71410 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
71411         LDKForwardNode ret_var = ForwardNode_clone(arg);
71412         int64_t ret_ref = 0;
71413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71415         return ret_ref;
71416 }
71417 int64_t  CS_LDK_ForwardNode_clone_ptr(int64_t arg) {
71418         LDKForwardNode arg_conv;
71419         arg_conv.inner = untag_ptr(arg);
71420         arg_conv.is_owned = ptr_is_owned(arg);
71421         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71422         arg_conv.is_owned = false;
71423         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
71424         return ret_conv;
71425 }
71426
71427 int64_t  CS_LDK_ForwardNode_clone(int64_t orig) {
71428         LDKForwardNode orig_conv;
71429         orig_conv.inner = untag_ptr(orig);
71430         orig_conv.is_owned = ptr_is_owned(orig);
71431         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71432         orig_conv.is_owned = false;
71433         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
71434         int64_t ret_ref = 0;
71435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71437         return ret_ref;
71438 }
71439
71440 void  CS_LDK_ForwardTlvs_free(int64_t this_obj) {
71441         LDKForwardTlvs this_obj_conv;
71442         this_obj_conv.inner = untag_ptr(this_obj);
71443         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71445         ForwardTlvs_free(this_obj_conv);
71446 }
71447
71448 int64_t  CS_LDK_ForwardTlvs_get_short_channel_id(int64_t this_ptr) {
71449         LDKForwardTlvs this_ptr_conv;
71450         this_ptr_conv.inner = untag_ptr(this_ptr);
71451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71453         this_ptr_conv.is_owned = false;
71454         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
71455         return ret_conv;
71456 }
71457
71458 void  CS_LDK_ForwardTlvs_set_short_channel_id(int64_t this_ptr, int64_t val) {
71459         LDKForwardTlvs this_ptr_conv;
71460         this_ptr_conv.inner = untag_ptr(this_ptr);
71461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71463         this_ptr_conv.is_owned = false;
71464         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
71465 }
71466
71467 int64_t  CS_LDK_ForwardTlvs_get_payment_relay(int64_t this_ptr) {
71468         LDKForwardTlvs this_ptr_conv;
71469         this_ptr_conv.inner = untag_ptr(this_ptr);
71470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71472         this_ptr_conv.is_owned = false;
71473         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
71474         int64_t ret_ref = 0;
71475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71477         return ret_ref;
71478 }
71479
71480 void  CS_LDK_ForwardTlvs_set_payment_relay(int64_t this_ptr, int64_t val) {
71481         LDKForwardTlvs this_ptr_conv;
71482         this_ptr_conv.inner = untag_ptr(this_ptr);
71483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71485         this_ptr_conv.is_owned = false;
71486         LDKPaymentRelay val_conv;
71487         val_conv.inner = untag_ptr(val);
71488         val_conv.is_owned = ptr_is_owned(val);
71489         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71490         val_conv = PaymentRelay_clone(&val_conv);
71491         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
71492 }
71493
71494 int64_t  CS_LDK_ForwardTlvs_get_payment_constraints(int64_t this_ptr) {
71495         LDKForwardTlvs this_ptr_conv;
71496         this_ptr_conv.inner = untag_ptr(this_ptr);
71497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71499         this_ptr_conv.is_owned = false;
71500         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
71501         int64_t ret_ref = 0;
71502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71504         return ret_ref;
71505 }
71506
71507 void  CS_LDK_ForwardTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
71508         LDKForwardTlvs this_ptr_conv;
71509         this_ptr_conv.inner = untag_ptr(this_ptr);
71510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71512         this_ptr_conv.is_owned = false;
71513         LDKPaymentConstraints val_conv;
71514         val_conv.inner = untag_ptr(val);
71515         val_conv.is_owned = ptr_is_owned(val);
71516         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71517         val_conv = PaymentConstraints_clone(&val_conv);
71518         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71519 }
71520
71521 int64_t  CS_LDK_ForwardTlvs_get_features(int64_t this_ptr) {
71522         LDKForwardTlvs this_ptr_conv;
71523         this_ptr_conv.inner = untag_ptr(this_ptr);
71524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71526         this_ptr_conv.is_owned = false;
71527         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
71528         int64_t ret_ref = 0;
71529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71531         return ret_ref;
71532 }
71533
71534 void  CS_LDK_ForwardTlvs_set_features(int64_t this_ptr, int64_t val) {
71535         LDKForwardTlvs this_ptr_conv;
71536         this_ptr_conv.inner = untag_ptr(this_ptr);
71537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71539         this_ptr_conv.is_owned = false;
71540         LDKBlindedHopFeatures val_conv;
71541         val_conv.inner = untag_ptr(val);
71542         val_conv.is_owned = ptr_is_owned(val);
71543         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71544         val_conv = BlindedHopFeatures_clone(&val_conv);
71545         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
71546 }
71547
71548 int64_t  CS_LDK_ForwardTlvs_new(int64_t short_channel_id_arg, int64_t payment_relay_arg, int64_t payment_constraints_arg, int64_t features_arg) {
71549         LDKPaymentRelay payment_relay_arg_conv;
71550         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
71551         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
71552         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
71553         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
71554         LDKPaymentConstraints payment_constraints_arg_conv;
71555         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71556         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71557         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71558         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71559         LDKBlindedHopFeatures features_arg_conv;
71560         features_arg_conv.inner = untag_ptr(features_arg);
71561         features_arg_conv.is_owned = ptr_is_owned(features_arg);
71562         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
71563         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
71564         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
71565         int64_t ret_ref = 0;
71566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71568         return ret_ref;
71569 }
71570
71571 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
71572         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
71573         int64_t ret_ref = 0;
71574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71576         return ret_ref;
71577 }
71578 int64_t  CS_LDK_ForwardTlvs_clone_ptr(int64_t arg) {
71579         LDKForwardTlvs arg_conv;
71580         arg_conv.inner = untag_ptr(arg);
71581         arg_conv.is_owned = ptr_is_owned(arg);
71582         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71583         arg_conv.is_owned = false;
71584         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
71585         return ret_conv;
71586 }
71587
71588 int64_t  CS_LDK_ForwardTlvs_clone(int64_t orig) {
71589         LDKForwardTlvs orig_conv;
71590         orig_conv.inner = untag_ptr(orig);
71591         orig_conv.is_owned = ptr_is_owned(orig);
71592         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71593         orig_conv.is_owned = false;
71594         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
71595         int64_t ret_ref = 0;
71596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71598         return ret_ref;
71599 }
71600
71601 void  CS_LDK_ReceiveTlvs_free(int64_t this_obj) {
71602         LDKReceiveTlvs this_obj_conv;
71603         this_obj_conv.inner = untag_ptr(this_obj);
71604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71606         ReceiveTlvs_free(this_obj_conv);
71607 }
71608
71609 int8_tArray  CS_LDK_ReceiveTlvs_get_payment_secret(int64_t this_ptr) {
71610         LDKReceiveTlvs this_ptr_conv;
71611         this_ptr_conv.inner = untag_ptr(this_ptr);
71612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71614         this_ptr_conv.is_owned = false;
71615         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
71616         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
71617         return ret_arr;
71618 }
71619
71620 void  CS_LDK_ReceiveTlvs_set_payment_secret(int64_t this_ptr, int8_tArray val) {
71621         LDKReceiveTlvs this_ptr_conv;
71622         this_ptr_conv.inner = untag_ptr(this_ptr);
71623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71625         this_ptr_conv.is_owned = false;
71626         LDKThirtyTwoBytes val_ref;
71627         CHECK(val->arr_len == 32);
71628         memcpy(val_ref.data, val->elems, 32); FREE(val);
71629         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
71630 }
71631
71632 int64_t  CS_LDK_ReceiveTlvs_get_payment_constraints(int64_t this_ptr) {
71633         LDKReceiveTlvs this_ptr_conv;
71634         this_ptr_conv.inner = untag_ptr(this_ptr);
71635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71637         this_ptr_conv.is_owned = false;
71638         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
71639         int64_t ret_ref = 0;
71640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71642         return ret_ref;
71643 }
71644
71645 void  CS_LDK_ReceiveTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
71646         LDKReceiveTlvs this_ptr_conv;
71647         this_ptr_conv.inner = untag_ptr(this_ptr);
71648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71650         this_ptr_conv.is_owned = false;
71651         LDKPaymentConstraints val_conv;
71652         val_conv.inner = untag_ptr(val);
71653         val_conv.is_owned = ptr_is_owned(val);
71654         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71655         val_conv = PaymentConstraints_clone(&val_conv);
71656         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71657 }
71658
71659 int64_t  CS_LDK_ReceiveTlvs_new(int8_tArray payment_secret_arg, int64_t payment_constraints_arg) {
71660         LDKThirtyTwoBytes payment_secret_arg_ref;
71661         CHECK(payment_secret_arg->arr_len == 32);
71662         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
71663         LDKPaymentConstraints payment_constraints_arg_conv;
71664         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71665         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71666         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71667         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71668         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
71669         int64_t ret_ref = 0;
71670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71672         return ret_ref;
71673 }
71674
71675 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
71676         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
71677         int64_t ret_ref = 0;
71678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71680         return ret_ref;
71681 }
71682 int64_t  CS_LDK_ReceiveTlvs_clone_ptr(int64_t arg) {
71683         LDKReceiveTlvs arg_conv;
71684         arg_conv.inner = untag_ptr(arg);
71685         arg_conv.is_owned = ptr_is_owned(arg);
71686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71687         arg_conv.is_owned = false;
71688         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
71689         return ret_conv;
71690 }
71691
71692 int64_t  CS_LDK_ReceiveTlvs_clone(int64_t orig) {
71693         LDKReceiveTlvs orig_conv;
71694         orig_conv.inner = untag_ptr(orig);
71695         orig_conv.is_owned = ptr_is_owned(orig);
71696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71697         orig_conv.is_owned = false;
71698         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
71699         int64_t ret_ref = 0;
71700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71702         return ret_ref;
71703 }
71704
71705 void  CS_LDK_PaymentRelay_free(int64_t this_obj) {
71706         LDKPaymentRelay this_obj_conv;
71707         this_obj_conv.inner = untag_ptr(this_obj);
71708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71710         PaymentRelay_free(this_obj_conv);
71711 }
71712
71713 int16_t  CS_LDK_PaymentRelay_get_cltv_expiry_delta(int64_t this_ptr) {
71714         LDKPaymentRelay this_ptr_conv;
71715         this_ptr_conv.inner = untag_ptr(this_ptr);
71716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71718         this_ptr_conv.is_owned = false;
71719         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
71720         return ret_conv;
71721 }
71722
71723 void  CS_LDK_PaymentRelay_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
71724         LDKPaymentRelay this_ptr_conv;
71725         this_ptr_conv.inner = untag_ptr(this_ptr);
71726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71728         this_ptr_conv.is_owned = false;
71729         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
71730 }
71731
71732 int32_t  CS_LDK_PaymentRelay_get_fee_proportional_millionths(int64_t this_ptr) {
71733         LDKPaymentRelay this_ptr_conv;
71734         this_ptr_conv.inner = untag_ptr(this_ptr);
71735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71737         this_ptr_conv.is_owned = false;
71738         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
71739         return ret_conv;
71740 }
71741
71742 void  CS_LDK_PaymentRelay_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
71743         LDKPaymentRelay this_ptr_conv;
71744         this_ptr_conv.inner = untag_ptr(this_ptr);
71745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71747         this_ptr_conv.is_owned = false;
71748         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
71749 }
71750
71751 int32_t  CS_LDK_PaymentRelay_get_fee_base_msat(int64_t this_ptr) {
71752         LDKPaymentRelay this_ptr_conv;
71753         this_ptr_conv.inner = untag_ptr(this_ptr);
71754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71756         this_ptr_conv.is_owned = false;
71757         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
71758         return ret_conv;
71759 }
71760
71761 void  CS_LDK_PaymentRelay_set_fee_base_msat(int64_t this_ptr, int32_t val) {
71762         LDKPaymentRelay this_ptr_conv;
71763         this_ptr_conv.inner = untag_ptr(this_ptr);
71764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71766         this_ptr_conv.is_owned = false;
71767         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
71768 }
71769
71770 int64_t  CS_LDK_PaymentRelay_new(int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
71771         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
71772         int64_t ret_ref = 0;
71773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71775         return ret_ref;
71776 }
71777
71778 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
71779         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
71780         int64_t ret_ref = 0;
71781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71783         return ret_ref;
71784 }
71785 int64_t  CS_LDK_PaymentRelay_clone_ptr(int64_t arg) {
71786         LDKPaymentRelay arg_conv;
71787         arg_conv.inner = untag_ptr(arg);
71788         arg_conv.is_owned = ptr_is_owned(arg);
71789         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71790         arg_conv.is_owned = false;
71791         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
71792         return ret_conv;
71793 }
71794
71795 int64_t  CS_LDK_PaymentRelay_clone(int64_t orig) {
71796         LDKPaymentRelay orig_conv;
71797         orig_conv.inner = untag_ptr(orig);
71798         orig_conv.is_owned = ptr_is_owned(orig);
71799         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71800         orig_conv.is_owned = false;
71801         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
71802         int64_t ret_ref = 0;
71803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71805         return ret_ref;
71806 }
71807
71808 void  CS_LDK_PaymentConstraints_free(int64_t this_obj) {
71809         LDKPaymentConstraints this_obj_conv;
71810         this_obj_conv.inner = untag_ptr(this_obj);
71811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71813         PaymentConstraints_free(this_obj_conv);
71814 }
71815
71816 int32_t  CS_LDK_PaymentConstraints_get_max_cltv_expiry(int64_t this_ptr) {
71817         LDKPaymentConstraints this_ptr_conv;
71818         this_ptr_conv.inner = untag_ptr(this_ptr);
71819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71821         this_ptr_conv.is_owned = false;
71822         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
71823         return ret_conv;
71824 }
71825
71826 void  CS_LDK_PaymentConstraints_set_max_cltv_expiry(int64_t this_ptr, int32_t val) {
71827         LDKPaymentConstraints this_ptr_conv;
71828         this_ptr_conv.inner = untag_ptr(this_ptr);
71829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71831         this_ptr_conv.is_owned = false;
71832         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
71833 }
71834
71835 int64_t  CS_LDK_PaymentConstraints_get_htlc_minimum_msat(int64_t this_ptr) {
71836         LDKPaymentConstraints this_ptr_conv;
71837         this_ptr_conv.inner = untag_ptr(this_ptr);
71838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71840         this_ptr_conv.is_owned = false;
71841         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
71842         return ret_conv;
71843 }
71844
71845 void  CS_LDK_PaymentConstraints_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
71846         LDKPaymentConstraints this_ptr_conv;
71847         this_ptr_conv.inner = untag_ptr(this_ptr);
71848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71850         this_ptr_conv.is_owned = false;
71851         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
71852 }
71853
71854 int64_t  CS_LDK_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
71855         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
71856         int64_t ret_ref = 0;
71857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71859         return ret_ref;
71860 }
71861
71862 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
71863         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
71864         int64_t ret_ref = 0;
71865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71867         return ret_ref;
71868 }
71869 int64_t  CS_LDK_PaymentConstraints_clone_ptr(int64_t arg) {
71870         LDKPaymentConstraints arg_conv;
71871         arg_conv.inner = untag_ptr(arg);
71872         arg_conv.is_owned = ptr_is_owned(arg);
71873         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71874         arg_conv.is_owned = false;
71875         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
71876         return ret_conv;
71877 }
71878
71879 int64_t  CS_LDK_PaymentConstraints_clone(int64_t orig) {
71880         LDKPaymentConstraints orig_conv;
71881         orig_conv.inner = untag_ptr(orig);
71882         orig_conv.is_owned = ptr_is_owned(orig);
71883         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71884         orig_conv.is_owned = false;
71885         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
71886         int64_t ret_ref = 0;
71887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71889         return ret_ref;
71890 }
71891
71892 int8_tArray  CS_LDK_ForwardTlvs_write(int64_t obj) {
71893         LDKForwardTlvs obj_conv;
71894         obj_conv.inner = untag_ptr(obj);
71895         obj_conv.is_owned = ptr_is_owned(obj);
71896         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71897         obj_conv.is_owned = false;
71898         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
71899         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71900         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71901         CVec_u8Z_free(ret_var);
71902         return ret_arr;
71903 }
71904
71905 int8_tArray  CS_LDK_ReceiveTlvs_write(int64_t obj) {
71906         LDKReceiveTlvs obj_conv;
71907         obj_conv.inner = untag_ptr(obj);
71908         obj_conv.is_owned = ptr_is_owned(obj);
71909         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71910         obj_conv.is_owned = false;
71911         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
71912         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71913         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71914         CVec_u8Z_free(ret_var);
71915         return ret_arr;
71916 }
71917
71918 int8_tArray  CS_LDK_PaymentRelay_write(int64_t obj) {
71919         LDKPaymentRelay obj_conv;
71920         obj_conv.inner = untag_ptr(obj);
71921         obj_conv.is_owned = ptr_is_owned(obj);
71922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71923         obj_conv.is_owned = false;
71924         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
71925         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71926         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71927         CVec_u8Z_free(ret_var);
71928         return ret_arr;
71929 }
71930
71931 int64_t  CS_LDK_PaymentRelay_read(int8_tArray ser) {
71932         LDKu8slice ser_ref;
71933         ser_ref.datalen = ser->arr_len;
71934         ser_ref.data = ser->elems;
71935         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
71936         *ret_conv = PaymentRelay_read(ser_ref);
71937         FREE(ser);
71938         return tag_ptr(ret_conv, true);
71939 }
71940
71941 int8_tArray  CS_LDK_PaymentConstraints_write(int64_t obj) {
71942         LDKPaymentConstraints obj_conv;
71943         obj_conv.inner = untag_ptr(obj);
71944         obj_conv.is_owned = ptr_is_owned(obj);
71945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71946         obj_conv.is_owned = false;
71947         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
71948         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71949         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71950         CVec_u8Z_free(ret_var);
71951         return ret_arr;
71952 }
71953
71954 int64_t  CS_LDK_PaymentConstraints_read(int8_tArray ser) {
71955         LDKu8slice ser_ref;
71956         ser_ref.datalen = ser->arr_len;
71957         ser_ref.data = ser->elems;
71958         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
71959         *ret_conv = PaymentConstraints_read(ser_ref);
71960         FREE(ser);
71961         return tag_ptr(ret_conv, true);
71962 }
71963
71964 void  CS_LDK_PaymentPurpose_free(int64_t this_ptr) {
71965         if (!ptr_is_owned(this_ptr)) return;
71966         void* this_ptr_ptr = untag_ptr(this_ptr);
71967         CHECK_ACCESS(this_ptr_ptr);
71968         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
71969         FREE(untag_ptr(this_ptr));
71970         PaymentPurpose_free(this_ptr_conv);
71971 }
71972
71973 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
71974         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71975         *ret_copy = PaymentPurpose_clone(arg);
71976         int64_t ret_ref = tag_ptr(ret_copy, true);
71977         return ret_ref;
71978 }
71979 int64_t  CS_LDK_PaymentPurpose_clone_ptr(int64_t arg) {
71980         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
71981         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
71982         return ret_conv;
71983 }
71984
71985 int64_t  CS_LDK_PaymentPurpose_clone(int64_t orig) {
71986         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
71987         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71988         *ret_copy = PaymentPurpose_clone(orig_conv);
71989         int64_t ret_ref = tag_ptr(ret_copy, true);
71990         return ret_ref;
71991 }
71992
71993 int64_t  CS_LDK_PaymentPurpose_invoice_payment(int64_t payment_preimage, int8_tArray payment_secret) {
71994         void* payment_preimage_ptr = untag_ptr(payment_preimage);
71995         CHECK_ACCESS(payment_preimage_ptr);
71996         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
71997         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
71998         LDKThirtyTwoBytes payment_secret_ref;
71999         CHECK(payment_secret->arr_len == 32);
72000         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
72001         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
72002         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
72003         int64_t ret_ref = tag_ptr(ret_copy, true);
72004         return ret_ref;
72005 }
72006
72007 int64_t  CS_LDK_PaymentPurpose_spontaneous_payment(int8_tArray a) {
72008         LDKThirtyTwoBytes a_ref;
72009         CHECK(a->arr_len == 32);
72010         memcpy(a_ref.data, a->elems, 32); FREE(a);
72011         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
72012         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
72013         int64_t ret_ref = tag_ptr(ret_copy, true);
72014         return ret_ref;
72015 }
72016
72017 jboolean  CS_LDK_PaymentPurpose_eq(int64_t a, int64_t b) {
72018         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
72019         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
72020         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
72021         return ret_conv;
72022 }
72023
72024 int64_t  CS_LDK_PaymentPurpose_preimage(int64_t this_arg) {
72025         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
72026         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
72027         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
72028         int64_t ret_ref = tag_ptr(ret_copy, true);
72029         return ret_ref;
72030 }
72031
72032 int8_tArray  CS_LDK_PaymentPurpose_write(int64_t obj) {
72033         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
72034         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
72035         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72036         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72037         CVec_u8Z_free(ret_var);
72038         return ret_arr;
72039 }
72040
72041 int64_t  CS_LDK_PaymentPurpose_read(int8_tArray ser) {
72042         LDKu8slice ser_ref;
72043         ser_ref.datalen = ser->arr_len;
72044         ser_ref.data = ser->elems;
72045         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
72046         *ret_conv = PaymentPurpose_read(ser_ref);
72047         FREE(ser);
72048         return tag_ptr(ret_conv, true);
72049 }
72050
72051 void  CS_LDK_ClaimedHTLC_free(int64_t this_obj) {
72052         LDKClaimedHTLC this_obj_conv;
72053         this_obj_conv.inner = untag_ptr(this_obj);
72054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72056         ClaimedHTLC_free(this_obj_conv);
72057 }
72058
72059 int8_tArray  CS_LDK_ClaimedHTLC_get_channel_id(int64_t this_ptr) {
72060         LDKClaimedHTLC this_ptr_conv;
72061         this_ptr_conv.inner = untag_ptr(this_ptr);
72062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72064         this_ptr_conv.is_owned = false;
72065         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
72066         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
72067         return ret_arr;
72068 }
72069
72070 void  CS_LDK_ClaimedHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
72071         LDKClaimedHTLC this_ptr_conv;
72072         this_ptr_conv.inner = untag_ptr(this_ptr);
72073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72075         this_ptr_conv.is_owned = false;
72076         LDKThirtyTwoBytes val_ref;
72077         CHECK(val->arr_len == 32);
72078         memcpy(val_ref.data, val->elems, 32); FREE(val);
72079         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
72080 }
72081
72082 int8_tArray  CS_LDK_ClaimedHTLC_get_user_channel_id(int64_t this_ptr) {
72083         LDKClaimedHTLC this_ptr_conv;
72084         this_ptr_conv.inner = untag_ptr(this_ptr);
72085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72087         this_ptr_conv.is_owned = false;
72088         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
72089         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
72090         return ret_arr;
72091 }
72092
72093 void  CS_LDK_ClaimedHTLC_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
72094         LDKClaimedHTLC this_ptr_conv;
72095         this_ptr_conv.inner = untag_ptr(this_ptr);
72096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72098         this_ptr_conv.is_owned = false;
72099         LDKU128 val_ref;
72100         CHECK(val->arr_len == 16);
72101         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
72102         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
72103 }
72104
72105 int32_t  CS_LDK_ClaimedHTLC_get_cltv_expiry(int64_t this_ptr) {
72106         LDKClaimedHTLC this_ptr_conv;
72107         this_ptr_conv.inner = untag_ptr(this_ptr);
72108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72110         this_ptr_conv.is_owned = false;
72111         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
72112         return ret_conv;
72113 }
72114
72115 void  CS_LDK_ClaimedHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
72116         LDKClaimedHTLC this_ptr_conv;
72117         this_ptr_conv.inner = untag_ptr(this_ptr);
72118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72120         this_ptr_conv.is_owned = false;
72121         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
72122 }
72123
72124 int64_t  CS_LDK_ClaimedHTLC_get_value_msat(int64_t this_ptr) {
72125         LDKClaimedHTLC this_ptr_conv;
72126         this_ptr_conv.inner = untag_ptr(this_ptr);
72127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72129         this_ptr_conv.is_owned = false;
72130         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
72131         return ret_conv;
72132 }
72133
72134 void  CS_LDK_ClaimedHTLC_set_value_msat(int64_t this_ptr, int64_t val) {
72135         LDKClaimedHTLC this_ptr_conv;
72136         this_ptr_conv.inner = untag_ptr(this_ptr);
72137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72139         this_ptr_conv.is_owned = false;
72140         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
72141 }
72142
72143 int64_t  CS_LDK_ClaimedHTLC_get_counterparty_skimmed_fee_msat(int64_t this_ptr) {
72144         LDKClaimedHTLC this_ptr_conv;
72145         this_ptr_conv.inner = untag_ptr(this_ptr);
72146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72148         this_ptr_conv.is_owned = false;
72149         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
72150         return ret_conv;
72151 }
72152
72153 void  CS_LDK_ClaimedHTLC_set_counterparty_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
72154         LDKClaimedHTLC this_ptr_conv;
72155         this_ptr_conv.inner = untag_ptr(this_ptr);
72156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72158         this_ptr_conv.is_owned = false;
72159         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
72160 }
72161
72162 int64_t  CS_LDK_ClaimedHTLC_new(int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg, int64_t counterparty_skimmed_fee_msat_arg) {
72163         LDKThirtyTwoBytes channel_id_arg_ref;
72164         CHECK(channel_id_arg->arr_len == 32);
72165         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
72166         LDKU128 user_channel_id_arg_ref;
72167         CHECK(user_channel_id_arg->arr_len == 16);
72168         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
72169         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
72170         int64_t ret_ref = 0;
72171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72173         return ret_ref;
72174 }
72175
72176 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
72177         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
72178         int64_t ret_ref = 0;
72179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72181         return ret_ref;
72182 }
72183 int64_t  CS_LDK_ClaimedHTLC_clone_ptr(int64_t arg) {
72184         LDKClaimedHTLC arg_conv;
72185         arg_conv.inner = untag_ptr(arg);
72186         arg_conv.is_owned = ptr_is_owned(arg);
72187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72188         arg_conv.is_owned = false;
72189         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
72190         return ret_conv;
72191 }
72192
72193 int64_t  CS_LDK_ClaimedHTLC_clone(int64_t orig) {
72194         LDKClaimedHTLC orig_conv;
72195         orig_conv.inner = untag_ptr(orig);
72196         orig_conv.is_owned = ptr_is_owned(orig);
72197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72198         orig_conv.is_owned = false;
72199         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
72200         int64_t ret_ref = 0;
72201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72203         return ret_ref;
72204 }
72205
72206 jboolean  CS_LDK_ClaimedHTLC_eq(int64_t a, int64_t b) {
72207         LDKClaimedHTLC a_conv;
72208         a_conv.inner = untag_ptr(a);
72209         a_conv.is_owned = ptr_is_owned(a);
72210         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72211         a_conv.is_owned = false;
72212         LDKClaimedHTLC b_conv;
72213         b_conv.inner = untag_ptr(b);
72214         b_conv.is_owned = ptr_is_owned(b);
72215         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72216         b_conv.is_owned = false;
72217         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
72218         return ret_conv;
72219 }
72220
72221 int8_tArray  CS_LDK_ClaimedHTLC_write(int64_t obj) {
72222         LDKClaimedHTLC obj_conv;
72223         obj_conv.inner = untag_ptr(obj);
72224         obj_conv.is_owned = ptr_is_owned(obj);
72225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72226         obj_conv.is_owned = false;
72227         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
72228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72230         CVec_u8Z_free(ret_var);
72231         return ret_arr;
72232 }
72233
72234 int64_t  CS_LDK_ClaimedHTLC_read(int8_tArray ser) {
72235         LDKu8slice ser_ref;
72236         ser_ref.datalen = ser->arr_len;
72237         ser_ref.data = ser->elems;
72238         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
72239         *ret_conv = ClaimedHTLC_read(ser_ref);
72240         FREE(ser);
72241         return tag_ptr(ret_conv, true);
72242 }
72243
72244 void  CS_LDK_PathFailure_free(int64_t this_ptr) {
72245         if (!ptr_is_owned(this_ptr)) return;
72246         void* this_ptr_ptr = untag_ptr(this_ptr);
72247         CHECK_ACCESS(this_ptr_ptr);
72248         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
72249         FREE(untag_ptr(this_ptr));
72250         PathFailure_free(this_ptr_conv);
72251 }
72252
72253 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
72254         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72255         *ret_copy = PathFailure_clone(arg);
72256         int64_t ret_ref = tag_ptr(ret_copy, true);
72257         return ret_ref;
72258 }
72259 int64_t  CS_LDK_PathFailure_clone_ptr(int64_t arg) {
72260         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
72261         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
72262         return ret_conv;
72263 }
72264
72265 int64_t  CS_LDK_PathFailure_clone(int64_t orig) {
72266         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
72267         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72268         *ret_copy = PathFailure_clone(orig_conv);
72269         int64_t ret_ref = tag_ptr(ret_copy, true);
72270         return ret_ref;
72271 }
72272
72273 int64_t  CS_LDK_PathFailure_initial_send(int64_t err) {
72274         void* err_ptr = untag_ptr(err);
72275         CHECK_ACCESS(err_ptr);
72276         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
72277         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
72278         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72279         *ret_copy = PathFailure_initial_send(err_conv);
72280         int64_t ret_ref = tag_ptr(ret_copy, true);
72281         return ret_ref;
72282 }
72283
72284 int64_t  CS_LDK_PathFailure_on_path(int64_t network_update) {
72285         void* network_update_ptr = untag_ptr(network_update);
72286         CHECK_ACCESS(network_update_ptr);
72287         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
72288         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
72289         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72290         *ret_copy = PathFailure_on_path(network_update_conv);
72291         int64_t ret_ref = tag_ptr(ret_copy, true);
72292         return ret_ref;
72293 }
72294
72295 jboolean  CS_LDK_PathFailure_eq(int64_t a, int64_t b) {
72296         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
72297         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
72298         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
72299         return ret_conv;
72300 }
72301
72302 int8_tArray  CS_LDK_PathFailure_write(int64_t obj) {
72303         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
72304         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
72305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72307         CVec_u8Z_free(ret_var);
72308         return ret_arr;
72309 }
72310
72311 int64_t  CS_LDK_PathFailure_read(int8_tArray ser) {
72312         LDKu8slice ser_ref;
72313         ser_ref.datalen = ser->arr_len;
72314         ser_ref.data = ser->elems;
72315         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
72316         *ret_conv = PathFailure_read(ser_ref);
72317         FREE(ser);
72318         return tag_ptr(ret_conv, true);
72319 }
72320
72321 void  CS_LDK_ClosureReason_free(int64_t this_ptr) {
72322         if (!ptr_is_owned(this_ptr)) return;
72323         void* this_ptr_ptr = untag_ptr(this_ptr);
72324         CHECK_ACCESS(this_ptr_ptr);
72325         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
72326         FREE(untag_ptr(this_ptr));
72327         ClosureReason_free(this_ptr_conv);
72328 }
72329
72330 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
72331         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72332         *ret_copy = ClosureReason_clone(arg);
72333         int64_t ret_ref = tag_ptr(ret_copy, true);
72334         return ret_ref;
72335 }
72336 int64_t  CS_LDK_ClosureReason_clone_ptr(int64_t arg) {
72337         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
72338         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
72339         return ret_conv;
72340 }
72341
72342 int64_t  CS_LDK_ClosureReason_clone(int64_t orig) {
72343         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
72344         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72345         *ret_copy = ClosureReason_clone(orig_conv);
72346         int64_t ret_ref = tag_ptr(ret_copy, true);
72347         return ret_ref;
72348 }
72349
72350 int64_t  CS_LDK_ClosureReason_counterparty_force_closed(int64_t peer_msg) {
72351         LDKUntrustedString peer_msg_conv;
72352         peer_msg_conv.inner = untag_ptr(peer_msg);
72353         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
72354         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
72355         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
72356         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72357         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
72358         int64_t ret_ref = tag_ptr(ret_copy, true);
72359         return ret_ref;
72360 }
72361
72362 int64_t  CS_LDK_ClosureReason_holder_force_closed() {
72363         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72364         *ret_copy = ClosureReason_holder_force_closed();
72365         int64_t ret_ref = tag_ptr(ret_copy, true);
72366         return ret_ref;
72367 }
72368
72369 int64_t  CS_LDK_ClosureReason_cooperative_closure() {
72370         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72371         *ret_copy = ClosureReason_cooperative_closure();
72372         int64_t ret_ref = tag_ptr(ret_copy, true);
72373         return ret_ref;
72374 }
72375
72376 int64_t  CS_LDK_ClosureReason_commitment_tx_confirmed() {
72377         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72378         *ret_copy = ClosureReason_commitment_tx_confirmed();
72379         int64_t ret_ref = tag_ptr(ret_copy, true);
72380         return ret_ref;
72381 }
72382
72383 int64_t  CS_LDK_ClosureReason_funding_timed_out() {
72384         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72385         *ret_copy = ClosureReason_funding_timed_out();
72386         int64_t ret_ref = tag_ptr(ret_copy, true);
72387         return ret_ref;
72388 }
72389
72390 int64_t  CS_LDK_ClosureReason_processing_error(jstring err) {
72391         LDKStr err_conv = str_ref_to_owned_c(err);
72392         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72393         *ret_copy = ClosureReason_processing_error(err_conv);
72394         int64_t ret_ref = tag_ptr(ret_copy, true);
72395         return ret_ref;
72396 }
72397
72398 int64_t  CS_LDK_ClosureReason_disconnected_peer() {
72399         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72400         *ret_copy = ClosureReason_disconnected_peer();
72401         int64_t ret_ref = tag_ptr(ret_copy, true);
72402         return ret_ref;
72403 }
72404
72405 int64_t  CS_LDK_ClosureReason_outdated_channel_manager() {
72406         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72407         *ret_copy = ClosureReason_outdated_channel_manager();
72408         int64_t ret_ref = tag_ptr(ret_copy, true);
72409         return ret_ref;
72410 }
72411
72412 int64_t  CS_LDK_ClosureReason_counterparty_coop_closed_unfunded_channel() {
72413         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72414         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
72415         int64_t ret_ref = tag_ptr(ret_copy, true);
72416         return ret_ref;
72417 }
72418
72419 int64_t  CS_LDK_ClosureReason_funding_batch_closure() {
72420         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72421         *ret_copy = ClosureReason_funding_batch_closure();
72422         int64_t ret_ref = tag_ptr(ret_copy, true);
72423         return ret_ref;
72424 }
72425
72426 jboolean  CS_LDK_ClosureReason_eq(int64_t a, int64_t b) {
72427         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
72428         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
72429         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
72430         return ret_conv;
72431 }
72432
72433 int8_tArray  CS_LDK_ClosureReason_write(int64_t obj) {
72434         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
72435         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
72436         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72437         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72438         CVec_u8Z_free(ret_var);
72439         return ret_arr;
72440 }
72441
72442 int64_t  CS_LDK_ClosureReason_read(int8_tArray ser) {
72443         LDKu8slice ser_ref;
72444         ser_ref.datalen = ser->arr_len;
72445         ser_ref.data = ser->elems;
72446         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
72447         *ret_conv = ClosureReason_read(ser_ref);
72448         FREE(ser);
72449         return tag_ptr(ret_conv, true);
72450 }
72451
72452 void  CS_LDK_HTLCDestination_free(int64_t this_ptr) {
72453         if (!ptr_is_owned(this_ptr)) return;
72454         void* this_ptr_ptr = untag_ptr(this_ptr);
72455         CHECK_ACCESS(this_ptr_ptr);
72456         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
72457         FREE(untag_ptr(this_ptr));
72458         HTLCDestination_free(this_ptr_conv);
72459 }
72460
72461 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
72462         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72463         *ret_copy = HTLCDestination_clone(arg);
72464         int64_t ret_ref = tag_ptr(ret_copy, true);
72465         return ret_ref;
72466 }
72467 int64_t  CS_LDK_HTLCDestination_clone_ptr(int64_t arg) {
72468         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
72469         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
72470         return ret_conv;
72471 }
72472
72473 int64_t  CS_LDK_HTLCDestination_clone(int64_t orig) {
72474         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
72475         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72476         *ret_copy = HTLCDestination_clone(orig_conv);
72477         int64_t ret_ref = tag_ptr(ret_copy, true);
72478         return ret_ref;
72479 }
72480
72481 int64_t  CS_LDK_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
72482         LDKPublicKey node_id_ref;
72483         CHECK(node_id->arr_len == 33);
72484         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72485         LDKThirtyTwoBytes channel_id_ref;
72486         CHECK(channel_id->arr_len == 32);
72487         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72488         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72489         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
72490         int64_t ret_ref = tag_ptr(ret_copy, true);
72491         return ret_ref;
72492 }
72493
72494 int64_t  CS_LDK_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
72495         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72496         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
72497         int64_t ret_ref = tag_ptr(ret_copy, true);
72498         return ret_ref;
72499 }
72500
72501 int64_t  CS_LDK_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
72502         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72503         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
72504         int64_t ret_ref = tag_ptr(ret_copy, true);
72505         return ret_ref;
72506 }
72507
72508 int64_t  CS_LDK_HTLCDestination_failed_payment(int8_tArray payment_hash) {
72509         LDKThirtyTwoBytes payment_hash_ref;
72510         CHECK(payment_hash->arr_len == 32);
72511         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72512         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72513         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
72514         int64_t ret_ref = tag_ptr(ret_copy, true);
72515         return ret_ref;
72516 }
72517
72518 jboolean  CS_LDK_HTLCDestination_eq(int64_t a, int64_t b) {
72519         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
72520         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
72521         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
72522         return ret_conv;
72523 }
72524
72525 int8_tArray  CS_LDK_HTLCDestination_write(int64_t obj) {
72526         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
72527         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
72528         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72529         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72530         CVec_u8Z_free(ret_var);
72531         return ret_arr;
72532 }
72533
72534 int64_t  CS_LDK_HTLCDestination_read(int8_tArray ser) {
72535         LDKu8slice ser_ref;
72536         ser_ref.datalen = ser->arr_len;
72537         ser_ref.data = ser->elems;
72538         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
72539         *ret_conv = HTLCDestination_read(ser_ref);
72540         FREE(ser);
72541         return tag_ptr(ret_conv, true);
72542 }
72543
72544 int32_t  CS_LDK_PaymentFailureReason_clone(int64_t orig) {
72545         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
72546         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_clone(orig_conv));
72547         return ret_conv;
72548 }
72549
72550 int32_t  CS_LDK_PaymentFailureReason_recipient_rejected() {
72551         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_recipient_rejected());
72552         return ret_conv;
72553 }
72554
72555 int32_t  CS_LDK_PaymentFailureReason_user_abandoned() {
72556         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_user_abandoned());
72557         return ret_conv;
72558 }
72559
72560 int32_t  CS_LDK_PaymentFailureReason_retries_exhausted() {
72561         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_retries_exhausted());
72562         return ret_conv;
72563 }
72564
72565 int32_t  CS_LDK_PaymentFailureReason_payment_expired() {
72566         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_payment_expired());
72567         return ret_conv;
72568 }
72569
72570 int32_t  CS_LDK_PaymentFailureReason_route_not_found() {
72571         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_route_not_found());
72572         return ret_conv;
72573 }
72574
72575 int32_t  CS_LDK_PaymentFailureReason_unexpected_error() {
72576         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_unexpected_error());
72577         return ret_conv;
72578 }
72579
72580 jboolean  CS_LDK_PaymentFailureReason_eq(int64_t a, int64_t b) {
72581         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
72582         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
72583         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
72584         return ret_conv;
72585 }
72586
72587 int8_tArray  CS_LDK_PaymentFailureReason_write(int64_t obj) {
72588         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
72589         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
72590         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72591         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72592         CVec_u8Z_free(ret_var);
72593         return ret_arr;
72594 }
72595
72596 int64_t  CS_LDK_PaymentFailureReason_read(int8_tArray ser) {
72597         LDKu8slice ser_ref;
72598         ser_ref.datalen = ser->arr_len;
72599         ser_ref.data = ser->elems;
72600         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
72601         *ret_conv = PaymentFailureReason_read(ser_ref);
72602         FREE(ser);
72603         return tag_ptr(ret_conv, true);
72604 }
72605
72606 void  CS_LDK_Event_free(int64_t this_ptr) {
72607         if (!ptr_is_owned(this_ptr)) return;
72608         void* this_ptr_ptr = untag_ptr(this_ptr);
72609         CHECK_ACCESS(this_ptr_ptr);
72610         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
72611         FREE(untag_ptr(this_ptr));
72612         Event_free(this_ptr_conv);
72613 }
72614
72615 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
72616         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72617         *ret_copy = Event_clone(arg);
72618         int64_t ret_ref = tag_ptr(ret_copy, true);
72619         return ret_ref;
72620 }
72621 int64_t  CS_LDK_Event_clone_ptr(int64_t arg) {
72622         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
72623         int64_t ret_conv = Event_clone_ptr(arg_conv);
72624         return ret_conv;
72625 }
72626
72627 int64_t  CS_LDK_Event_clone(int64_t orig) {
72628         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
72629         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72630         *ret_copy = Event_clone(orig_conv);
72631         int64_t ret_ref = tag_ptr(ret_copy, true);
72632         return ret_ref;
72633 }
72634
72635 int64_t  CS_LDK_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
72636         LDKThirtyTwoBytes temporary_channel_id_ref;
72637         CHECK(temporary_channel_id->arr_len == 32);
72638         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
72639         LDKPublicKey counterparty_node_id_ref;
72640         CHECK(counterparty_node_id->arr_len == 33);
72641         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72642         LDKCVec_u8Z output_script_ref;
72643         output_script_ref.datalen = output_script->arr_len;
72644         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
72645         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
72646         LDKU128 user_channel_id_ref;
72647         CHECK(user_channel_id->arr_len == 16);
72648         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72649         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72650         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
72651         int64_t ret_ref = tag_ptr(ret_copy, true);
72652         return ret_ref;
72653 }
72654
72655 int64_t  CS_LDK_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, int64_t purpose, int64_t via_channel_id, int64_t via_user_channel_id, int64_t claim_deadline) {
72656         LDKPublicKey receiver_node_id_ref;
72657         CHECK(receiver_node_id->arr_len == 33);
72658         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72659         LDKThirtyTwoBytes payment_hash_ref;
72660         CHECK(payment_hash->arr_len == 32);
72661         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72662         LDKRecipientOnionFields onion_fields_conv;
72663         onion_fields_conv.inner = untag_ptr(onion_fields);
72664         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
72665         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
72666         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
72667         void* purpose_ptr = untag_ptr(purpose);
72668         CHECK_ACCESS(purpose_ptr);
72669         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72670         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72671         void* via_channel_id_ptr = untag_ptr(via_channel_id);
72672         CHECK_ACCESS(via_channel_id_ptr);
72673         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
72674         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
72675         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
72676         CHECK_ACCESS(via_user_channel_id_ptr);
72677         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
72678         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
72679         void* claim_deadline_ptr = untag_ptr(claim_deadline);
72680         CHECK_ACCESS(claim_deadline_ptr);
72681         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
72682         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
72683         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72684         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_conv, via_user_channel_id_conv, claim_deadline_conv);
72685         int64_t ret_ref = tag_ptr(ret_copy, true);
72686         return ret_ref;
72687 }
72688
72689 int64_t  CS_LDK_Event_payment_claimed(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose, int64_tArray htlcs, int64_t sender_intended_total_msat) {
72690         LDKPublicKey receiver_node_id_ref;
72691         CHECK(receiver_node_id->arr_len == 33);
72692         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72693         LDKThirtyTwoBytes payment_hash_ref;
72694         CHECK(payment_hash->arr_len == 32);
72695         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72696         void* purpose_ptr = untag_ptr(purpose);
72697         CHECK_ACCESS(purpose_ptr);
72698         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72699         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72700         LDKCVec_ClaimedHTLCZ htlcs_constr;
72701         htlcs_constr.datalen = htlcs->arr_len;
72702         if (htlcs_constr.datalen > 0)
72703                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
72704         else
72705                 htlcs_constr.data = NULL;
72706         int64_t* htlcs_vals = htlcs->elems;
72707         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
72708                 int64_t htlcs_conv_13 = htlcs_vals[n];
72709                 LDKClaimedHTLC htlcs_conv_13_conv;
72710                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
72711                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
72712                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
72713                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
72714                 htlcs_constr.data[n] = htlcs_conv_13_conv;
72715         }
72716         FREE(htlcs);
72717         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
72718         CHECK_ACCESS(sender_intended_total_msat_ptr);
72719         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
72720         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
72721         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72722         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
72723         int64_t ret_ref = tag_ptr(ret_copy, true);
72724         return ret_ref;
72725 }
72726
72727 int64_t  CS_LDK_Event_connection_needed(int8_tArray node_id, int64_tArray addresses) {
72728         LDKPublicKey node_id_ref;
72729         CHECK(node_id->arr_len == 33);
72730         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72731         LDKCVec_SocketAddressZ addresses_constr;
72732         addresses_constr.datalen = addresses->arr_len;
72733         if (addresses_constr.datalen > 0)
72734                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
72735         else
72736                 addresses_constr.data = NULL;
72737         int64_t* addresses_vals = addresses->elems;
72738         for (size_t p = 0; p < addresses_constr.datalen; p++) {
72739                 int64_t addresses_conv_15 = addresses_vals[p];
72740                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
72741                 CHECK_ACCESS(addresses_conv_15_ptr);
72742                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
72743                 addresses_constr.data[p] = addresses_conv_15_conv;
72744         }
72745         FREE(addresses);
72746         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72747         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
72748         int64_t ret_ref = tag_ptr(ret_copy, true);
72749         return ret_ref;
72750 }
72751
72752 int64_t  CS_LDK_Event_invoice_request_failed(int8_tArray payment_id) {
72753         LDKThirtyTwoBytes payment_id_ref;
72754         CHECK(payment_id->arr_len == 32);
72755         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72756         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72757         *ret_copy = Event_invoice_request_failed(payment_id_ref);
72758         int64_t ret_ref = tag_ptr(ret_copy, true);
72759         return ret_ref;
72760 }
72761
72762 int64_t  CS_LDK_Event_payment_sent(int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
72763         void* payment_id_ptr = untag_ptr(payment_id);
72764         CHECK_ACCESS(payment_id_ptr);
72765         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72766         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72767         LDKThirtyTwoBytes payment_preimage_ref;
72768         CHECK(payment_preimage->arr_len == 32);
72769         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
72770         LDKThirtyTwoBytes payment_hash_ref;
72771         CHECK(payment_hash->arr_len == 32);
72772         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72773         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
72774         CHECK_ACCESS(fee_paid_msat_ptr);
72775         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
72776         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
72777         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72778         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
72779         int64_t ret_ref = tag_ptr(ret_copy, true);
72780         return ret_ref;
72781 }
72782
72783 int64_t  CS_LDK_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t reason) {
72784         LDKThirtyTwoBytes payment_id_ref;
72785         CHECK(payment_id->arr_len == 32);
72786         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72787         LDKThirtyTwoBytes payment_hash_ref;
72788         CHECK(payment_hash->arr_len == 32);
72789         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72790         void* reason_ptr = untag_ptr(reason);
72791         CHECK_ACCESS(reason_ptr);
72792         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
72793         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
72794         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72795         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
72796         int64_t ret_ref = tag_ptr(ret_copy, true);
72797         return ret_ref;
72798 }
72799
72800 int64_t  CS_LDK_Event_payment_path_successful(int8_tArray payment_id, int64_t payment_hash, int64_t path) {
72801         LDKThirtyTwoBytes payment_id_ref;
72802         CHECK(payment_id->arr_len == 32);
72803         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72804         void* payment_hash_ptr = untag_ptr(payment_hash);
72805         CHECK_ACCESS(payment_hash_ptr);
72806         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
72807         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
72808         LDKPath path_conv;
72809         path_conv.inner = untag_ptr(path);
72810         path_conv.is_owned = ptr_is_owned(path);
72811         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72812         path_conv = Path_clone(&path_conv);
72813         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72814         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
72815         int64_t ret_ref = tag_ptr(ret_copy, true);
72816         return ret_ref;
72817 }
72818
72819 int64_t  CS_LDK_Event_payment_path_failed(int64_t payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_t path, int64_t short_channel_id) {
72820         void* payment_id_ptr = untag_ptr(payment_id);
72821         CHECK_ACCESS(payment_id_ptr);
72822         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72823         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72824         LDKThirtyTwoBytes payment_hash_ref;
72825         CHECK(payment_hash->arr_len == 32);
72826         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72827         void* failure_ptr = untag_ptr(failure);
72828         CHECK_ACCESS(failure_ptr);
72829         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
72830         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
72831         LDKPath path_conv;
72832         path_conv.inner = untag_ptr(path);
72833         path_conv.is_owned = ptr_is_owned(path);
72834         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72835         path_conv = Path_clone(&path_conv);
72836         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72837         CHECK_ACCESS(short_channel_id_ptr);
72838         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72839         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72840         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72841         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
72842         int64_t ret_ref = tag_ptr(ret_copy, true);
72843         return ret_ref;
72844 }
72845
72846 int64_t  CS_LDK_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, int64_t path) {
72847         LDKThirtyTwoBytes payment_id_ref;
72848         CHECK(payment_id->arr_len == 32);
72849         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72850         LDKThirtyTwoBytes payment_hash_ref;
72851         CHECK(payment_hash->arr_len == 32);
72852         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72853         LDKPath path_conv;
72854         path_conv.inner = untag_ptr(path);
72855         path_conv.is_owned = ptr_is_owned(path);
72856         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72857         path_conv = Path_clone(&path_conv);
72858         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72859         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
72860         int64_t ret_ref = tag_ptr(ret_copy, true);
72861         return ret_ref;
72862 }
72863
72864 int64_t  CS_LDK_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t path, int64_t short_channel_id) {
72865         LDKThirtyTwoBytes payment_id_ref;
72866         CHECK(payment_id->arr_len == 32);
72867         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72868         LDKThirtyTwoBytes payment_hash_ref;
72869         CHECK(payment_hash->arr_len == 32);
72870         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72871         LDKPath path_conv;
72872         path_conv.inner = untag_ptr(path);
72873         path_conv.is_owned = ptr_is_owned(path);
72874         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72875         path_conv = Path_clone(&path_conv);
72876         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72877         CHECK_ACCESS(short_channel_id_ptr);
72878         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72879         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72880         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72881         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
72882         int64_t ret_ref = tag_ptr(ret_copy, true);
72883         return ret_ref;
72884 }
72885
72886 int64_t  CS_LDK_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
72887         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72888         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
72889         int64_t ret_ref = tag_ptr(ret_copy, true);
72890         return ret_ref;
72891 }
72892
72893 int64_t  CS_LDK_Event_htlcintercepted(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) {
72894         LDKThirtyTwoBytes intercept_id_ref;
72895         CHECK(intercept_id->arr_len == 32);
72896         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
72897         LDKThirtyTwoBytes payment_hash_ref;
72898         CHECK(payment_hash->arr_len == 32);
72899         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72900         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72901         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
72902         int64_t ret_ref = tag_ptr(ret_copy, true);
72903         return ret_ref;
72904 }
72905
72906 int64_t  CS_LDK_Event_spendable_outputs(int64_tArray outputs, int64_t channel_id) {
72907         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
72908         outputs_constr.datalen = outputs->arr_len;
72909         if (outputs_constr.datalen > 0)
72910                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
72911         else
72912                 outputs_constr.data = NULL;
72913         int64_t* outputs_vals = outputs->elems;
72914         for (size_t b = 0; b < outputs_constr.datalen; b++) {
72915                 int64_t outputs_conv_27 = outputs_vals[b];
72916                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
72917                 CHECK_ACCESS(outputs_conv_27_ptr);
72918                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
72919                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
72920                 outputs_constr.data[b] = outputs_conv_27_conv;
72921         }
72922         FREE(outputs);
72923         void* channel_id_ptr = untag_ptr(channel_id);
72924         CHECK_ACCESS(channel_id_ptr);
72925         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
72926         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
72927         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72928         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
72929         int64_t ret_ref = tag_ptr(ret_copy, true);
72930         return ret_ref;
72931 }
72932
72933 int64_t  CS_LDK_Event_payment_forwarded(int64_t prev_channel_id, int64_t next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
72934         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
72935         CHECK_ACCESS(prev_channel_id_ptr);
72936         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
72937         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
72938         void* next_channel_id_ptr = untag_ptr(next_channel_id);
72939         CHECK_ACCESS(next_channel_id_ptr);
72940         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
72941         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
72942         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
72943         CHECK_ACCESS(fee_earned_msat_ptr);
72944         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
72945         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
72946         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
72947         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
72948         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
72949         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
72950         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72951         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
72952         int64_t ret_ref = tag_ptr(ret_copy, true);
72953         return ret_ref;
72954 }
72955
72956 int64_t  CS_LDK_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo) {
72957         LDKThirtyTwoBytes channel_id_ref;
72958         CHECK(channel_id->arr_len == 32);
72959         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72960         LDKU128 user_channel_id_ref;
72961         CHECK(user_channel_id->arr_len == 16);
72962         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72963         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
72964         CHECK_ACCESS(former_temporary_channel_id_ptr);
72965         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
72966         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
72967         LDKPublicKey counterparty_node_id_ref;
72968         CHECK(counterparty_node_id->arr_len == 33);
72969         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72970         LDKOutPoint funding_txo_conv;
72971         funding_txo_conv.inner = untag_ptr(funding_txo);
72972         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
72973         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
72974         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
72975         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72976         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
72977         int64_t ret_ref = tag_ptr(ret_copy, true);
72978         return ret_ref;
72979 }
72980
72981 int64_t  CS_LDK_Event_channel_ready(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
72982         LDKThirtyTwoBytes channel_id_ref;
72983         CHECK(channel_id->arr_len == 32);
72984         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72985         LDKU128 user_channel_id_ref;
72986         CHECK(user_channel_id->arr_len == 16);
72987         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72988         LDKPublicKey counterparty_node_id_ref;
72989         CHECK(counterparty_node_id->arr_len == 33);
72990         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72991         LDKChannelTypeFeatures channel_type_conv;
72992         channel_type_conv.inner = untag_ptr(channel_type);
72993         channel_type_conv.is_owned = ptr_is_owned(channel_type);
72994         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
72995         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
72996         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72997         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
72998         int64_t ret_ref = tag_ptr(ret_copy, true);
72999         return ret_ref;
73000 }
73001
73002 int64_t  CS_LDK_Event_channel_closed(int8_tArray channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats, int64_t channel_funding_txo) {
73003         LDKThirtyTwoBytes channel_id_ref;
73004         CHECK(channel_id->arr_len == 32);
73005         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
73006         LDKU128 user_channel_id_ref;
73007         CHECK(user_channel_id->arr_len == 16);
73008         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
73009         void* reason_ptr = untag_ptr(reason);
73010         CHECK_ACCESS(reason_ptr);
73011         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
73012         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
73013         LDKPublicKey counterparty_node_id_ref;
73014         CHECK(counterparty_node_id->arr_len == 33);
73015         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
73016         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
73017         CHECK_ACCESS(channel_capacity_sats_ptr);
73018         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
73019         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
73020         LDKOutPoint channel_funding_txo_conv;
73021         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
73022         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
73023         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
73024         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
73025         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73026         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
73027         int64_t ret_ref = tag_ptr(ret_copy, true);
73028         return ret_ref;
73029 }
73030
73031 int64_t  CS_LDK_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
73032         LDKThirtyTwoBytes channel_id_ref;
73033         CHECK(channel_id->arr_len == 32);
73034         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
73035         LDKTransaction transaction_ref;
73036         transaction_ref.datalen = transaction->arr_len;
73037         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
73038         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
73039         transaction_ref.data_is_owned = true;
73040         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73041         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
73042         int64_t ret_ref = tag_ptr(ret_copy, true);
73043         return ret_ref;
73044 }
73045
73046 int64_t  CS_LDK_Event_open_channel_request(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
73047         LDKThirtyTwoBytes temporary_channel_id_ref;
73048         CHECK(temporary_channel_id->arr_len == 32);
73049         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
73050         LDKPublicKey counterparty_node_id_ref;
73051         CHECK(counterparty_node_id->arr_len == 33);
73052         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
73053         LDKChannelTypeFeatures channel_type_conv;
73054         channel_type_conv.inner = untag_ptr(channel_type);
73055         channel_type_conv.is_owned = ptr_is_owned(channel_type);
73056         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
73057         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
73058         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73059         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
73060         int64_t ret_ref = tag_ptr(ret_copy, true);
73061         return ret_ref;
73062 }
73063
73064 int64_t  CS_LDK_Event_htlchandling_failed(int8_tArray prev_channel_id, int64_t failed_next_destination) {
73065         LDKThirtyTwoBytes prev_channel_id_ref;
73066         CHECK(prev_channel_id->arr_len == 32);
73067         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
73068         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
73069         CHECK_ACCESS(failed_next_destination_ptr);
73070         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
73071         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
73072         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73073         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
73074         int64_t ret_ref = tag_ptr(ret_copy, true);
73075         return ret_ref;
73076 }
73077
73078 int64_t  CS_LDK_Event_bump_transaction(int64_t a) {
73079         void* a_ptr = untag_ptr(a);
73080         CHECK_ACCESS(a_ptr);
73081         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
73082         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
73083         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73084         *ret_copy = Event_bump_transaction(a_conv);
73085         int64_t ret_ref = tag_ptr(ret_copy, true);
73086         return ret_ref;
73087 }
73088
73089 jboolean  CS_LDK_Event_eq(int64_t a, int64_t b) {
73090         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
73091         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
73092         jboolean ret_conv = Event_eq(a_conv, b_conv);
73093         return ret_conv;
73094 }
73095
73096 int8_tArray  CS_LDK_Event_write(int64_t obj) {
73097         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
73098         LDKCVec_u8Z ret_var = Event_write(obj_conv);
73099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73101         CVec_u8Z_free(ret_var);
73102         return ret_arr;
73103 }
73104
73105 int64_t  CS_LDK_Event_read(int8_tArray ser) {
73106         LDKu8slice ser_ref;
73107         ser_ref.datalen = ser->arr_len;
73108         ser_ref.data = ser->elems;
73109         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
73110         *ret_conv = Event_read(ser_ref);
73111         FREE(ser);
73112         return tag_ptr(ret_conv, true);
73113 }
73114
73115 void  CS_LDK_MessageSendEvent_free(int64_t this_ptr) {
73116         if (!ptr_is_owned(this_ptr)) return;
73117         void* this_ptr_ptr = untag_ptr(this_ptr);
73118         CHECK_ACCESS(this_ptr_ptr);
73119         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
73120         FREE(untag_ptr(this_ptr));
73121         MessageSendEvent_free(this_ptr_conv);
73122 }
73123
73124 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
73125         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73126         *ret_copy = MessageSendEvent_clone(arg);
73127         int64_t ret_ref = tag_ptr(ret_copy, true);
73128         return ret_ref;
73129 }
73130 int64_t  CS_LDK_MessageSendEvent_clone_ptr(int64_t arg) {
73131         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
73132         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
73133         return ret_conv;
73134 }
73135
73136 int64_t  CS_LDK_MessageSendEvent_clone(int64_t orig) {
73137         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
73138         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73139         *ret_copy = MessageSendEvent_clone(orig_conv);
73140         int64_t ret_ref = tag_ptr(ret_copy, true);
73141         return ret_ref;
73142 }
73143
73144 int64_t  CS_LDK_MessageSendEvent_send_accept_channel(int8_tArray node_id, int64_t msg) {
73145         LDKPublicKey node_id_ref;
73146         CHECK(node_id->arr_len == 33);
73147         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73148         LDKAcceptChannel msg_conv;
73149         msg_conv.inner = untag_ptr(msg);
73150         msg_conv.is_owned = ptr_is_owned(msg);
73151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73152         msg_conv = AcceptChannel_clone(&msg_conv);
73153         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73154         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
73155         int64_t ret_ref = tag_ptr(ret_copy, true);
73156         return ret_ref;
73157 }
73158
73159 int64_t  CS_LDK_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, int64_t msg) {
73160         LDKPublicKey node_id_ref;
73161         CHECK(node_id->arr_len == 33);
73162         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73163         LDKAcceptChannelV2 msg_conv;
73164         msg_conv.inner = untag_ptr(msg);
73165         msg_conv.is_owned = ptr_is_owned(msg);
73166         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73167         msg_conv = AcceptChannelV2_clone(&msg_conv);
73168         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73169         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
73170         int64_t ret_ref = tag_ptr(ret_copy, true);
73171         return ret_ref;
73172 }
73173
73174 int64_t  CS_LDK_MessageSendEvent_send_open_channel(int8_tArray node_id, int64_t msg) {
73175         LDKPublicKey node_id_ref;
73176         CHECK(node_id->arr_len == 33);
73177         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73178         LDKOpenChannel msg_conv;
73179         msg_conv.inner = untag_ptr(msg);
73180         msg_conv.is_owned = ptr_is_owned(msg);
73181         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73182         msg_conv = OpenChannel_clone(&msg_conv);
73183         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73184         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
73185         int64_t ret_ref = tag_ptr(ret_copy, true);
73186         return ret_ref;
73187 }
73188
73189 int64_t  CS_LDK_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, int64_t msg) {
73190         LDKPublicKey node_id_ref;
73191         CHECK(node_id->arr_len == 33);
73192         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73193         LDKOpenChannelV2 msg_conv;
73194         msg_conv.inner = untag_ptr(msg);
73195         msg_conv.is_owned = ptr_is_owned(msg);
73196         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73197         msg_conv = OpenChannelV2_clone(&msg_conv);
73198         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73199         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
73200         int64_t ret_ref = tag_ptr(ret_copy, true);
73201         return ret_ref;
73202 }
73203
73204 int64_t  CS_LDK_MessageSendEvent_send_funding_created(int8_tArray node_id, int64_t msg) {
73205         LDKPublicKey node_id_ref;
73206         CHECK(node_id->arr_len == 33);
73207         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73208         LDKFundingCreated msg_conv;
73209         msg_conv.inner = untag_ptr(msg);
73210         msg_conv.is_owned = ptr_is_owned(msg);
73211         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73212         msg_conv = FundingCreated_clone(&msg_conv);
73213         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73214         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
73215         int64_t ret_ref = tag_ptr(ret_copy, true);
73216         return ret_ref;
73217 }
73218
73219 int64_t  CS_LDK_MessageSendEvent_send_funding_signed(int8_tArray node_id, int64_t msg) {
73220         LDKPublicKey node_id_ref;
73221         CHECK(node_id->arr_len == 33);
73222         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73223         LDKFundingSigned msg_conv;
73224         msg_conv.inner = untag_ptr(msg);
73225         msg_conv.is_owned = ptr_is_owned(msg);
73226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73227         msg_conv = FundingSigned_clone(&msg_conv);
73228         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73229         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
73230         int64_t ret_ref = tag_ptr(ret_copy, true);
73231         return ret_ref;
73232 }
73233
73234 int64_t  CS_LDK_MessageSendEvent_send_stfu(int8_tArray node_id, int64_t msg) {
73235         LDKPublicKey node_id_ref;
73236         CHECK(node_id->arr_len == 33);
73237         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73238         LDKStfu msg_conv;
73239         msg_conv.inner = untag_ptr(msg);
73240         msg_conv.is_owned = ptr_is_owned(msg);
73241         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73242         msg_conv = Stfu_clone(&msg_conv);
73243         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73244         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
73245         int64_t ret_ref = tag_ptr(ret_copy, true);
73246         return ret_ref;
73247 }
73248
73249 int64_t  CS_LDK_MessageSendEvent_send_splice(int8_tArray node_id, int64_t msg) {
73250         LDKPublicKey node_id_ref;
73251         CHECK(node_id->arr_len == 33);
73252         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73253         LDKSplice msg_conv;
73254         msg_conv.inner = untag_ptr(msg);
73255         msg_conv.is_owned = ptr_is_owned(msg);
73256         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73257         msg_conv = Splice_clone(&msg_conv);
73258         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73259         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
73260         int64_t ret_ref = tag_ptr(ret_copy, true);
73261         return ret_ref;
73262 }
73263
73264 int64_t  CS_LDK_MessageSendEvent_send_splice_ack(int8_tArray node_id, int64_t msg) {
73265         LDKPublicKey node_id_ref;
73266         CHECK(node_id->arr_len == 33);
73267         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73268         LDKSpliceAck msg_conv;
73269         msg_conv.inner = untag_ptr(msg);
73270         msg_conv.is_owned = ptr_is_owned(msg);
73271         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73272         msg_conv = SpliceAck_clone(&msg_conv);
73273         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73274         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
73275         int64_t ret_ref = tag_ptr(ret_copy, true);
73276         return ret_ref;
73277 }
73278
73279 int64_t  CS_LDK_MessageSendEvent_send_splice_locked(int8_tArray node_id, int64_t msg) {
73280         LDKPublicKey node_id_ref;
73281         CHECK(node_id->arr_len == 33);
73282         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73283         LDKSpliceLocked msg_conv;
73284         msg_conv.inner = untag_ptr(msg);
73285         msg_conv.is_owned = ptr_is_owned(msg);
73286         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73287         msg_conv = SpliceLocked_clone(&msg_conv);
73288         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73289         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
73290         int64_t ret_ref = tag_ptr(ret_copy, true);
73291         return ret_ref;
73292 }
73293
73294 int64_t  CS_LDK_MessageSendEvent_send_tx_add_input(int8_tArray node_id, int64_t msg) {
73295         LDKPublicKey node_id_ref;
73296         CHECK(node_id->arr_len == 33);
73297         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73298         LDKTxAddInput msg_conv;
73299         msg_conv.inner = untag_ptr(msg);
73300         msg_conv.is_owned = ptr_is_owned(msg);
73301         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73302         msg_conv = TxAddInput_clone(&msg_conv);
73303         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73304         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
73305         int64_t ret_ref = tag_ptr(ret_copy, true);
73306         return ret_ref;
73307 }
73308
73309 int64_t  CS_LDK_MessageSendEvent_send_tx_add_output(int8_tArray node_id, int64_t msg) {
73310         LDKPublicKey node_id_ref;
73311         CHECK(node_id->arr_len == 33);
73312         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73313         LDKTxAddOutput msg_conv;
73314         msg_conv.inner = untag_ptr(msg);
73315         msg_conv.is_owned = ptr_is_owned(msg);
73316         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73317         msg_conv = TxAddOutput_clone(&msg_conv);
73318         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73319         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
73320         int64_t ret_ref = tag_ptr(ret_copy, true);
73321         return ret_ref;
73322 }
73323
73324 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, int64_t msg) {
73325         LDKPublicKey node_id_ref;
73326         CHECK(node_id->arr_len == 33);
73327         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73328         LDKTxRemoveInput msg_conv;
73329         msg_conv.inner = untag_ptr(msg);
73330         msg_conv.is_owned = ptr_is_owned(msg);
73331         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73332         msg_conv = TxRemoveInput_clone(&msg_conv);
73333         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73334         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
73335         int64_t ret_ref = tag_ptr(ret_copy, true);
73336         return ret_ref;
73337 }
73338
73339 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, int64_t msg) {
73340         LDKPublicKey node_id_ref;
73341         CHECK(node_id->arr_len == 33);
73342         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73343         LDKTxRemoveOutput msg_conv;
73344         msg_conv.inner = untag_ptr(msg);
73345         msg_conv.is_owned = ptr_is_owned(msg);
73346         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73347         msg_conv = TxRemoveOutput_clone(&msg_conv);
73348         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73349         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
73350         int64_t ret_ref = tag_ptr(ret_copy, true);
73351         return ret_ref;
73352 }
73353
73354 int64_t  CS_LDK_MessageSendEvent_send_tx_complete(int8_tArray node_id, int64_t msg) {
73355         LDKPublicKey node_id_ref;
73356         CHECK(node_id->arr_len == 33);
73357         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73358         LDKTxComplete msg_conv;
73359         msg_conv.inner = untag_ptr(msg);
73360         msg_conv.is_owned = ptr_is_owned(msg);
73361         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73362         msg_conv = TxComplete_clone(&msg_conv);
73363         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73364         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
73365         int64_t ret_ref = tag_ptr(ret_copy, true);
73366         return ret_ref;
73367 }
73368
73369 int64_t  CS_LDK_MessageSendEvent_send_tx_signatures(int8_tArray node_id, int64_t msg) {
73370         LDKPublicKey node_id_ref;
73371         CHECK(node_id->arr_len == 33);
73372         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73373         LDKTxSignatures msg_conv;
73374         msg_conv.inner = untag_ptr(msg);
73375         msg_conv.is_owned = ptr_is_owned(msg);
73376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73377         msg_conv = TxSignatures_clone(&msg_conv);
73378         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73379         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
73380         int64_t ret_ref = tag_ptr(ret_copy, true);
73381         return ret_ref;
73382 }
73383
73384 int64_t  CS_LDK_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, int64_t msg) {
73385         LDKPublicKey node_id_ref;
73386         CHECK(node_id->arr_len == 33);
73387         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73388         LDKTxInitRbf msg_conv;
73389         msg_conv.inner = untag_ptr(msg);
73390         msg_conv.is_owned = ptr_is_owned(msg);
73391         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73392         msg_conv = TxInitRbf_clone(&msg_conv);
73393         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73394         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
73395         int64_t ret_ref = tag_ptr(ret_copy, true);
73396         return ret_ref;
73397 }
73398
73399 int64_t  CS_LDK_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, int64_t msg) {
73400         LDKPublicKey node_id_ref;
73401         CHECK(node_id->arr_len == 33);
73402         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73403         LDKTxAckRbf msg_conv;
73404         msg_conv.inner = untag_ptr(msg);
73405         msg_conv.is_owned = ptr_is_owned(msg);
73406         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73407         msg_conv = TxAckRbf_clone(&msg_conv);
73408         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73409         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
73410         int64_t ret_ref = tag_ptr(ret_copy, true);
73411         return ret_ref;
73412 }
73413
73414 int64_t  CS_LDK_MessageSendEvent_send_tx_abort(int8_tArray node_id, int64_t msg) {
73415         LDKPublicKey node_id_ref;
73416         CHECK(node_id->arr_len == 33);
73417         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73418         LDKTxAbort msg_conv;
73419         msg_conv.inner = untag_ptr(msg);
73420         msg_conv.is_owned = ptr_is_owned(msg);
73421         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73422         msg_conv = TxAbort_clone(&msg_conv);
73423         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73424         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
73425         int64_t ret_ref = tag_ptr(ret_copy, true);
73426         return ret_ref;
73427 }
73428
73429 int64_t  CS_LDK_MessageSendEvent_send_channel_ready(int8_tArray node_id, int64_t msg) {
73430         LDKPublicKey node_id_ref;
73431         CHECK(node_id->arr_len == 33);
73432         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73433         LDKChannelReady msg_conv;
73434         msg_conv.inner = untag_ptr(msg);
73435         msg_conv.is_owned = ptr_is_owned(msg);
73436         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73437         msg_conv = ChannelReady_clone(&msg_conv);
73438         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73439         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
73440         int64_t ret_ref = tag_ptr(ret_copy, true);
73441         return ret_ref;
73442 }
73443
73444 int64_t  CS_LDK_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, int64_t msg) {
73445         LDKPublicKey node_id_ref;
73446         CHECK(node_id->arr_len == 33);
73447         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73448         LDKAnnouncementSignatures msg_conv;
73449         msg_conv.inner = untag_ptr(msg);
73450         msg_conv.is_owned = ptr_is_owned(msg);
73451         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73452         msg_conv = AnnouncementSignatures_clone(&msg_conv);
73453         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73454         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
73455         int64_t ret_ref = tag_ptr(ret_copy, true);
73456         return ret_ref;
73457 }
73458
73459 int64_t  CS_LDK_MessageSendEvent_update_htlcs(int8_tArray node_id, int64_t updates) {
73460         LDKPublicKey node_id_ref;
73461         CHECK(node_id->arr_len == 33);
73462         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73463         LDKCommitmentUpdate updates_conv;
73464         updates_conv.inner = untag_ptr(updates);
73465         updates_conv.is_owned = ptr_is_owned(updates);
73466         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
73467         updates_conv = CommitmentUpdate_clone(&updates_conv);
73468         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73469         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
73470         int64_t ret_ref = tag_ptr(ret_copy, true);
73471         return ret_ref;
73472 }
73473
73474 int64_t  CS_LDK_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, int64_t msg) {
73475         LDKPublicKey node_id_ref;
73476         CHECK(node_id->arr_len == 33);
73477         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73478         LDKRevokeAndACK msg_conv;
73479         msg_conv.inner = untag_ptr(msg);
73480         msg_conv.is_owned = ptr_is_owned(msg);
73481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73482         msg_conv = RevokeAndACK_clone(&msg_conv);
73483         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73484         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
73485         int64_t ret_ref = tag_ptr(ret_copy, true);
73486         return ret_ref;
73487 }
73488
73489 int64_t  CS_LDK_MessageSendEvent_send_closing_signed(int8_tArray node_id, int64_t msg) {
73490         LDKPublicKey node_id_ref;
73491         CHECK(node_id->arr_len == 33);
73492         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73493         LDKClosingSigned msg_conv;
73494         msg_conv.inner = untag_ptr(msg);
73495         msg_conv.is_owned = ptr_is_owned(msg);
73496         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73497         msg_conv = ClosingSigned_clone(&msg_conv);
73498         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73499         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
73500         int64_t ret_ref = tag_ptr(ret_copy, true);
73501         return ret_ref;
73502 }
73503
73504 int64_t  CS_LDK_MessageSendEvent_send_shutdown(int8_tArray node_id, int64_t msg) {
73505         LDKPublicKey node_id_ref;
73506         CHECK(node_id->arr_len == 33);
73507         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73508         LDKShutdown msg_conv;
73509         msg_conv.inner = untag_ptr(msg);
73510         msg_conv.is_owned = ptr_is_owned(msg);
73511         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73512         msg_conv = Shutdown_clone(&msg_conv);
73513         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73514         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
73515         int64_t ret_ref = tag_ptr(ret_copy, true);
73516         return ret_ref;
73517 }
73518
73519 int64_t  CS_LDK_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, int64_t msg) {
73520         LDKPublicKey node_id_ref;
73521         CHECK(node_id->arr_len == 33);
73522         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73523         LDKChannelReestablish msg_conv;
73524         msg_conv.inner = untag_ptr(msg);
73525         msg_conv.is_owned = ptr_is_owned(msg);
73526         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73527         msg_conv = ChannelReestablish_clone(&msg_conv);
73528         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73529         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
73530         int64_t ret_ref = tag_ptr(ret_copy, true);
73531         return ret_ref;
73532 }
73533
73534 int64_t  CS_LDK_MessageSendEvent_send_channel_announcement(int8_tArray node_id, int64_t msg, int64_t update_msg) {
73535         LDKPublicKey node_id_ref;
73536         CHECK(node_id->arr_len == 33);
73537         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73538         LDKChannelAnnouncement msg_conv;
73539         msg_conv.inner = untag_ptr(msg);
73540         msg_conv.is_owned = ptr_is_owned(msg);
73541         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73542         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73543         LDKChannelUpdate update_msg_conv;
73544         update_msg_conv.inner = untag_ptr(update_msg);
73545         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73546         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73547         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73548         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73549         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
73550         int64_t ret_ref = tag_ptr(ret_copy, true);
73551         return ret_ref;
73552 }
73553
73554 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_announcement(int64_t msg, int64_t update_msg) {
73555         LDKChannelAnnouncement msg_conv;
73556         msg_conv.inner = untag_ptr(msg);
73557         msg_conv.is_owned = ptr_is_owned(msg);
73558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73559         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73560         LDKChannelUpdate update_msg_conv;
73561         update_msg_conv.inner = untag_ptr(update_msg);
73562         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73563         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73564         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73565         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73566         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
73567         int64_t ret_ref = tag_ptr(ret_copy, true);
73568         return ret_ref;
73569 }
73570
73571 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_update(int64_t msg) {
73572         LDKChannelUpdate msg_conv;
73573         msg_conv.inner = untag_ptr(msg);
73574         msg_conv.is_owned = ptr_is_owned(msg);
73575         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73576         msg_conv = ChannelUpdate_clone(&msg_conv);
73577         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73578         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
73579         int64_t ret_ref = tag_ptr(ret_copy, true);
73580         return ret_ref;
73581 }
73582
73583 int64_t  CS_LDK_MessageSendEvent_broadcast_node_announcement(int64_t msg) {
73584         LDKNodeAnnouncement msg_conv;
73585         msg_conv.inner = untag_ptr(msg);
73586         msg_conv.is_owned = ptr_is_owned(msg);
73587         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73588         msg_conv = NodeAnnouncement_clone(&msg_conv);
73589         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73590         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
73591         int64_t ret_ref = tag_ptr(ret_copy, true);
73592         return ret_ref;
73593 }
73594
73595 int64_t  CS_LDK_MessageSendEvent_send_channel_update(int8_tArray node_id, int64_t msg) {
73596         LDKPublicKey node_id_ref;
73597         CHECK(node_id->arr_len == 33);
73598         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73599         LDKChannelUpdate msg_conv;
73600         msg_conv.inner = untag_ptr(msg);
73601         msg_conv.is_owned = ptr_is_owned(msg);
73602         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73603         msg_conv = ChannelUpdate_clone(&msg_conv);
73604         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73605         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
73606         int64_t ret_ref = tag_ptr(ret_copy, true);
73607         return ret_ref;
73608 }
73609
73610 int64_t  CS_LDK_MessageSendEvent_handle_error(int8_tArray node_id, int64_t action) {
73611         LDKPublicKey node_id_ref;
73612         CHECK(node_id->arr_len == 33);
73613         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73614         void* action_ptr = untag_ptr(action);
73615         CHECK_ACCESS(action_ptr);
73616         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
73617         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
73618         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73619         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
73620         int64_t ret_ref = tag_ptr(ret_copy, true);
73621         return ret_ref;
73622 }
73623
73624 int64_t  CS_LDK_MessageSendEvent_send_channel_range_query(int8_tArray node_id, int64_t msg) {
73625         LDKPublicKey node_id_ref;
73626         CHECK(node_id->arr_len == 33);
73627         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73628         LDKQueryChannelRange msg_conv;
73629         msg_conv.inner = untag_ptr(msg);
73630         msg_conv.is_owned = ptr_is_owned(msg);
73631         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73632         msg_conv = QueryChannelRange_clone(&msg_conv);
73633         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73634         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
73635         int64_t ret_ref = tag_ptr(ret_copy, true);
73636         return ret_ref;
73637 }
73638
73639 int64_t  CS_LDK_MessageSendEvent_send_short_ids_query(int8_tArray node_id, int64_t msg) {
73640         LDKPublicKey node_id_ref;
73641         CHECK(node_id->arr_len == 33);
73642         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73643         LDKQueryShortChannelIds msg_conv;
73644         msg_conv.inner = untag_ptr(msg);
73645         msg_conv.is_owned = ptr_is_owned(msg);
73646         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73647         msg_conv = QueryShortChannelIds_clone(&msg_conv);
73648         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73649         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
73650         int64_t ret_ref = tag_ptr(ret_copy, true);
73651         return ret_ref;
73652 }
73653
73654 int64_t  CS_LDK_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, int64_t msg) {
73655         LDKPublicKey node_id_ref;
73656         CHECK(node_id->arr_len == 33);
73657         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73658         LDKReplyChannelRange msg_conv;
73659         msg_conv.inner = untag_ptr(msg);
73660         msg_conv.is_owned = ptr_is_owned(msg);
73661         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73662         msg_conv = ReplyChannelRange_clone(&msg_conv);
73663         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73664         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
73665         int64_t ret_ref = tag_ptr(ret_copy, true);
73666         return ret_ref;
73667 }
73668
73669 int64_t  CS_LDK_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, int64_t msg) {
73670         LDKPublicKey node_id_ref;
73671         CHECK(node_id->arr_len == 33);
73672         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73673         LDKGossipTimestampFilter msg_conv;
73674         msg_conv.inner = untag_ptr(msg);
73675         msg_conv.is_owned = ptr_is_owned(msg);
73676         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73677         msg_conv = GossipTimestampFilter_clone(&msg_conv);
73678         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73679         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
73680         int64_t ret_ref = tag_ptr(ret_copy, true);
73681         return ret_ref;
73682 }
73683
73684 void  CS_LDK_MessageSendEventsProvider_free(int64_t this_ptr) {
73685         if (!ptr_is_owned(this_ptr)) return;
73686         void* this_ptr_ptr = untag_ptr(this_ptr);
73687         CHECK_ACCESS(this_ptr_ptr);
73688         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
73689         FREE(untag_ptr(this_ptr));
73690         MessageSendEventsProvider_free(this_ptr_conv);
73691 }
73692
73693 void  CS_LDK_EventsProvider_free(int64_t this_ptr) {
73694         if (!ptr_is_owned(this_ptr)) return;
73695         void* this_ptr_ptr = untag_ptr(this_ptr);
73696         CHECK_ACCESS(this_ptr_ptr);
73697         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
73698         FREE(untag_ptr(this_ptr));
73699         EventsProvider_free(this_ptr_conv);
73700 }
73701
73702 void  CS_LDK_EventHandler_free(int64_t this_ptr) {
73703         if (!ptr_is_owned(this_ptr)) return;
73704         void* this_ptr_ptr = untag_ptr(this_ptr);
73705         CHECK_ACCESS(this_ptr_ptr);
73706         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
73707         FREE(untag_ptr(this_ptr));
73708         EventHandler_free(this_ptr_conv);
73709 }
73710
73711 void  CS_LDK_AnchorDescriptor_free(int64_t this_obj) {
73712         LDKAnchorDescriptor this_obj_conv;
73713         this_obj_conv.inner = untag_ptr(this_obj);
73714         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73716         AnchorDescriptor_free(this_obj_conv);
73717 }
73718
73719 int64_t  CS_LDK_AnchorDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
73720         LDKAnchorDescriptor this_ptr_conv;
73721         this_ptr_conv.inner = untag_ptr(this_ptr);
73722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73724         this_ptr_conv.is_owned = false;
73725         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
73726         int64_t ret_ref = 0;
73727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73729         return ret_ref;
73730 }
73731
73732 void  CS_LDK_AnchorDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
73733         LDKAnchorDescriptor this_ptr_conv;
73734         this_ptr_conv.inner = untag_ptr(this_ptr);
73735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73737         this_ptr_conv.is_owned = false;
73738         LDKChannelDerivationParameters val_conv;
73739         val_conv.inner = untag_ptr(val);
73740         val_conv.is_owned = ptr_is_owned(val);
73741         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73742         val_conv = ChannelDerivationParameters_clone(&val_conv);
73743         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
73744 }
73745
73746 int64_t  CS_LDK_AnchorDescriptor_get_outpoint(int64_t this_ptr) {
73747         LDKAnchorDescriptor this_ptr_conv;
73748         this_ptr_conv.inner = untag_ptr(this_ptr);
73749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73751         this_ptr_conv.is_owned = false;
73752         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
73753         int64_t ret_ref = 0;
73754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73756         return ret_ref;
73757 }
73758
73759 void  CS_LDK_AnchorDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
73760         LDKAnchorDescriptor this_ptr_conv;
73761         this_ptr_conv.inner = untag_ptr(this_ptr);
73762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73764         this_ptr_conv.is_owned = false;
73765         LDKOutPoint val_conv;
73766         val_conv.inner = untag_ptr(val);
73767         val_conv.is_owned = ptr_is_owned(val);
73768         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73769         val_conv = OutPoint_clone(&val_conv);
73770         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73771 }
73772
73773 int64_t  CS_LDK_AnchorDescriptor_new(int64_t channel_derivation_parameters_arg, int64_t outpoint_arg) {
73774         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
73775         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
73776         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
73777         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
73778         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
73779         LDKOutPoint outpoint_arg_conv;
73780         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73781         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73782         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73783         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73784         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
73785         int64_t ret_ref = 0;
73786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73788         return ret_ref;
73789 }
73790
73791 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
73792         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
73793         int64_t ret_ref = 0;
73794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73796         return ret_ref;
73797 }
73798 int64_t  CS_LDK_AnchorDescriptor_clone_ptr(int64_t arg) {
73799         LDKAnchorDescriptor arg_conv;
73800         arg_conv.inner = untag_ptr(arg);
73801         arg_conv.is_owned = ptr_is_owned(arg);
73802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73803         arg_conv.is_owned = false;
73804         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
73805         return ret_conv;
73806 }
73807
73808 int64_t  CS_LDK_AnchorDescriptor_clone(int64_t orig) {
73809         LDKAnchorDescriptor orig_conv;
73810         orig_conv.inner = untag_ptr(orig);
73811         orig_conv.is_owned = ptr_is_owned(orig);
73812         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73813         orig_conv.is_owned = false;
73814         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
73815         int64_t ret_ref = 0;
73816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73818         return ret_ref;
73819 }
73820
73821 jboolean  CS_LDK_AnchorDescriptor_eq(int64_t a, int64_t b) {
73822         LDKAnchorDescriptor a_conv;
73823         a_conv.inner = untag_ptr(a);
73824         a_conv.is_owned = ptr_is_owned(a);
73825         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73826         a_conv.is_owned = false;
73827         LDKAnchorDescriptor b_conv;
73828         b_conv.inner = untag_ptr(b);
73829         b_conv.is_owned = ptr_is_owned(b);
73830         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73831         b_conv.is_owned = false;
73832         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
73833         return ret_conv;
73834 }
73835
73836 int64_t  CS_LDK_AnchorDescriptor_previous_utxo(int64_t this_arg) {
73837         LDKAnchorDescriptor this_arg_conv;
73838         this_arg_conv.inner = untag_ptr(this_arg);
73839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73841         this_arg_conv.is_owned = false;
73842         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73843         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
73844         return tag_ptr(ret_ref, true);
73845 }
73846
73847 int64_t  CS_LDK_AnchorDescriptor_unsigned_tx_input(int64_t this_arg) {
73848         LDKAnchorDescriptor this_arg_conv;
73849         this_arg_conv.inner = untag_ptr(this_arg);
73850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73852         this_arg_conv.is_owned = false;
73853         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
73854         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
73855         return tag_ptr(ret_ref, true);
73856 }
73857
73858 int8_tArray  CS_LDK_AnchorDescriptor_witness_script(int64_t this_arg) {
73859         LDKAnchorDescriptor this_arg_conv;
73860         this_arg_conv.inner = untag_ptr(this_arg);
73861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73863         this_arg_conv.is_owned = false;
73864         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
73865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73867         CVec_u8Z_free(ret_var);
73868         return ret_arr;
73869 }
73870
73871 int8_tArray  CS_LDK_AnchorDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature) {
73872         LDKAnchorDescriptor this_arg_conv;
73873         this_arg_conv.inner = untag_ptr(this_arg);
73874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73876         this_arg_conv.is_owned = false;
73877         LDKECDSASignature signature_ref;
73878         CHECK(signature->arr_len == 64);
73879         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
73880         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
73881         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73882         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73883         Witness_free(ret_var);
73884         return ret_arr;
73885 }
73886
73887 int64_t  CS_LDK_AnchorDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
73888         LDKAnchorDescriptor this_arg_conv;
73889         this_arg_conv.inner = untag_ptr(this_arg);
73890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73892         this_arg_conv.is_owned = false;
73893         void* signer_provider_ptr = untag_ptr(signer_provider);
73894         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
73895         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
73896         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
73897         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
73898         return tag_ptr(ret_ret, true);
73899 }
73900
73901 void  CS_LDK_BumpTransactionEvent_free(int64_t this_ptr) {
73902         if (!ptr_is_owned(this_ptr)) return;
73903         void* this_ptr_ptr = untag_ptr(this_ptr);
73904         CHECK_ACCESS(this_ptr_ptr);
73905         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
73906         FREE(untag_ptr(this_ptr));
73907         BumpTransactionEvent_free(this_ptr_conv);
73908 }
73909
73910 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
73911         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73912         *ret_copy = BumpTransactionEvent_clone(arg);
73913         int64_t ret_ref = tag_ptr(ret_copy, true);
73914         return ret_ref;
73915 }
73916 int64_t  CS_LDK_BumpTransactionEvent_clone_ptr(int64_t arg) {
73917         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
73918         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
73919         return ret_conv;
73920 }
73921
73922 int64_t  CS_LDK_BumpTransactionEvent_clone(int64_t orig) {
73923         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
73924         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73925         *ret_copy = BumpTransactionEvent_clone(orig_conv);
73926         int64_t ret_ref = tag_ptr(ret_copy, true);
73927         return ret_ref;
73928 }
73929
73930 int64_t  CS_LDK_BumpTransactionEvent_channel_close(int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, int64_t anchor_descriptor, int64_tArray pending_htlcs) {
73931         LDKThirtyTwoBytes claim_id_ref;
73932         CHECK(claim_id->arr_len == 32);
73933         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73934         LDKTransaction commitment_tx_ref;
73935         commitment_tx_ref.datalen = commitment_tx->arr_len;
73936         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
73937         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
73938         commitment_tx_ref.data_is_owned = true;
73939         LDKAnchorDescriptor anchor_descriptor_conv;
73940         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
73941         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
73942         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
73943         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
73944         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
73945         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
73946         if (pending_htlcs_constr.datalen > 0)
73947                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
73948         else
73949                 pending_htlcs_constr.data = NULL;
73950         int64_t* pending_htlcs_vals = pending_htlcs->elems;
73951         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
73952                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
73953                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
73954                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
73955                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
73956                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
73957                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
73958                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
73959         }
73960         FREE(pending_htlcs);
73961         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73962         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
73963         int64_t ret_ref = tag_ptr(ret_copy, true);
73964         return ret_ref;
73965 }
73966
73967 int64_t  CS_LDK_BumpTransactionEvent_htlcresolution(int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
73968         LDKThirtyTwoBytes claim_id_ref;
73969         CHECK(claim_id->arr_len == 32);
73970         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73971         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
73972         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
73973         if (htlc_descriptors_constr.datalen > 0)
73974                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
73975         else
73976                 htlc_descriptors_constr.data = NULL;
73977         int64_t* htlc_descriptors_vals = htlc_descriptors->elems;
73978         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
73979                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
73980                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
73981                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
73982                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
73983                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
73984                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
73985                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
73986         }
73987         FREE(htlc_descriptors);
73988         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73989         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
73990         int64_t ret_ref = tag_ptr(ret_copy, true);
73991         return ret_ref;
73992 }
73993
73994 jboolean  CS_LDK_BumpTransactionEvent_eq(int64_t a, int64_t b) {
73995         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
73996         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
73997         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
73998         return ret_conv;
73999 }
74000
74001 void  CS_LDK_Input_free(int64_t this_obj) {
74002         LDKInput this_obj_conv;
74003         this_obj_conv.inner = untag_ptr(this_obj);
74004         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74006         Input_free(this_obj_conv);
74007 }
74008
74009 int64_t  CS_LDK_Input_get_outpoint(int64_t this_ptr) {
74010         LDKInput this_ptr_conv;
74011         this_ptr_conv.inner = untag_ptr(this_ptr);
74012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74014         this_ptr_conv.is_owned = false;
74015         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
74016         int64_t ret_ref = 0;
74017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74019         return ret_ref;
74020 }
74021
74022 void  CS_LDK_Input_set_outpoint(int64_t this_ptr, int64_t val) {
74023         LDKInput this_ptr_conv;
74024         this_ptr_conv.inner = untag_ptr(this_ptr);
74025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74027         this_ptr_conv.is_owned = false;
74028         LDKOutPoint val_conv;
74029         val_conv.inner = untag_ptr(val);
74030         val_conv.is_owned = ptr_is_owned(val);
74031         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74032         val_conv = OutPoint_clone(&val_conv);
74033         Input_set_outpoint(&this_ptr_conv, val_conv);
74034 }
74035
74036 int64_t  CS_LDK_Input_get_previous_utxo(int64_t this_ptr) {
74037         LDKInput this_ptr_conv;
74038         this_ptr_conv.inner = untag_ptr(this_ptr);
74039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74041         this_ptr_conv.is_owned = false;
74042         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74043         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
74044         return tag_ptr(ret_ref, true);
74045 }
74046
74047 void  CS_LDK_Input_set_previous_utxo(int64_t this_ptr, int64_t val) {
74048         LDKInput this_ptr_conv;
74049         this_ptr_conv.inner = untag_ptr(this_ptr);
74050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74052         this_ptr_conv.is_owned = false;
74053         void* val_ptr = untag_ptr(val);
74054         CHECK_ACCESS(val_ptr);
74055         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
74056         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
74057         Input_set_previous_utxo(&this_ptr_conv, val_conv);
74058 }
74059
74060 int64_t  CS_LDK_Input_get_satisfaction_weight(int64_t this_ptr) {
74061         LDKInput this_ptr_conv;
74062         this_ptr_conv.inner = untag_ptr(this_ptr);
74063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74065         this_ptr_conv.is_owned = false;
74066         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
74067         return ret_conv;
74068 }
74069
74070 void  CS_LDK_Input_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
74071         LDKInput this_ptr_conv;
74072         this_ptr_conv.inner = untag_ptr(this_ptr);
74073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74075         this_ptr_conv.is_owned = false;
74076         Input_set_satisfaction_weight(&this_ptr_conv, val);
74077 }
74078
74079 int64_t  CS_LDK_Input_new(int64_t outpoint_arg, int64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
74080         LDKOutPoint outpoint_arg_conv;
74081         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
74082         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
74083         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
74084         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
74085         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
74086         CHECK_ACCESS(previous_utxo_arg_ptr);
74087         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
74088         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
74089         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
74090         int64_t ret_ref = 0;
74091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74093         return ret_ref;
74094 }
74095
74096 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
74097         LDKInput ret_var = Input_clone(arg);
74098         int64_t ret_ref = 0;
74099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74101         return ret_ref;
74102 }
74103 int64_t  CS_LDK_Input_clone_ptr(int64_t arg) {
74104         LDKInput arg_conv;
74105         arg_conv.inner = untag_ptr(arg);
74106         arg_conv.is_owned = ptr_is_owned(arg);
74107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74108         arg_conv.is_owned = false;
74109         int64_t ret_conv = Input_clone_ptr(&arg_conv);
74110         return ret_conv;
74111 }
74112
74113 int64_t  CS_LDK_Input_clone(int64_t orig) {
74114         LDKInput orig_conv;
74115         orig_conv.inner = untag_ptr(orig);
74116         orig_conv.is_owned = ptr_is_owned(orig);
74117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74118         orig_conv.is_owned = false;
74119         LDKInput ret_var = Input_clone(&orig_conv);
74120         int64_t ret_ref = 0;
74121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74123         return ret_ref;
74124 }
74125
74126 int64_t  CS_LDK_Input_hash(int64_t o) {
74127         LDKInput o_conv;
74128         o_conv.inner = untag_ptr(o);
74129         o_conv.is_owned = ptr_is_owned(o);
74130         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74131         o_conv.is_owned = false;
74132         int64_t ret_conv = Input_hash(&o_conv);
74133         return ret_conv;
74134 }
74135
74136 jboolean  CS_LDK_Input_eq(int64_t a, int64_t b) {
74137         LDKInput a_conv;
74138         a_conv.inner = untag_ptr(a);
74139         a_conv.is_owned = ptr_is_owned(a);
74140         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74141         a_conv.is_owned = false;
74142         LDKInput b_conv;
74143         b_conv.inner = untag_ptr(b);
74144         b_conv.is_owned = ptr_is_owned(b);
74145         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74146         b_conv.is_owned = false;
74147         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
74148         return ret_conv;
74149 }
74150
74151 void  CS_LDK_Utxo_free(int64_t this_obj) {
74152         LDKUtxo this_obj_conv;
74153         this_obj_conv.inner = untag_ptr(this_obj);
74154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74156         Utxo_free(this_obj_conv);
74157 }
74158
74159 int64_t  CS_LDK_Utxo_get_outpoint(int64_t this_ptr) {
74160         LDKUtxo this_ptr_conv;
74161         this_ptr_conv.inner = untag_ptr(this_ptr);
74162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74164         this_ptr_conv.is_owned = false;
74165         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
74166         int64_t ret_ref = 0;
74167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74169         return ret_ref;
74170 }
74171
74172 void  CS_LDK_Utxo_set_outpoint(int64_t this_ptr, int64_t val) {
74173         LDKUtxo this_ptr_conv;
74174         this_ptr_conv.inner = untag_ptr(this_ptr);
74175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74177         this_ptr_conv.is_owned = false;
74178         LDKOutPoint val_conv;
74179         val_conv.inner = untag_ptr(val);
74180         val_conv.is_owned = ptr_is_owned(val);
74181         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74182         val_conv = OutPoint_clone(&val_conv);
74183         Utxo_set_outpoint(&this_ptr_conv, val_conv);
74184 }
74185
74186 int64_t  CS_LDK_Utxo_get_output(int64_t this_ptr) {
74187         LDKUtxo this_ptr_conv;
74188         this_ptr_conv.inner = untag_ptr(this_ptr);
74189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74191         this_ptr_conv.is_owned = false;
74192         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74193         *ret_ref = Utxo_get_output(&this_ptr_conv);
74194         return tag_ptr(ret_ref, true);
74195 }
74196
74197 void  CS_LDK_Utxo_set_output(int64_t this_ptr, int64_t val) {
74198         LDKUtxo this_ptr_conv;
74199         this_ptr_conv.inner = untag_ptr(this_ptr);
74200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74202         this_ptr_conv.is_owned = false;
74203         void* val_ptr = untag_ptr(val);
74204         CHECK_ACCESS(val_ptr);
74205         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
74206         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
74207         Utxo_set_output(&this_ptr_conv, val_conv);
74208 }
74209
74210 int64_t  CS_LDK_Utxo_get_satisfaction_weight(int64_t this_ptr) {
74211         LDKUtxo this_ptr_conv;
74212         this_ptr_conv.inner = untag_ptr(this_ptr);
74213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74215         this_ptr_conv.is_owned = false;
74216         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
74217         return ret_conv;
74218 }
74219
74220 void  CS_LDK_Utxo_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
74221         LDKUtxo this_ptr_conv;
74222         this_ptr_conv.inner = untag_ptr(this_ptr);
74223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74225         this_ptr_conv.is_owned = false;
74226         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
74227 }
74228
74229 int64_t  CS_LDK_Utxo_new(int64_t outpoint_arg, int64_t output_arg, int64_t satisfaction_weight_arg) {
74230         LDKOutPoint outpoint_arg_conv;
74231         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
74232         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
74233         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
74234         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
74235         void* output_arg_ptr = untag_ptr(output_arg);
74236         CHECK_ACCESS(output_arg_ptr);
74237         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
74238         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
74239         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
74240         int64_t ret_ref = 0;
74241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74243         return ret_ref;
74244 }
74245
74246 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
74247         LDKUtxo ret_var = Utxo_clone(arg);
74248         int64_t ret_ref = 0;
74249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74251         return ret_ref;
74252 }
74253 int64_t  CS_LDK_Utxo_clone_ptr(int64_t arg) {
74254         LDKUtxo arg_conv;
74255         arg_conv.inner = untag_ptr(arg);
74256         arg_conv.is_owned = ptr_is_owned(arg);
74257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74258         arg_conv.is_owned = false;
74259         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
74260         return ret_conv;
74261 }
74262
74263 int64_t  CS_LDK_Utxo_clone(int64_t orig) {
74264         LDKUtxo orig_conv;
74265         orig_conv.inner = untag_ptr(orig);
74266         orig_conv.is_owned = ptr_is_owned(orig);
74267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74268         orig_conv.is_owned = false;
74269         LDKUtxo ret_var = Utxo_clone(&orig_conv);
74270         int64_t ret_ref = 0;
74271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74273         return ret_ref;
74274 }
74275
74276 int64_t  CS_LDK_Utxo_hash(int64_t o) {
74277         LDKUtxo o_conv;
74278         o_conv.inner = untag_ptr(o);
74279         o_conv.is_owned = ptr_is_owned(o);
74280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74281         o_conv.is_owned = false;
74282         int64_t ret_conv = Utxo_hash(&o_conv);
74283         return ret_conv;
74284 }
74285
74286 jboolean  CS_LDK_Utxo_eq(int64_t a, int64_t b) {
74287         LDKUtxo a_conv;
74288         a_conv.inner = untag_ptr(a);
74289         a_conv.is_owned = ptr_is_owned(a);
74290         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74291         a_conv.is_owned = false;
74292         LDKUtxo b_conv;
74293         b_conv.inner = untag_ptr(b);
74294         b_conv.is_owned = ptr_is_owned(b);
74295         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74296         b_conv.is_owned = false;
74297         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
74298         return ret_conv;
74299 }
74300
74301 int64_t  CS_LDK_Utxo_new_p2pkh(int64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
74302         LDKOutPoint outpoint_conv;
74303         outpoint_conv.inner = untag_ptr(outpoint);
74304         outpoint_conv.is_owned = ptr_is_owned(outpoint);
74305         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
74306         outpoint_conv = OutPoint_clone(&outpoint_conv);
74307         uint8_t pubkey_hash_arr[20];
74308         CHECK(pubkey_hash->arr_len == 20);
74309         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
74310         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
74311         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
74312         int64_t ret_ref = 0;
74313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74315         return ret_ref;
74316 }
74317
74318 void  CS_LDK_CoinSelection_free(int64_t this_obj) {
74319         LDKCoinSelection this_obj_conv;
74320         this_obj_conv.inner = untag_ptr(this_obj);
74321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74323         CoinSelection_free(this_obj_conv);
74324 }
74325
74326 int64_tArray  CS_LDK_CoinSelection_get_confirmed_utxos(int64_t this_ptr) {
74327         LDKCoinSelection this_ptr_conv;
74328         this_ptr_conv.inner = untag_ptr(this_ptr);
74329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74331         this_ptr_conv.is_owned = false;
74332         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
74333         int64_tArray ret_arr = NULL;
74334         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
74335         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
74336         for (size_t g = 0; g < ret_var.datalen; g++) {
74337                 LDKUtxo ret_conv_6_var = ret_var.data[g];
74338                 int64_t ret_conv_6_ref = 0;
74339                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
74340                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
74341                 ret_arr_ptr[g] = ret_conv_6_ref;
74342         }
74343         
74344         FREE(ret_var.data);
74345         return ret_arr;
74346 }
74347
74348 void  CS_LDK_CoinSelection_set_confirmed_utxos(int64_t this_ptr, int64_tArray val) {
74349         LDKCoinSelection this_ptr_conv;
74350         this_ptr_conv.inner = untag_ptr(this_ptr);
74351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74353         this_ptr_conv.is_owned = false;
74354         LDKCVec_UtxoZ val_constr;
74355         val_constr.datalen = val->arr_len;
74356         if (val_constr.datalen > 0)
74357                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
74358         else
74359                 val_constr.data = NULL;
74360         int64_t* val_vals = val->elems;
74361         for (size_t g = 0; g < val_constr.datalen; g++) {
74362                 int64_t val_conv_6 = val_vals[g];
74363                 LDKUtxo val_conv_6_conv;
74364                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
74365                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
74366                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
74367                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
74368                 val_constr.data[g] = val_conv_6_conv;
74369         }
74370         FREE(val);
74371         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
74372 }
74373
74374 int64_t  CS_LDK_CoinSelection_get_change_output(int64_t this_ptr) {
74375         LDKCoinSelection this_ptr_conv;
74376         this_ptr_conv.inner = untag_ptr(this_ptr);
74377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74379         this_ptr_conv.is_owned = false;
74380         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
74381         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
74382         int64_t ret_ref = tag_ptr(ret_copy, true);
74383         return ret_ref;
74384 }
74385
74386 void  CS_LDK_CoinSelection_set_change_output(int64_t this_ptr, int64_t val) {
74387         LDKCoinSelection this_ptr_conv;
74388         this_ptr_conv.inner = untag_ptr(this_ptr);
74389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74391         this_ptr_conv.is_owned = false;
74392         void* val_ptr = untag_ptr(val);
74393         CHECK_ACCESS(val_ptr);
74394         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
74395         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
74396         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
74397 }
74398
74399 int64_t  CS_LDK_CoinSelection_new(int64_tArray confirmed_utxos_arg, int64_t change_output_arg) {
74400         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
74401         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
74402         if (confirmed_utxos_arg_constr.datalen > 0)
74403                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
74404         else
74405                 confirmed_utxos_arg_constr.data = NULL;
74406         int64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
74407         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
74408                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
74409                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
74410                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
74411                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
74412                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
74413                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
74414                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
74415         }
74416         FREE(confirmed_utxos_arg);
74417         void* change_output_arg_ptr = untag_ptr(change_output_arg);
74418         CHECK_ACCESS(change_output_arg_ptr);
74419         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
74420         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
74421         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
74422         int64_t ret_ref = 0;
74423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74425         return ret_ref;
74426 }
74427
74428 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
74429         LDKCoinSelection ret_var = CoinSelection_clone(arg);
74430         int64_t ret_ref = 0;
74431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74433         return ret_ref;
74434 }
74435 int64_t  CS_LDK_CoinSelection_clone_ptr(int64_t arg) {
74436         LDKCoinSelection arg_conv;
74437         arg_conv.inner = untag_ptr(arg);
74438         arg_conv.is_owned = ptr_is_owned(arg);
74439         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74440         arg_conv.is_owned = false;
74441         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
74442         return ret_conv;
74443 }
74444
74445 int64_t  CS_LDK_CoinSelection_clone(int64_t orig) {
74446         LDKCoinSelection orig_conv;
74447         orig_conv.inner = untag_ptr(orig);
74448         orig_conv.is_owned = ptr_is_owned(orig);
74449         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74450         orig_conv.is_owned = false;
74451         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
74452         int64_t ret_ref = 0;
74453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74455         return ret_ref;
74456 }
74457
74458 void  CS_LDK_CoinSelectionSource_free(int64_t this_ptr) {
74459         if (!ptr_is_owned(this_ptr)) return;
74460         void* this_ptr_ptr = untag_ptr(this_ptr);
74461         CHECK_ACCESS(this_ptr_ptr);
74462         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
74463         FREE(untag_ptr(this_ptr));
74464         CoinSelectionSource_free(this_ptr_conv);
74465 }
74466
74467 void  CS_LDK_WalletSource_free(int64_t this_ptr) {
74468         if (!ptr_is_owned(this_ptr)) return;
74469         void* this_ptr_ptr = untag_ptr(this_ptr);
74470         CHECK_ACCESS(this_ptr_ptr);
74471         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
74472         FREE(untag_ptr(this_ptr));
74473         WalletSource_free(this_ptr_conv);
74474 }
74475
74476 void  CS_LDK_Wallet_free(int64_t this_obj) {
74477         LDKWallet this_obj_conv;
74478         this_obj_conv.inner = untag_ptr(this_obj);
74479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74481         Wallet_free(this_obj_conv);
74482 }
74483
74484 int64_t  CS_LDK_Wallet_new(int64_t source, int64_t logger) {
74485         void* source_ptr = untag_ptr(source);
74486         CHECK_ACCESS(source_ptr);
74487         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
74488         if (source_conv.free == LDKWalletSource_JCalls_free) {
74489                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74490                 LDKWalletSource_JCalls_cloned(&source_conv);
74491         }
74492         void* logger_ptr = untag_ptr(logger);
74493         CHECK_ACCESS(logger_ptr);
74494         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74495         if (logger_conv.free == LDKLogger_JCalls_free) {
74496                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74497                 LDKLogger_JCalls_cloned(&logger_conv);
74498         }
74499         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
74500         int64_t ret_ref = 0;
74501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74503         return ret_ref;
74504 }
74505
74506 int64_t  CS_LDK_Wallet_as_CoinSelectionSource(int64_t this_arg) {
74507         LDKWallet this_arg_conv;
74508         this_arg_conv.inner = untag_ptr(this_arg);
74509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74511         this_arg_conv.is_owned = false;
74512         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
74513         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
74514         return tag_ptr(ret_ret, true);
74515 }
74516
74517 void  CS_LDK_BumpTransactionEventHandler_free(int64_t this_obj) {
74518         LDKBumpTransactionEventHandler this_obj_conv;
74519         this_obj_conv.inner = untag_ptr(this_obj);
74520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74522         BumpTransactionEventHandler_free(this_obj_conv);
74523 }
74524
74525 int64_t  CS_LDK_BumpTransactionEventHandler_new(int64_t broadcaster, int64_t utxo_source, int64_t signer_provider, int64_t logger) {
74526         void* broadcaster_ptr = untag_ptr(broadcaster);
74527         CHECK_ACCESS(broadcaster_ptr);
74528         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
74529         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
74530                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74531                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
74532         }
74533         void* utxo_source_ptr = untag_ptr(utxo_source);
74534         CHECK_ACCESS(utxo_source_ptr);
74535         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
74536         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
74537                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74538                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
74539         }
74540         void* signer_provider_ptr = untag_ptr(signer_provider);
74541         CHECK_ACCESS(signer_provider_ptr);
74542         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
74543         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
74544                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74545                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
74546         }
74547         void* logger_ptr = untag_ptr(logger);
74548         CHECK_ACCESS(logger_ptr);
74549         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74550         if (logger_conv.free == LDKLogger_JCalls_free) {
74551                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74552                 LDKLogger_JCalls_cloned(&logger_conv);
74553         }
74554         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
74555         int64_t ret_ref = 0;
74556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74558         return ret_ref;
74559 }
74560
74561 void  CS_LDK_BumpTransactionEventHandler_handle_event(int64_t this_arg, int64_t event) {
74562         LDKBumpTransactionEventHandler this_arg_conv;
74563         this_arg_conv.inner = untag_ptr(this_arg);
74564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74566         this_arg_conv.is_owned = false;
74567         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
74568         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
74569 }
74570
74571 void  CS_LDK_FilesystemStore_free(int64_t this_obj) {
74572         LDKFilesystemStore this_obj_conv;
74573         this_obj_conv.inner = untag_ptr(this_obj);
74574         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74576         FilesystemStore_free(this_obj_conv);
74577 }
74578
74579 int64_t  CS_LDK_FilesystemStore_new(jstring data_dir) {
74580         LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
74581         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
74582         int64_t ret_ref = 0;
74583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74585         return ret_ref;
74586 }
74587
74588 jstring  CS_LDK_FilesystemStore_get_data_dir(int64_t this_arg) {
74589         LDKFilesystemStore this_arg_conv;
74590         this_arg_conv.inner = untag_ptr(this_arg);
74591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74593         this_arg_conv.is_owned = false;
74594         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
74595         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
74596         Str_free(ret_str);
74597         return ret_conv;
74598 }
74599
74600 int64_t  CS_LDK_FilesystemStore_as_KVStore(int64_t this_arg) {
74601         LDKFilesystemStore this_arg_conv;
74602         this_arg_conv.inner = untag_ptr(this_arg);
74603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74605         this_arg_conv.is_owned = false;
74606         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
74607         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
74608         return tag_ptr(ret_ret, true);
74609 }
74610
74611 void  CS_LDK_BackgroundProcessor_free(int64_t this_obj) {
74612         LDKBackgroundProcessor this_obj_conv;
74613         this_obj_conv.inner = untag_ptr(this_obj);
74614         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74616         BackgroundProcessor_free(this_obj_conv);
74617 }
74618
74619 void  CS_LDK_GossipSync_free(int64_t this_ptr) {
74620         if (!ptr_is_owned(this_ptr)) return;
74621         void* this_ptr_ptr = untag_ptr(this_ptr);
74622         CHECK_ACCESS(this_ptr_ptr);
74623         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
74624         FREE(untag_ptr(this_ptr));
74625         GossipSync_free(this_ptr_conv);
74626 }
74627
74628 int64_t  CS_LDK_GossipSync_p2_p(int64_t a) {
74629         LDKP2PGossipSync a_conv;
74630         a_conv.inner = untag_ptr(a);
74631         a_conv.is_owned = ptr_is_owned(a);
74632         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74633         a_conv.is_owned = false;
74634         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74635         *ret_copy = GossipSync_p2_p(&a_conv);
74636         int64_t ret_ref = tag_ptr(ret_copy, true);
74637         return ret_ref;
74638 }
74639
74640 int64_t  CS_LDK_GossipSync_rapid(int64_t a) {
74641         LDKRapidGossipSync a_conv;
74642         a_conv.inner = untag_ptr(a);
74643         a_conv.is_owned = ptr_is_owned(a);
74644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74645         a_conv.is_owned = false;
74646         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74647         *ret_copy = GossipSync_rapid(&a_conv);
74648         int64_t ret_ref = tag_ptr(ret_copy, true);
74649         return ret_ref;
74650 }
74651
74652 int64_t  CS_LDK_GossipSync_none() {
74653         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74654         *ret_copy = GossipSync_none();
74655         int64_t ret_ref = tag_ptr(ret_copy, true);
74656         return ret_ref;
74657 }
74658
74659 int64_t  CS_LDK_BackgroundProcessor_start(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) {
74660         void* persister_ptr = untag_ptr(persister);
74661         CHECK_ACCESS(persister_ptr);
74662         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
74663         if (persister_conv.free == LDKPersister_JCalls_free) {
74664                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74665                 LDKPersister_JCalls_cloned(&persister_conv);
74666         }
74667         void* event_handler_ptr = untag_ptr(event_handler);
74668         CHECK_ACCESS(event_handler_ptr);
74669         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
74670         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
74671                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74672                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
74673         }
74674         LDKChainMonitor chain_monitor_conv;
74675         chain_monitor_conv.inner = untag_ptr(chain_monitor);
74676         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
74677         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
74678         chain_monitor_conv.is_owned = false;
74679         LDKChannelManager channel_manager_conv;
74680         channel_manager_conv.inner = untag_ptr(channel_manager);
74681         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
74682         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
74683         channel_manager_conv.is_owned = false;
74684         void* gossip_sync_ptr = untag_ptr(gossip_sync);
74685         CHECK_ACCESS(gossip_sync_ptr);
74686         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
74687         // WARNING: we may need a move here but no clone is available for LDKGossipSync
74688         LDKPeerManager peer_manager_conv;
74689         peer_manager_conv.inner = untag_ptr(peer_manager);
74690         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
74691         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
74692         peer_manager_conv.is_owned = false;
74693         void* logger_ptr = untag_ptr(logger);
74694         CHECK_ACCESS(logger_ptr);
74695         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74696         if (logger_conv.free == LDKLogger_JCalls_free) {
74697                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74698                 LDKLogger_JCalls_cloned(&logger_conv);
74699         }
74700         void* scorer_ptr = untag_ptr(scorer);
74701         CHECK_ACCESS(scorer_ptr);
74702         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
74703         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
74704         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
74705                 // Manually implement clone for Java trait instances
74706                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
74707                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74708                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
74709                 }
74710         }
74711         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);
74712         int64_t ret_ref = 0;
74713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74715         return ret_ref;
74716 }
74717
74718 int64_t  CS_LDK_BackgroundProcessor_join(int64_t this_arg) {
74719         LDKBackgroundProcessor this_arg_conv;
74720         this_arg_conv.inner = untag_ptr(this_arg);
74721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74723         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
74724         
74725         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
74726         *ret_conv = BackgroundProcessor_join(this_arg_conv);
74727         return tag_ptr(ret_conv, true);
74728 }
74729
74730 int64_t  CS_LDK_BackgroundProcessor_stop(int64_t this_arg) {
74731         LDKBackgroundProcessor this_arg_conv;
74732         this_arg_conv.inner = untag_ptr(this_arg);
74733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74735         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
74736         
74737         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
74738         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
74739         return tag_ptr(ret_conv, true);
74740 }
74741
74742 void  CS_LDK_Bolt11ParseError_free(int64_t this_ptr) {
74743         if (!ptr_is_owned(this_ptr)) return;
74744         void* this_ptr_ptr = untag_ptr(this_ptr);
74745         CHECK_ACCESS(this_ptr_ptr);
74746         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
74747         FREE(untag_ptr(this_ptr));
74748         Bolt11ParseError_free(this_ptr_conv);
74749 }
74750
74751 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
74752         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74753         *ret_copy = Bolt11ParseError_clone(arg);
74754         int64_t ret_ref = tag_ptr(ret_copy, true);
74755         return ret_ref;
74756 }
74757 int64_t  CS_LDK_Bolt11ParseError_clone_ptr(int64_t arg) {
74758         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
74759         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
74760         return ret_conv;
74761 }
74762
74763 int64_t  CS_LDK_Bolt11ParseError_clone(int64_t orig) {
74764         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
74765         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74766         *ret_copy = Bolt11ParseError_clone(orig_conv);
74767         int64_t ret_ref = tag_ptr(ret_copy, true);
74768         return ret_ref;
74769 }
74770
74771 int64_t  CS_LDK_Bolt11ParseError_bech32_error(int64_t a) {
74772         void* a_ptr = untag_ptr(a);
74773         CHECK_ACCESS(a_ptr);
74774         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
74775         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
74776         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74777         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
74778         int64_t ret_ref = tag_ptr(ret_copy, true);
74779         return ret_ref;
74780 }
74781
74782 int64_t  CS_LDK_Bolt11ParseError_parse_amount_error(int32_t a) {
74783         
74784         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74785         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
74786         int64_t ret_ref = tag_ptr(ret_copy, true);
74787         return ret_ref;
74788 }
74789
74790 int64_t  CS_LDK_Bolt11ParseError_malformed_signature(int32_t a) {
74791         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
74792         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74793         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
74794         int64_t ret_ref = tag_ptr(ret_copy, true);
74795         return ret_ref;
74796 }
74797
74798 int64_t  CS_LDK_Bolt11ParseError_bad_prefix() {
74799         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74800         *ret_copy = Bolt11ParseError_bad_prefix();
74801         int64_t ret_ref = tag_ptr(ret_copy, true);
74802         return ret_ref;
74803 }
74804
74805 int64_t  CS_LDK_Bolt11ParseError_unknown_currency() {
74806         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74807         *ret_copy = Bolt11ParseError_unknown_currency();
74808         int64_t ret_ref = tag_ptr(ret_copy, true);
74809         return ret_ref;
74810 }
74811
74812 int64_t  CS_LDK_Bolt11ParseError_unknown_si_prefix() {
74813         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74814         *ret_copy = Bolt11ParseError_unknown_si_prefix();
74815         int64_t ret_ref = tag_ptr(ret_copy, true);
74816         return ret_ref;
74817 }
74818
74819 int64_t  CS_LDK_Bolt11ParseError_malformed_hrp() {
74820         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74821         *ret_copy = Bolt11ParseError_malformed_hrp();
74822         int64_t ret_ref = tag_ptr(ret_copy, true);
74823         return ret_ref;
74824 }
74825
74826 int64_t  CS_LDK_Bolt11ParseError_too_short_data_part() {
74827         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74828         *ret_copy = Bolt11ParseError_too_short_data_part();
74829         int64_t ret_ref = tag_ptr(ret_copy, true);
74830         return ret_ref;
74831 }
74832
74833 int64_t  CS_LDK_Bolt11ParseError_unexpected_end_of_tagged_fields() {
74834         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74835         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
74836         int64_t ret_ref = tag_ptr(ret_copy, true);
74837         return ret_ref;
74838 }
74839
74840 int64_t  CS_LDK_Bolt11ParseError_description_decode_error(int32_t a) {
74841         
74842         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74843         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
74844         int64_t ret_ref = tag_ptr(ret_copy, true);
74845         return ret_ref;
74846 }
74847
74848 int64_t  CS_LDK_Bolt11ParseError_padding_error() {
74849         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74850         *ret_copy = Bolt11ParseError_padding_error();
74851         int64_t ret_ref = tag_ptr(ret_copy, true);
74852         return ret_ref;
74853 }
74854
74855 int64_t  CS_LDK_Bolt11ParseError_integer_overflow_error() {
74856         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74857         *ret_copy = Bolt11ParseError_integer_overflow_error();
74858         int64_t ret_ref = tag_ptr(ret_copy, true);
74859         return ret_ref;
74860 }
74861
74862 int64_t  CS_LDK_Bolt11ParseError_invalid_seg_wit_program_length() {
74863         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74864         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
74865         int64_t ret_ref = tag_ptr(ret_copy, true);
74866         return ret_ref;
74867 }
74868
74869 int64_t  CS_LDK_Bolt11ParseError_invalid_pub_key_hash_length() {
74870         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74871         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
74872         int64_t ret_ref = tag_ptr(ret_copy, true);
74873         return ret_ref;
74874 }
74875
74876 int64_t  CS_LDK_Bolt11ParseError_invalid_script_hash_length() {
74877         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74878         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
74879         int64_t ret_ref = tag_ptr(ret_copy, true);
74880         return ret_ref;
74881 }
74882
74883 int64_t  CS_LDK_Bolt11ParseError_invalid_recovery_id() {
74884         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74885         *ret_copy = Bolt11ParseError_invalid_recovery_id();
74886         int64_t ret_ref = tag_ptr(ret_copy, true);
74887         return ret_ref;
74888 }
74889
74890 int64_t  CS_LDK_Bolt11ParseError_invalid_slice_length(jstring a) {
74891         LDKStr a_conv = str_ref_to_owned_c(a);
74892         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74893         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
74894         int64_t ret_ref = tag_ptr(ret_copy, true);
74895         return ret_ref;
74896 }
74897
74898 int64_t  CS_LDK_Bolt11ParseError_skip() {
74899         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74900         *ret_copy = Bolt11ParseError_skip();
74901         int64_t ret_ref = tag_ptr(ret_copy, true);
74902         return ret_ref;
74903 }
74904
74905 jboolean  CS_LDK_Bolt11ParseError_eq(int64_t a, int64_t b) {
74906         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
74907         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
74908         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
74909         return ret_conv;
74910 }
74911
74912 void  CS_LDK_ParseOrSemanticError_free(int64_t this_ptr) {
74913         if (!ptr_is_owned(this_ptr)) return;
74914         void* this_ptr_ptr = untag_ptr(this_ptr);
74915         CHECK_ACCESS(this_ptr_ptr);
74916         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
74917         FREE(untag_ptr(this_ptr));
74918         ParseOrSemanticError_free(this_ptr_conv);
74919 }
74920
74921 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
74922         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74923         *ret_copy = ParseOrSemanticError_clone(arg);
74924         int64_t ret_ref = tag_ptr(ret_copy, true);
74925         return ret_ref;
74926 }
74927 int64_t  CS_LDK_ParseOrSemanticError_clone_ptr(int64_t arg) {
74928         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
74929         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
74930         return ret_conv;
74931 }
74932
74933 int64_t  CS_LDK_ParseOrSemanticError_clone(int64_t orig) {
74934         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
74935         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74936         *ret_copy = ParseOrSemanticError_clone(orig_conv);
74937         int64_t ret_ref = tag_ptr(ret_copy, true);
74938         return ret_ref;
74939 }
74940
74941 int64_t  CS_LDK_ParseOrSemanticError_parse_error(int64_t a) {
74942         void* a_ptr = untag_ptr(a);
74943         CHECK_ACCESS(a_ptr);
74944         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
74945         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
74946         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74947         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
74948         int64_t ret_ref = tag_ptr(ret_copy, true);
74949         return ret_ref;
74950 }
74951
74952 int64_t  CS_LDK_ParseOrSemanticError_semantic_error(int32_t a) {
74953         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_cs(a);
74954         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74955         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
74956         int64_t ret_ref = tag_ptr(ret_copy, true);
74957         return ret_ref;
74958 }
74959
74960 jboolean  CS_LDK_ParseOrSemanticError_eq(int64_t a, int64_t b) {
74961         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
74962         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
74963         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
74964         return ret_conv;
74965 }
74966
74967 void  CS_LDK_Bolt11Invoice_free(int64_t this_obj) {
74968         LDKBolt11Invoice this_obj_conv;
74969         this_obj_conv.inner = untag_ptr(this_obj);
74970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74972         Bolt11Invoice_free(this_obj_conv);
74973 }
74974
74975 jboolean  CS_LDK_Bolt11Invoice_eq(int64_t a, int64_t b) {
74976         LDKBolt11Invoice a_conv;
74977         a_conv.inner = untag_ptr(a);
74978         a_conv.is_owned = ptr_is_owned(a);
74979         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74980         a_conv.is_owned = false;
74981         LDKBolt11Invoice b_conv;
74982         b_conv.inner = untag_ptr(b);
74983         b_conv.is_owned = ptr_is_owned(b);
74984         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74985         b_conv.is_owned = false;
74986         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
74987         return ret_conv;
74988 }
74989
74990 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
74991         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
74992         int64_t ret_ref = 0;
74993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74995         return ret_ref;
74996 }
74997 int64_t  CS_LDK_Bolt11Invoice_clone_ptr(int64_t arg) {
74998         LDKBolt11Invoice arg_conv;
74999         arg_conv.inner = untag_ptr(arg);
75000         arg_conv.is_owned = ptr_is_owned(arg);
75001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75002         arg_conv.is_owned = false;
75003         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
75004         return ret_conv;
75005 }
75006
75007 int64_t  CS_LDK_Bolt11Invoice_clone(int64_t orig) {
75008         LDKBolt11Invoice orig_conv;
75009         orig_conv.inner = untag_ptr(orig);
75010         orig_conv.is_owned = ptr_is_owned(orig);
75011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75012         orig_conv.is_owned = false;
75013         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
75014         int64_t ret_ref = 0;
75015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75017         return ret_ref;
75018 }
75019
75020 int64_t  CS_LDK_Bolt11Invoice_hash(int64_t o) {
75021         LDKBolt11Invoice o_conv;
75022         o_conv.inner = untag_ptr(o);
75023         o_conv.is_owned = ptr_is_owned(o);
75024         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75025         o_conv.is_owned = false;
75026         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
75027         return ret_conv;
75028 }
75029
75030 void  CS_LDK_SignedRawBolt11Invoice_free(int64_t this_obj) {
75031         LDKSignedRawBolt11Invoice this_obj_conv;
75032         this_obj_conv.inner = untag_ptr(this_obj);
75033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75035         SignedRawBolt11Invoice_free(this_obj_conv);
75036 }
75037
75038 jboolean  CS_LDK_SignedRawBolt11Invoice_eq(int64_t a, int64_t b) {
75039         LDKSignedRawBolt11Invoice a_conv;
75040         a_conv.inner = untag_ptr(a);
75041         a_conv.is_owned = ptr_is_owned(a);
75042         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75043         a_conv.is_owned = false;
75044         LDKSignedRawBolt11Invoice b_conv;
75045         b_conv.inner = untag_ptr(b);
75046         b_conv.is_owned = ptr_is_owned(b);
75047         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75048         b_conv.is_owned = false;
75049         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
75050         return ret_conv;
75051 }
75052
75053 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
75054         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
75055         int64_t ret_ref = 0;
75056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75058         return ret_ref;
75059 }
75060 int64_t  CS_LDK_SignedRawBolt11Invoice_clone_ptr(int64_t arg) {
75061         LDKSignedRawBolt11Invoice arg_conv;
75062         arg_conv.inner = untag_ptr(arg);
75063         arg_conv.is_owned = ptr_is_owned(arg);
75064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75065         arg_conv.is_owned = false;
75066         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
75067         return ret_conv;
75068 }
75069
75070 int64_t  CS_LDK_SignedRawBolt11Invoice_clone(int64_t orig) {
75071         LDKSignedRawBolt11Invoice orig_conv;
75072         orig_conv.inner = untag_ptr(orig);
75073         orig_conv.is_owned = ptr_is_owned(orig);
75074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75075         orig_conv.is_owned = false;
75076         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
75077         int64_t ret_ref = 0;
75078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75080         return ret_ref;
75081 }
75082
75083 int64_t  CS_LDK_SignedRawBolt11Invoice_hash(int64_t o) {
75084         LDKSignedRawBolt11Invoice o_conv;
75085         o_conv.inner = untag_ptr(o);
75086         o_conv.is_owned = ptr_is_owned(o);
75087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75088         o_conv.is_owned = false;
75089         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
75090         return ret_conv;
75091 }
75092
75093 void  CS_LDK_RawBolt11Invoice_free(int64_t this_obj) {
75094         LDKRawBolt11Invoice this_obj_conv;
75095         this_obj_conv.inner = untag_ptr(this_obj);
75096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75098         RawBolt11Invoice_free(this_obj_conv);
75099 }
75100
75101 int64_t  CS_LDK_RawBolt11Invoice_get_data(int64_t this_ptr) {
75102         LDKRawBolt11Invoice this_ptr_conv;
75103         this_ptr_conv.inner = untag_ptr(this_ptr);
75104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75106         this_ptr_conv.is_owned = false;
75107         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
75108         int64_t ret_ref = 0;
75109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75111         return ret_ref;
75112 }
75113
75114 void  CS_LDK_RawBolt11Invoice_set_data(int64_t this_ptr, int64_t val) {
75115         LDKRawBolt11Invoice this_ptr_conv;
75116         this_ptr_conv.inner = untag_ptr(this_ptr);
75117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75119         this_ptr_conv.is_owned = false;
75120         LDKRawDataPart val_conv;
75121         val_conv.inner = untag_ptr(val);
75122         val_conv.is_owned = ptr_is_owned(val);
75123         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75124         val_conv = RawDataPart_clone(&val_conv);
75125         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
75126 }
75127
75128 jboolean  CS_LDK_RawBolt11Invoice_eq(int64_t a, int64_t b) {
75129         LDKRawBolt11Invoice a_conv;
75130         a_conv.inner = untag_ptr(a);
75131         a_conv.is_owned = ptr_is_owned(a);
75132         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75133         a_conv.is_owned = false;
75134         LDKRawBolt11Invoice b_conv;
75135         b_conv.inner = untag_ptr(b);
75136         b_conv.is_owned = ptr_is_owned(b);
75137         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75138         b_conv.is_owned = false;
75139         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
75140         return ret_conv;
75141 }
75142
75143 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
75144         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
75145         int64_t ret_ref = 0;
75146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75148         return ret_ref;
75149 }
75150 int64_t  CS_LDK_RawBolt11Invoice_clone_ptr(int64_t arg) {
75151         LDKRawBolt11Invoice arg_conv;
75152         arg_conv.inner = untag_ptr(arg);
75153         arg_conv.is_owned = ptr_is_owned(arg);
75154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75155         arg_conv.is_owned = false;
75156         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
75157         return ret_conv;
75158 }
75159
75160 int64_t  CS_LDK_RawBolt11Invoice_clone(int64_t orig) {
75161         LDKRawBolt11Invoice orig_conv;
75162         orig_conv.inner = untag_ptr(orig);
75163         orig_conv.is_owned = ptr_is_owned(orig);
75164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75165         orig_conv.is_owned = false;
75166         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
75167         int64_t ret_ref = 0;
75168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75170         return ret_ref;
75171 }
75172
75173 int64_t  CS_LDK_RawBolt11Invoice_hash(int64_t o) {
75174         LDKRawBolt11Invoice o_conv;
75175         o_conv.inner = untag_ptr(o);
75176         o_conv.is_owned = ptr_is_owned(o);
75177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75178         o_conv.is_owned = false;
75179         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
75180         return ret_conv;
75181 }
75182
75183 void  CS_LDK_RawDataPart_free(int64_t this_obj) {
75184         LDKRawDataPart this_obj_conv;
75185         this_obj_conv.inner = untag_ptr(this_obj);
75186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75188         RawDataPart_free(this_obj_conv);
75189 }
75190
75191 int64_t  CS_LDK_RawDataPart_get_timestamp(int64_t this_ptr) {
75192         LDKRawDataPart this_ptr_conv;
75193         this_ptr_conv.inner = untag_ptr(this_ptr);
75194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75196         this_ptr_conv.is_owned = false;
75197         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
75198         int64_t ret_ref = 0;
75199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75201         return ret_ref;
75202 }
75203
75204 void  CS_LDK_RawDataPart_set_timestamp(int64_t this_ptr, int64_t val) {
75205         LDKRawDataPart this_ptr_conv;
75206         this_ptr_conv.inner = untag_ptr(this_ptr);
75207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75209         this_ptr_conv.is_owned = false;
75210         LDKPositiveTimestamp val_conv;
75211         val_conv.inner = untag_ptr(val);
75212         val_conv.is_owned = ptr_is_owned(val);
75213         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75214         val_conv = PositiveTimestamp_clone(&val_conv);
75215         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
75216 }
75217
75218 jboolean  CS_LDK_RawDataPart_eq(int64_t a, int64_t b) {
75219         LDKRawDataPart a_conv;
75220         a_conv.inner = untag_ptr(a);
75221         a_conv.is_owned = ptr_is_owned(a);
75222         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75223         a_conv.is_owned = false;
75224         LDKRawDataPart b_conv;
75225         b_conv.inner = untag_ptr(b);
75226         b_conv.is_owned = ptr_is_owned(b);
75227         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75228         b_conv.is_owned = false;
75229         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
75230         return ret_conv;
75231 }
75232
75233 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
75234         LDKRawDataPart ret_var = RawDataPart_clone(arg);
75235         int64_t ret_ref = 0;
75236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75238         return ret_ref;
75239 }
75240 int64_t  CS_LDK_RawDataPart_clone_ptr(int64_t arg) {
75241         LDKRawDataPart arg_conv;
75242         arg_conv.inner = untag_ptr(arg);
75243         arg_conv.is_owned = ptr_is_owned(arg);
75244         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75245         arg_conv.is_owned = false;
75246         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
75247         return ret_conv;
75248 }
75249
75250 int64_t  CS_LDK_RawDataPart_clone(int64_t orig) {
75251         LDKRawDataPart orig_conv;
75252         orig_conv.inner = untag_ptr(orig);
75253         orig_conv.is_owned = ptr_is_owned(orig);
75254         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75255         orig_conv.is_owned = false;
75256         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
75257         int64_t ret_ref = 0;
75258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75260         return ret_ref;
75261 }
75262
75263 int64_t  CS_LDK_RawDataPart_hash(int64_t o) {
75264         LDKRawDataPart o_conv;
75265         o_conv.inner = untag_ptr(o);
75266         o_conv.is_owned = ptr_is_owned(o);
75267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75268         o_conv.is_owned = false;
75269         int64_t ret_conv = RawDataPart_hash(&o_conv);
75270         return ret_conv;
75271 }
75272
75273 void  CS_LDK_PositiveTimestamp_free(int64_t this_obj) {
75274         LDKPositiveTimestamp this_obj_conv;
75275         this_obj_conv.inner = untag_ptr(this_obj);
75276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75278         PositiveTimestamp_free(this_obj_conv);
75279 }
75280
75281 jboolean  CS_LDK_PositiveTimestamp_eq(int64_t a, int64_t b) {
75282         LDKPositiveTimestamp a_conv;
75283         a_conv.inner = untag_ptr(a);
75284         a_conv.is_owned = ptr_is_owned(a);
75285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75286         a_conv.is_owned = false;
75287         LDKPositiveTimestamp b_conv;
75288         b_conv.inner = untag_ptr(b);
75289         b_conv.is_owned = ptr_is_owned(b);
75290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75291         b_conv.is_owned = false;
75292         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
75293         return ret_conv;
75294 }
75295
75296 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
75297         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
75298         int64_t ret_ref = 0;
75299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75301         return ret_ref;
75302 }
75303 int64_t  CS_LDK_PositiveTimestamp_clone_ptr(int64_t arg) {
75304         LDKPositiveTimestamp arg_conv;
75305         arg_conv.inner = untag_ptr(arg);
75306         arg_conv.is_owned = ptr_is_owned(arg);
75307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75308         arg_conv.is_owned = false;
75309         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
75310         return ret_conv;
75311 }
75312
75313 int64_t  CS_LDK_PositiveTimestamp_clone(int64_t orig) {
75314         LDKPositiveTimestamp orig_conv;
75315         orig_conv.inner = untag_ptr(orig);
75316         orig_conv.is_owned = ptr_is_owned(orig);
75317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75318         orig_conv.is_owned = false;
75319         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
75320         int64_t ret_ref = 0;
75321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75323         return ret_ref;
75324 }
75325
75326 int64_t  CS_LDK_PositiveTimestamp_hash(int64_t o) {
75327         LDKPositiveTimestamp o_conv;
75328         o_conv.inner = untag_ptr(o);
75329         o_conv.is_owned = ptr_is_owned(o);
75330         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75331         o_conv.is_owned = false;
75332         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
75333         return ret_conv;
75334 }
75335
75336 int32_t  CS_LDK_SiPrefix_clone(int64_t orig) {
75337         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
75338         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_clone(orig_conv));
75339         return ret_conv;
75340 }
75341
75342 int32_t  CS_LDK_SiPrefix_milli() {
75343         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_milli());
75344         return ret_conv;
75345 }
75346
75347 int32_t  CS_LDK_SiPrefix_micro() {
75348         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_micro());
75349         return ret_conv;
75350 }
75351
75352 int32_t  CS_LDK_SiPrefix_nano() {
75353         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_nano());
75354         return ret_conv;
75355 }
75356
75357 int32_t  CS_LDK_SiPrefix_pico() {
75358         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_pico());
75359         return ret_conv;
75360 }
75361
75362 jboolean  CS_LDK_SiPrefix_eq(int64_t a, int64_t b) {
75363         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
75364         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
75365         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
75366         return ret_conv;
75367 }
75368
75369 int64_t  CS_LDK_SiPrefix_hash(int64_t o) {
75370         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
75371         int64_t ret_conv = SiPrefix_hash(o_conv);
75372         return ret_conv;
75373 }
75374
75375 int64_t  CS_LDK_SiPrefix_multiplier(int64_t this_arg) {
75376         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
75377         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
75378         return ret_conv;
75379 }
75380
75381 int32_t  CS_LDK_Currency_clone(int64_t orig) {
75382         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
75383         int32_t ret_conv = LDKCurrency_to_cs(Currency_clone(orig_conv));
75384         return ret_conv;
75385 }
75386
75387 int32_t  CS_LDK_Currency_bitcoin() {
75388         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin());
75389         return ret_conv;
75390 }
75391
75392 int32_t  CS_LDK_Currency_bitcoin_testnet() {
75393         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin_testnet());
75394         return ret_conv;
75395 }
75396
75397 int32_t  CS_LDK_Currency_regtest() {
75398         int32_t ret_conv = LDKCurrency_to_cs(Currency_regtest());
75399         return ret_conv;
75400 }
75401
75402 int32_t  CS_LDK_Currency_simnet() {
75403         int32_t ret_conv = LDKCurrency_to_cs(Currency_simnet());
75404         return ret_conv;
75405 }
75406
75407 int32_t  CS_LDK_Currency_signet() {
75408         int32_t ret_conv = LDKCurrency_to_cs(Currency_signet());
75409         return ret_conv;
75410 }
75411
75412 int64_t  CS_LDK_Currency_hash(int64_t o) {
75413         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
75414         int64_t ret_conv = Currency_hash(o_conv);
75415         return ret_conv;
75416 }
75417
75418 jboolean  CS_LDK_Currency_eq(int64_t a, int64_t b) {
75419         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
75420         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
75421         jboolean ret_conv = Currency_eq(a_conv, b_conv);
75422         return ret_conv;
75423 }
75424
75425 void  CS_LDK_Sha256_free(int64_t this_obj) {
75426         LDKSha256 this_obj_conv;
75427         this_obj_conv.inner = untag_ptr(this_obj);
75428         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75430         Sha256_free(this_obj_conv);
75431 }
75432
75433 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
75434         LDKSha256 ret_var = Sha256_clone(arg);
75435         int64_t ret_ref = 0;
75436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75438         return ret_ref;
75439 }
75440 int64_t  CS_LDK_Sha256_clone_ptr(int64_t arg) {
75441         LDKSha256 arg_conv;
75442         arg_conv.inner = untag_ptr(arg);
75443         arg_conv.is_owned = ptr_is_owned(arg);
75444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75445         arg_conv.is_owned = false;
75446         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
75447         return ret_conv;
75448 }
75449
75450 int64_t  CS_LDK_Sha256_clone(int64_t orig) {
75451         LDKSha256 orig_conv;
75452         orig_conv.inner = untag_ptr(orig);
75453         orig_conv.is_owned = ptr_is_owned(orig);
75454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75455         orig_conv.is_owned = false;
75456         LDKSha256 ret_var = Sha256_clone(&orig_conv);
75457         int64_t ret_ref = 0;
75458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75460         return ret_ref;
75461 }
75462
75463 int64_t  CS_LDK_Sha256_hash(int64_t o) {
75464         LDKSha256 o_conv;
75465         o_conv.inner = untag_ptr(o);
75466         o_conv.is_owned = ptr_is_owned(o);
75467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75468         o_conv.is_owned = false;
75469         int64_t ret_conv = Sha256_hash(&o_conv);
75470         return ret_conv;
75471 }
75472
75473 jboolean  CS_LDK_Sha256_eq(int64_t a, int64_t b) {
75474         LDKSha256 a_conv;
75475         a_conv.inner = untag_ptr(a);
75476         a_conv.is_owned = ptr_is_owned(a);
75477         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75478         a_conv.is_owned = false;
75479         LDKSha256 b_conv;
75480         b_conv.inner = untag_ptr(b);
75481         b_conv.is_owned = ptr_is_owned(b);
75482         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75483         b_conv.is_owned = false;
75484         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
75485         return ret_conv;
75486 }
75487
75488 int64_t  CS_LDK_Sha256_from_bytes(int8_tArray bytes) {
75489         uint8_t bytes_arr[32];
75490         CHECK(bytes->arr_len == 32);
75491         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
75492         uint8_t (*bytes_ref)[32] = &bytes_arr;
75493         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
75494         int64_t ret_ref = 0;
75495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75497         return ret_ref;
75498 }
75499
75500 void  CS_LDK_Description_free(int64_t this_obj) {
75501         LDKDescription this_obj_conv;
75502         this_obj_conv.inner = untag_ptr(this_obj);
75503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75505         Description_free(this_obj_conv);
75506 }
75507
75508 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
75509         LDKDescription ret_var = Description_clone(arg);
75510         int64_t ret_ref = 0;
75511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75513         return ret_ref;
75514 }
75515 int64_t  CS_LDK_Description_clone_ptr(int64_t arg) {
75516         LDKDescription arg_conv;
75517         arg_conv.inner = untag_ptr(arg);
75518         arg_conv.is_owned = ptr_is_owned(arg);
75519         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75520         arg_conv.is_owned = false;
75521         int64_t ret_conv = Description_clone_ptr(&arg_conv);
75522         return ret_conv;
75523 }
75524
75525 int64_t  CS_LDK_Description_clone(int64_t orig) {
75526         LDKDescription orig_conv;
75527         orig_conv.inner = untag_ptr(orig);
75528         orig_conv.is_owned = ptr_is_owned(orig);
75529         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75530         orig_conv.is_owned = false;
75531         LDKDescription ret_var = Description_clone(&orig_conv);
75532         int64_t ret_ref = 0;
75533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75535         return ret_ref;
75536 }
75537
75538 int64_t  CS_LDK_Description_hash(int64_t o) {
75539         LDKDescription o_conv;
75540         o_conv.inner = untag_ptr(o);
75541         o_conv.is_owned = ptr_is_owned(o);
75542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75543         o_conv.is_owned = false;
75544         int64_t ret_conv = Description_hash(&o_conv);
75545         return ret_conv;
75546 }
75547
75548 jboolean  CS_LDK_Description_eq(int64_t a, int64_t b) {
75549         LDKDescription a_conv;
75550         a_conv.inner = untag_ptr(a);
75551         a_conv.is_owned = ptr_is_owned(a);
75552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75553         a_conv.is_owned = false;
75554         LDKDescription b_conv;
75555         b_conv.inner = untag_ptr(b);
75556         b_conv.is_owned = ptr_is_owned(b);
75557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75558         b_conv.is_owned = false;
75559         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
75560         return ret_conv;
75561 }
75562
75563 void  CS_LDK_PayeePubKey_free(int64_t this_obj) {
75564         LDKPayeePubKey this_obj_conv;
75565         this_obj_conv.inner = untag_ptr(this_obj);
75566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75568         PayeePubKey_free(this_obj_conv);
75569 }
75570
75571 int8_tArray  CS_LDK_PayeePubKey_get_a(int64_t this_ptr) {
75572         LDKPayeePubKey this_ptr_conv;
75573         this_ptr_conv.inner = untag_ptr(this_ptr);
75574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75576         this_ptr_conv.is_owned = false;
75577         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75578         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
75579         return ret_arr;
75580 }
75581
75582 void  CS_LDK_PayeePubKey_set_a(int64_t this_ptr, int8_tArray val) {
75583         LDKPayeePubKey this_ptr_conv;
75584         this_ptr_conv.inner = untag_ptr(this_ptr);
75585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75587         this_ptr_conv.is_owned = false;
75588         LDKPublicKey val_ref;
75589         CHECK(val->arr_len == 33);
75590         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
75591         PayeePubKey_set_a(&this_ptr_conv, val_ref);
75592 }
75593
75594 int64_t  CS_LDK_PayeePubKey_new(int8_tArray a_arg) {
75595         LDKPublicKey a_arg_ref;
75596         CHECK(a_arg->arr_len == 33);
75597         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
75598         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
75599         int64_t ret_ref = 0;
75600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75602         return ret_ref;
75603 }
75604
75605 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
75606         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
75607         int64_t ret_ref = 0;
75608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75610         return ret_ref;
75611 }
75612 int64_t  CS_LDK_PayeePubKey_clone_ptr(int64_t arg) {
75613         LDKPayeePubKey arg_conv;
75614         arg_conv.inner = untag_ptr(arg);
75615         arg_conv.is_owned = ptr_is_owned(arg);
75616         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75617         arg_conv.is_owned = false;
75618         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
75619         return ret_conv;
75620 }
75621
75622 int64_t  CS_LDK_PayeePubKey_clone(int64_t orig) {
75623         LDKPayeePubKey orig_conv;
75624         orig_conv.inner = untag_ptr(orig);
75625         orig_conv.is_owned = ptr_is_owned(orig);
75626         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75627         orig_conv.is_owned = false;
75628         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
75629         int64_t ret_ref = 0;
75630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75632         return ret_ref;
75633 }
75634
75635 int64_t  CS_LDK_PayeePubKey_hash(int64_t o) {
75636         LDKPayeePubKey o_conv;
75637         o_conv.inner = untag_ptr(o);
75638         o_conv.is_owned = ptr_is_owned(o);
75639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75640         o_conv.is_owned = false;
75641         int64_t ret_conv = PayeePubKey_hash(&o_conv);
75642         return ret_conv;
75643 }
75644
75645 jboolean  CS_LDK_PayeePubKey_eq(int64_t a, int64_t b) {
75646         LDKPayeePubKey a_conv;
75647         a_conv.inner = untag_ptr(a);
75648         a_conv.is_owned = ptr_is_owned(a);
75649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75650         a_conv.is_owned = false;
75651         LDKPayeePubKey b_conv;
75652         b_conv.inner = untag_ptr(b);
75653         b_conv.is_owned = ptr_is_owned(b);
75654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75655         b_conv.is_owned = false;
75656         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
75657         return ret_conv;
75658 }
75659
75660 void  CS_LDK_ExpiryTime_free(int64_t this_obj) {
75661         LDKExpiryTime this_obj_conv;
75662         this_obj_conv.inner = untag_ptr(this_obj);
75663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75665         ExpiryTime_free(this_obj_conv);
75666 }
75667
75668 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
75669         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
75670         int64_t ret_ref = 0;
75671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75673         return ret_ref;
75674 }
75675 int64_t  CS_LDK_ExpiryTime_clone_ptr(int64_t arg) {
75676         LDKExpiryTime arg_conv;
75677         arg_conv.inner = untag_ptr(arg);
75678         arg_conv.is_owned = ptr_is_owned(arg);
75679         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75680         arg_conv.is_owned = false;
75681         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
75682         return ret_conv;
75683 }
75684
75685 int64_t  CS_LDK_ExpiryTime_clone(int64_t orig) {
75686         LDKExpiryTime orig_conv;
75687         orig_conv.inner = untag_ptr(orig);
75688         orig_conv.is_owned = ptr_is_owned(orig);
75689         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75690         orig_conv.is_owned = false;
75691         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
75692         int64_t ret_ref = 0;
75693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75695         return ret_ref;
75696 }
75697
75698 int64_t  CS_LDK_ExpiryTime_hash(int64_t o) {
75699         LDKExpiryTime o_conv;
75700         o_conv.inner = untag_ptr(o);
75701         o_conv.is_owned = ptr_is_owned(o);
75702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75703         o_conv.is_owned = false;
75704         int64_t ret_conv = ExpiryTime_hash(&o_conv);
75705         return ret_conv;
75706 }
75707
75708 jboolean  CS_LDK_ExpiryTime_eq(int64_t a, int64_t b) {
75709         LDKExpiryTime a_conv;
75710         a_conv.inner = untag_ptr(a);
75711         a_conv.is_owned = ptr_is_owned(a);
75712         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75713         a_conv.is_owned = false;
75714         LDKExpiryTime b_conv;
75715         b_conv.inner = untag_ptr(b);
75716         b_conv.is_owned = ptr_is_owned(b);
75717         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75718         b_conv.is_owned = false;
75719         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
75720         return ret_conv;
75721 }
75722
75723 void  CS_LDK_MinFinalCltvExpiryDelta_free(int64_t this_obj) {
75724         LDKMinFinalCltvExpiryDelta this_obj_conv;
75725         this_obj_conv.inner = untag_ptr(this_obj);
75726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75728         MinFinalCltvExpiryDelta_free(this_obj_conv);
75729 }
75730
75731 int64_t  CS_LDK_MinFinalCltvExpiryDelta_get_a(int64_t this_ptr) {
75732         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75733         this_ptr_conv.inner = untag_ptr(this_ptr);
75734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75736         this_ptr_conv.is_owned = false;
75737         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
75738         return ret_conv;
75739 }
75740
75741 void  CS_LDK_MinFinalCltvExpiryDelta_set_a(int64_t this_ptr, int64_t val) {
75742         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75743         this_ptr_conv.inner = untag_ptr(this_ptr);
75744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75746         this_ptr_conv.is_owned = false;
75747         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
75748 }
75749
75750 int64_t  CS_LDK_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
75751         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
75752         int64_t ret_ref = 0;
75753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75755         return ret_ref;
75756 }
75757
75758 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
75759         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
75760         int64_t ret_ref = 0;
75761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75763         return ret_ref;
75764 }
75765 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone_ptr(int64_t arg) {
75766         LDKMinFinalCltvExpiryDelta arg_conv;
75767         arg_conv.inner = untag_ptr(arg);
75768         arg_conv.is_owned = ptr_is_owned(arg);
75769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75770         arg_conv.is_owned = false;
75771         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
75772         return ret_conv;
75773 }
75774
75775 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone(int64_t orig) {
75776         LDKMinFinalCltvExpiryDelta orig_conv;
75777         orig_conv.inner = untag_ptr(orig);
75778         orig_conv.is_owned = ptr_is_owned(orig);
75779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75780         orig_conv.is_owned = false;
75781         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
75782         int64_t ret_ref = 0;
75783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75785         return ret_ref;
75786 }
75787
75788 int64_t  CS_LDK_MinFinalCltvExpiryDelta_hash(int64_t o) {
75789         LDKMinFinalCltvExpiryDelta o_conv;
75790         o_conv.inner = untag_ptr(o);
75791         o_conv.is_owned = ptr_is_owned(o);
75792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75793         o_conv.is_owned = false;
75794         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
75795         return ret_conv;
75796 }
75797
75798 jboolean  CS_LDK_MinFinalCltvExpiryDelta_eq(int64_t a, int64_t b) {
75799         LDKMinFinalCltvExpiryDelta a_conv;
75800         a_conv.inner = untag_ptr(a);
75801         a_conv.is_owned = ptr_is_owned(a);
75802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75803         a_conv.is_owned = false;
75804         LDKMinFinalCltvExpiryDelta b_conv;
75805         b_conv.inner = untag_ptr(b);
75806         b_conv.is_owned = ptr_is_owned(b);
75807         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75808         b_conv.is_owned = false;
75809         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
75810         return ret_conv;
75811 }
75812
75813 void  CS_LDK_Fallback_free(int64_t this_ptr) {
75814         if (!ptr_is_owned(this_ptr)) return;
75815         void* this_ptr_ptr = untag_ptr(this_ptr);
75816         CHECK_ACCESS(this_ptr_ptr);
75817         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
75818         FREE(untag_ptr(this_ptr));
75819         Fallback_free(this_ptr_conv);
75820 }
75821
75822 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
75823         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75824         *ret_copy = Fallback_clone(arg);
75825         int64_t ret_ref = tag_ptr(ret_copy, true);
75826         return ret_ref;
75827 }
75828 int64_t  CS_LDK_Fallback_clone_ptr(int64_t arg) {
75829         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
75830         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
75831         return ret_conv;
75832 }
75833
75834 int64_t  CS_LDK_Fallback_clone(int64_t orig) {
75835         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
75836         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75837         *ret_copy = Fallback_clone(orig_conv);
75838         int64_t ret_ref = tag_ptr(ret_copy, true);
75839         return ret_ref;
75840 }
75841
75842 int64_t  CS_LDK_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
75843         
75844         LDKCVec_u8Z program_ref;
75845         program_ref.datalen = program->arr_len;
75846         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
75847         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
75848         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75849         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
75850         int64_t ret_ref = tag_ptr(ret_copy, true);
75851         return ret_ref;
75852 }
75853
75854 int64_t  CS_LDK_Fallback_pub_key_hash(int8_tArray a) {
75855         LDKTwentyBytes a_ref;
75856         CHECK(a->arr_len == 20);
75857         memcpy(a_ref.data, a->elems, 20); FREE(a);
75858         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75859         *ret_copy = Fallback_pub_key_hash(a_ref);
75860         int64_t ret_ref = tag_ptr(ret_copy, true);
75861         return ret_ref;
75862 }
75863
75864 int64_t  CS_LDK_Fallback_script_hash(int8_tArray a) {
75865         LDKTwentyBytes a_ref;
75866         CHECK(a->arr_len == 20);
75867         memcpy(a_ref.data, a->elems, 20); FREE(a);
75868         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75869         *ret_copy = Fallback_script_hash(a_ref);
75870         int64_t ret_ref = tag_ptr(ret_copy, true);
75871         return ret_ref;
75872 }
75873
75874 int64_t  CS_LDK_Fallback_hash(int64_t o) {
75875         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
75876         int64_t ret_conv = Fallback_hash(o_conv);
75877         return ret_conv;
75878 }
75879
75880 jboolean  CS_LDK_Fallback_eq(int64_t a, int64_t b) {
75881         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
75882         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
75883         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
75884         return ret_conv;
75885 }
75886
75887 void  CS_LDK_Bolt11InvoiceSignature_free(int64_t this_obj) {
75888         LDKBolt11InvoiceSignature this_obj_conv;
75889         this_obj_conv.inner = untag_ptr(this_obj);
75890         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75892         Bolt11InvoiceSignature_free(this_obj_conv);
75893 }
75894
75895 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
75896         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
75897         int64_t ret_ref = 0;
75898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75900         return ret_ref;
75901 }
75902 int64_t  CS_LDK_Bolt11InvoiceSignature_clone_ptr(int64_t arg) {
75903         LDKBolt11InvoiceSignature arg_conv;
75904         arg_conv.inner = untag_ptr(arg);
75905         arg_conv.is_owned = ptr_is_owned(arg);
75906         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75907         arg_conv.is_owned = false;
75908         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
75909         return ret_conv;
75910 }
75911
75912 int64_t  CS_LDK_Bolt11InvoiceSignature_clone(int64_t orig) {
75913         LDKBolt11InvoiceSignature orig_conv;
75914         orig_conv.inner = untag_ptr(orig);
75915         orig_conv.is_owned = ptr_is_owned(orig);
75916         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75917         orig_conv.is_owned = false;
75918         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
75919         int64_t ret_ref = 0;
75920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75922         return ret_ref;
75923 }
75924
75925 int64_t  CS_LDK_Bolt11InvoiceSignature_hash(int64_t o) {
75926         LDKBolt11InvoiceSignature o_conv;
75927         o_conv.inner = untag_ptr(o);
75928         o_conv.is_owned = ptr_is_owned(o);
75929         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75930         o_conv.is_owned = false;
75931         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
75932         return ret_conv;
75933 }
75934
75935 jboolean  CS_LDK_Bolt11InvoiceSignature_eq(int64_t a, int64_t b) {
75936         LDKBolt11InvoiceSignature a_conv;
75937         a_conv.inner = untag_ptr(a);
75938         a_conv.is_owned = ptr_is_owned(a);
75939         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75940         a_conv.is_owned = false;
75941         LDKBolt11InvoiceSignature b_conv;
75942         b_conv.inner = untag_ptr(b);
75943         b_conv.is_owned = ptr_is_owned(b);
75944         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75945         b_conv.is_owned = false;
75946         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
75947         return ret_conv;
75948 }
75949
75950 void  CS_LDK_PrivateRoute_free(int64_t this_obj) {
75951         LDKPrivateRoute this_obj_conv;
75952         this_obj_conv.inner = untag_ptr(this_obj);
75953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75955         PrivateRoute_free(this_obj_conv);
75956 }
75957
75958 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
75959         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
75960         int64_t ret_ref = 0;
75961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75963         return ret_ref;
75964 }
75965 int64_t  CS_LDK_PrivateRoute_clone_ptr(int64_t arg) {
75966         LDKPrivateRoute arg_conv;
75967         arg_conv.inner = untag_ptr(arg);
75968         arg_conv.is_owned = ptr_is_owned(arg);
75969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75970         arg_conv.is_owned = false;
75971         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
75972         return ret_conv;
75973 }
75974
75975 int64_t  CS_LDK_PrivateRoute_clone(int64_t orig) {
75976         LDKPrivateRoute orig_conv;
75977         orig_conv.inner = untag_ptr(orig);
75978         orig_conv.is_owned = ptr_is_owned(orig);
75979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75980         orig_conv.is_owned = false;
75981         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
75982         int64_t ret_ref = 0;
75983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75985         return ret_ref;
75986 }
75987
75988 int64_t  CS_LDK_PrivateRoute_hash(int64_t o) {
75989         LDKPrivateRoute o_conv;
75990         o_conv.inner = untag_ptr(o);
75991         o_conv.is_owned = ptr_is_owned(o);
75992         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75993         o_conv.is_owned = false;
75994         int64_t ret_conv = PrivateRoute_hash(&o_conv);
75995         return ret_conv;
75996 }
75997
75998 jboolean  CS_LDK_PrivateRoute_eq(int64_t a, int64_t b) {
75999         LDKPrivateRoute a_conv;
76000         a_conv.inner = untag_ptr(a);
76001         a_conv.is_owned = ptr_is_owned(a);
76002         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76003         a_conv.is_owned = false;
76004         LDKPrivateRoute b_conv;
76005         b_conv.inner = untag_ptr(b);
76006         b_conv.is_owned = ptr_is_owned(b);
76007         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76008         b_conv.is_owned = false;
76009         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
76010         return ret_conv;
76011 }
76012
76013 int64_t  CS_LDK_SignedRawBolt11Invoice_into_parts(int64_t this_arg) {
76014         LDKSignedRawBolt11Invoice this_arg_conv;
76015         this_arg_conv.inner = untag_ptr(this_arg);
76016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76018         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
76019         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
76020         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
76021         return tag_ptr(ret_conv, true);
76022 }
76023
76024 int64_t  CS_LDK_SignedRawBolt11Invoice_raw_invoice(int64_t this_arg) {
76025         LDKSignedRawBolt11Invoice this_arg_conv;
76026         this_arg_conv.inner = untag_ptr(this_arg);
76027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76029         this_arg_conv.is_owned = false;
76030         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
76031         int64_t ret_ref = 0;
76032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76034         return ret_ref;
76035 }
76036
76037 int8_tArray  CS_LDK_SignedRawBolt11Invoice_signable_hash(int64_t this_arg) {
76038         LDKSignedRawBolt11Invoice this_arg_conv;
76039         this_arg_conv.inner = untag_ptr(this_arg);
76040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76042         this_arg_conv.is_owned = false;
76043         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76044         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
76045         return ret_arr;
76046 }
76047
76048 int64_t  CS_LDK_SignedRawBolt11Invoice_signature(int64_t this_arg) {
76049         LDKSignedRawBolt11Invoice this_arg_conv;
76050         this_arg_conv.inner = untag_ptr(this_arg);
76051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76053         this_arg_conv.is_owned = false;
76054         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
76055         int64_t ret_ref = 0;
76056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76058         return ret_ref;
76059 }
76060
76061 int64_t  CS_LDK_SignedRawBolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
76062         LDKSignedRawBolt11Invoice this_arg_conv;
76063         this_arg_conv.inner = untag_ptr(this_arg);
76064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76066         this_arg_conv.is_owned = false;
76067         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
76068         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
76069         return tag_ptr(ret_conv, true);
76070 }
76071
76072 jboolean  CS_LDK_SignedRawBolt11Invoice_check_signature(int64_t this_arg) {
76073         LDKSignedRawBolt11Invoice this_arg_conv;
76074         this_arg_conv.inner = untag_ptr(this_arg);
76075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76077         this_arg_conv.is_owned = false;
76078         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
76079         return ret_conv;
76080 }
76081
76082 int8_tArray  CS_LDK_RawBolt11Invoice_signable_hash(int64_t this_arg) {
76083         LDKRawBolt11Invoice this_arg_conv;
76084         this_arg_conv.inner = untag_ptr(this_arg);
76085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76087         this_arg_conv.is_owned = false;
76088         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76089         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
76090         return ret_arr;
76091 }
76092
76093 int64_t  CS_LDK_RawBolt11Invoice_payment_hash(int64_t this_arg) {
76094         LDKRawBolt11Invoice this_arg_conv;
76095         this_arg_conv.inner = untag_ptr(this_arg);
76096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76098         this_arg_conv.is_owned = false;
76099         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
76100         int64_t ret_ref = 0;
76101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76103         return ret_ref;
76104 }
76105
76106 int64_t  CS_LDK_RawBolt11Invoice_description(int64_t this_arg) {
76107         LDKRawBolt11Invoice this_arg_conv;
76108         this_arg_conv.inner = untag_ptr(this_arg);
76109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76111         this_arg_conv.is_owned = false;
76112         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
76113         int64_t ret_ref = 0;
76114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76116         return ret_ref;
76117 }
76118
76119 int64_t  CS_LDK_RawBolt11Invoice_payee_pub_key(int64_t this_arg) {
76120         LDKRawBolt11Invoice this_arg_conv;
76121         this_arg_conv.inner = untag_ptr(this_arg);
76122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76124         this_arg_conv.is_owned = false;
76125         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
76126         int64_t ret_ref = 0;
76127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76129         return ret_ref;
76130 }
76131
76132 int64_t  CS_LDK_RawBolt11Invoice_description_hash(int64_t this_arg) {
76133         LDKRawBolt11Invoice this_arg_conv;
76134         this_arg_conv.inner = untag_ptr(this_arg);
76135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76137         this_arg_conv.is_owned = false;
76138         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
76139         int64_t ret_ref = 0;
76140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76142         return ret_ref;
76143 }
76144
76145 int64_t  CS_LDK_RawBolt11Invoice_expiry_time(int64_t this_arg) {
76146         LDKRawBolt11Invoice this_arg_conv;
76147         this_arg_conv.inner = untag_ptr(this_arg);
76148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76150         this_arg_conv.is_owned = false;
76151         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
76152         int64_t ret_ref = 0;
76153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76155         return ret_ref;
76156 }
76157
76158 int64_t  CS_LDK_RawBolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
76159         LDKRawBolt11Invoice this_arg_conv;
76160         this_arg_conv.inner = untag_ptr(this_arg);
76161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76163         this_arg_conv.is_owned = false;
76164         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
76165         int64_t ret_ref = 0;
76166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76168         return ret_ref;
76169 }
76170
76171 int64_t  CS_LDK_RawBolt11Invoice_payment_secret(int64_t this_arg) {
76172         LDKRawBolt11Invoice this_arg_conv;
76173         this_arg_conv.inner = untag_ptr(this_arg);
76174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76176         this_arg_conv.is_owned = false;
76177         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
76178         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
76179         int64_t ret_ref = tag_ptr(ret_copy, true);
76180         return ret_ref;
76181 }
76182
76183 int64_t  CS_LDK_RawBolt11Invoice_payment_metadata(int64_t this_arg) {
76184         LDKRawBolt11Invoice this_arg_conv;
76185         this_arg_conv.inner = untag_ptr(this_arg);
76186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76188         this_arg_conv.is_owned = false;
76189         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
76190         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
76191         int64_t ret_ref = tag_ptr(ret_copy, true);
76192         return ret_ref;
76193 }
76194
76195 int64_t  CS_LDK_RawBolt11Invoice_features(int64_t this_arg) {
76196         LDKRawBolt11Invoice this_arg_conv;
76197         this_arg_conv.inner = untag_ptr(this_arg);
76198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76200         this_arg_conv.is_owned = false;
76201         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
76202         int64_t ret_ref = 0;
76203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76205         return ret_ref;
76206 }
76207
76208 int64_tArray  CS_LDK_RawBolt11Invoice_private_routes(int64_t this_arg) {
76209         LDKRawBolt11Invoice this_arg_conv;
76210         this_arg_conv.inner = untag_ptr(this_arg);
76211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76213         this_arg_conv.is_owned = false;
76214         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
76215         int64_tArray ret_arr = NULL;
76216         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
76217         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
76218         for (size_t o = 0; o < ret_var.datalen; o++) {
76219                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
76220                 int64_t ret_conv_14_ref = 0;
76221                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
76222                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
76223                 ret_arr_ptr[o] = ret_conv_14_ref;
76224         }
76225         
76226         FREE(ret_var.data);
76227         return ret_arr;
76228 }
76229
76230 int64_t  CS_LDK_RawBolt11Invoice_amount_pico_btc(int64_t this_arg) {
76231         LDKRawBolt11Invoice this_arg_conv;
76232         this_arg_conv.inner = untag_ptr(this_arg);
76233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76235         this_arg_conv.is_owned = false;
76236         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76237         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
76238         int64_t ret_ref = tag_ptr(ret_copy, true);
76239         return ret_ref;
76240 }
76241
76242 int32_t  CS_LDK_RawBolt11Invoice_currency(int64_t this_arg) {
76243         LDKRawBolt11Invoice this_arg_conv;
76244         this_arg_conv.inner = untag_ptr(this_arg);
76245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76247         this_arg_conv.is_owned = false;
76248         int32_t ret_conv = LDKCurrency_to_cs(RawBolt11Invoice_currency(&this_arg_conv));
76249         return ret_conv;
76250 }
76251
76252 int64_t  CS_LDK_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
76253         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
76254         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
76255         return tag_ptr(ret_conv, true);
76256 }
76257
76258 int64_t  CS_LDK_PositiveTimestamp_from_system_time(int64_t time) {
76259         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
76260         *ret_conv = PositiveTimestamp_from_system_time(time);
76261         return tag_ptr(ret_conv, true);
76262 }
76263
76264 int64_t  CS_LDK_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
76265         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
76266         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
76267         return tag_ptr(ret_conv, true);
76268 }
76269
76270 int64_t  CS_LDK_PositiveTimestamp_as_unix_timestamp(int64_t this_arg) {
76271         LDKPositiveTimestamp this_arg_conv;
76272         this_arg_conv.inner = untag_ptr(this_arg);
76273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76275         this_arg_conv.is_owned = false;
76276         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
76277         return ret_conv;
76278 }
76279
76280 int64_t  CS_LDK_PositiveTimestamp_as_duration_since_epoch(int64_t this_arg) {
76281         LDKPositiveTimestamp this_arg_conv;
76282         this_arg_conv.inner = untag_ptr(this_arg);
76283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76285         this_arg_conv.is_owned = false;
76286         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
76287         return ret_conv;
76288 }
76289
76290 int64_t  CS_LDK_PositiveTimestamp_as_time(int64_t this_arg) {
76291         LDKPositiveTimestamp this_arg_conv;
76292         this_arg_conv.inner = untag_ptr(this_arg);
76293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76295         this_arg_conv.is_owned = false;
76296         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
76297         return ret_conv;
76298 }
76299
76300 int8_tArray  CS_LDK_Bolt11Invoice_signable_hash(int64_t this_arg) {
76301         LDKBolt11Invoice this_arg_conv;
76302         this_arg_conv.inner = untag_ptr(this_arg);
76303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76305         this_arg_conv.is_owned = false;
76306         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76307         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
76308         return ret_arr;
76309 }
76310
76311 int64_t  CS_LDK_Bolt11Invoice_into_signed_raw(int64_t this_arg) {
76312         LDKBolt11Invoice this_arg_conv;
76313         this_arg_conv.inner = untag_ptr(this_arg);
76314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76316         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
76317         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
76318         int64_t ret_ref = 0;
76319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76321         return ret_ref;
76322 }
76323
76324 int64_t  CS_LDK_Bolt11Invoice_check_signature(int64_t this_arg) {
76325         LDKBolt11Invoice this_arg_conv;
76326         this_arg_conv.inner = untag_ptr(this_arg);
76327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76329         this_arg_conv.is_owned = false;
76330         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
76331         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
76332         return tag_ptr(ret_conv, true);
76333 }
76334
76335 int64_t  CS_LDK_Bolt11Invoice_from_signed(int64_t signed_invoice) {
76336         LDKSignedRawBolt11Invoice signed_invoice_conv;
76337         signed_invoice_conv.inner = untag_ptr(signed_invoice);
76338         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
76339         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
76340         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
76341         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
76342         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
76343         return tag_ptr(ret_conv, true);
76344 }
76345
76346 int64_t  CS_LDK_Bolt11Invoice_timestamp(int64_t this_arg) {
76347         LDKBolt11Invoice this_arg_conv;
76348         this_arg_conv.inner = untag_ptr(this_arg);
76349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76351         this_arg_conv.is_owned = false;
76352         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
76353         return ret_conv;
76354 }
76355
76356 int64_t  CS_LDK_Bolt11Invoice_duration_since_epoch(int64_t this_arg) {
76357         LDKBolt11Invoice this_arg_conv;
76358         this_arg_conv.inner = untag_ptr(this_arg);
76359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76361         this_arg_conv.is_owned = false;
76362         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
76363         return ret_conv;
76364 }
76365
76366 int8_tArray  CS_LDK_Bolt11Invoice_payment_hash(int64_t this_arg) {
76367         LDKBolt11Invoice this_arg_conv;
76368         this_arg_conv.inner = untag_ptr(this_arg);
76369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76371         this_arg_conv.is_owned = false;
76372         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76373         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
76374         return ret_arr;
76375 }
76376
76377 int8_tArray  CS_LDK_Bolt11Invoice_payee_pub_key(int64_t this_arg) {
76378         LDKBolt11Invoice this_arg_conv;
76379         this_arg_conv.inner = untag_ptr(this_arg);
76380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76382         this_arg_conv.is_owned = false;
76383         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76384         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
76385         return ret_arr;
76386 }
76387
76388 int8_tArray  CS_LDK_Bolt11Invoice_payment_secret(int64_t this_arg) {
76389         LDKBolt11Invoice this_arg_conv;
76390         this_arg_conv.inner = untag_ptr(this_arg);
76391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76393         this_arg_conv.is_owned = false;
76394         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76395         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
76396         return ret_arr;
76397 }
76398
76399 int64_t  CS_LDK_Bolt11Invoice_payment_metadata(int64_t this_arg) {
76400         LDKBolt11Invoice this_arg_conv;
76401         this_arg_conv.inner = untag_ptr(this_arg);
76402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76404         this_arg_conv.is_owned = false;
76405         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
76406         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
76407         int64_t ret_ref = tag_ptr(ret_copy, true);
76408         return ret_ref;
76409 }
76410
76411 int64_t  CS_LDK_Bolt11Invoice_features(int64_t this_arg) {
76412         LDKBolt11Invoice this_arg_conv;
76413         this_arg_conv.inner = untag_ptr(this_arg);
76414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76416         this_arg_conv.is_owned = false;
76417         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
76418         int64_t ret_ref = 0;
76419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76421         return ret_ref;
76422 }
76423
76424 int8_tArray  CS_LDK_Bolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
76425         LDKBolt11Invoice this_arg_conv;
76426         this_arg_conv.inner = untag_ptr(this_arg);
76427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76429         this_arg_conv.is_owned = false;
76430         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76431         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
76432         return ret_arr;
76433 }
76434
76435 int64_t  CS_LDK_Bolt11Invoice_expires_at(int64_t this_arg) {
76436         LDKBolt11Invoice this_arg_conv;
76437         this_arg_conv.inner = untag_ptr(this_arg);
76438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76440         this_arg_conv.is_owned = false;
76441         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76442         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
76443         int64_t ret_ref = tag_ptr(ret_copy, true);
76444         return ret_ref;
76445 }
76446
76447 int64_t  CS_LDK_Bolt11Invoice_expiry_time(int64_t this_arg) {
76448         LDKBolt11Invoice this_arg_conv;
76449         this_arg_conv.inner = untag_ptr(this_arg);
76450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76452         this_arg_conv.is_owned = false;
76453         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
76454         return ret_conv;
76455 }
76456
76457 jboolean  CS_LDK_Bolt11Invoice_is_expired(int64_t this_arg) {
76458         LDKBolt11Invoice this_arg_conv;
76459         this_arg_conv.inner = untag_ptr(this_arg);
76460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76462         this_arg_conv.is_owned = false;
76463         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
76464         return ret_conv;
76465 }
76466
76467 int64_t  CS_LDK_Bolt11Invoice_duration_until_expiry(int64_t this_arg) {
76468         LDKBolt11Invoice this_arg_conv;
76469         this_arg_conv.inner = untag_ptr(this_arg);
76470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76472         this_arg_conv.is_owned = false;
76473         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
76474         return ret_conv;
76475 }
76476
76477 int64_t  CS_LDK_Bolt11Invoice_expiration_remaining_from_epoch(int64_t this_arg, int64_t time) {
76478         LDKBolt11Invoice this_arg_conv;
76479         this_arg_conv.inner = untag_ptr(this_arg);
76480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76482         this_arg_conv.is_owned = false;
76483         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
76484         return ret_conv;
76485 }
76486
76487 jboolean  CS_LDK_Bolt11Invoice_would_expire(int64_t this_arg, int64_t at_time) {
76488         LDKBolt11Invoice this_arg_conv;
76489         this_arg_conv.inner = untag_ptr(this_arg);
76490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76492         this_arg_conv.is_owned = false;
76493         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
76494         return ret_conv;
76495 }
76496
76497 int64_t  CS_LDK_Bolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
76498         LDKBolt11Invoice this_arg_conv;
76499         this_arg_conv.inner = untag_ptr(this_arg);
76500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76502         this_arg_conv.is_owned = false;
76503         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
76504         return ret_conv;
76505 }
76506
76507 ptrArray  CS_LDK_Bolt11Invoice_fallback_addresses(int64_t this_arg) {
76508         LDKBolt11Invoice this_arg_conv;
76509         this_arg_conv.inner = untag_ptr(this_arg);
76510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76512         this_arg_conv.is_owned = false;
76513         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
76514         ptrArray ret_arr = NULL;
76515         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
76516         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
76517         for (size_t i = 0; i < ret_var.datalen; i++) {
76518                 LDKStr ret_conv_8_str = ret_var.data[i];
76519                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
76520                 Str_free(ret_conv_8_str);
76521                 ret_arr_ptr[i] = ret_conv_8_conv;
76522         }
76523         
76524         FREE(ret_var.data);
76525         return ret_arr;
76526 }
76527
76528 int64_tArray  CS_LDK_Bolt11Invoice_private_routes(int64_t this_arg) {
76529         LDKBolt11Invoice this_arg_conv;
76530         this_arg_conv.inner = untag_ptr(this_arg);
76531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76533         this_arg_conv.is_owned = false;
76534         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
76535         int64_tArray ret_arr = NULL;
76536         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
76537         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
76538         for (size_t o = 0; o < ret_var.datalen; o++) {
76539                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
76540                 int64_t ret_conv_14_ref = 0;
76541                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
76542                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
76543                 ret_arr_ptr[o] = ret_conv_14_ref;
76544         }
76545         
76546         FREE(ret_var.data);
76547         return ret_arr;
76548 }
76549
76550 int64_tArray  CS_LDK_Bolt11Invoice_route_hints(int64_t this_arg) {
76551         LDKBolt11Invoice this_arg_conv;
76552         this_arg_conv.inner = untag_ptr(this_arg);
76553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76555         this_arg_conv.is_owned = false;
76556         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
76557         int64_tArray ret_arr = NULL;
76558         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
76559         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
76560         for (size_t l = 0; l < ret_var.datalen; l++) {
76561                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
76562                 int64_t ret_conv_11_ref = 0;
76563                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
76564                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
76565                 ret_arr_ptr[l] = ret_conv_11_ref;
76566         }
76567         
76568         FREE(ret_var.data);
76569         return ret_arr;
76570 }
76571
76572 int32_t  CS_LDK_Bolt11Invoice_currency(int64_t this_arg) {
76573         LDKBolt11Invoice this_arg_conv;
76574         this_arg_conv.inner = untag_ptr(this_arg);
76575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76577         this_arg_conv.is_owned = false;
76578         int32_t ret_conv = LDKCurrency_to_cs(Bolt11Invoice_currency(&this_arg_conv));
76579         return ret_conv;
76580 }
76581
76582 int64_t  CS_LDK_Bolt11Invoice_amount_milli_satoshis(int64_t this_arg) {
76583         LDKBolt11Invoice this_arg_conv;
76584         this_arg_conv.inner = untag_ptr(this_arg);
76585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76587         this_arg_conv.is_owned = false;
76588         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76589         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
76590         int64_t ret_ref = tag_ptr(ret_copy, true);
76591         return ret_ref;
76592 }
76593
76594 int64_t  CS_LDK_Description_new(jstring description) {
76595         LDKStr description_conv = str_ref_to_owned_c(description);
76596         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
76597         *ret_conv = Description_new(description_conv);
76598         return tag_ptr(ret_conv, true);
76599 }
76600
76601 int64_t  CS_LDK_Description_into_inner(int64_t this_arg) {
76602         LDKDescription this_arg_conv;
76603         this_arg_conv.inner = untag_ptr(this_arg);
76604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76606         this_arg_conv = Description_clone(&this_arg_conv);
76607         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
76608         int64_t ret_ref = 0;
76609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76611         return ret_ref;
76612 }
76613
76614 jstring  CS_LDK_Description_to_str(int64_t o) {
76615         LDKDescription o_conv;
76616         o_conv.inner = untag_ptr(o);
76617         o_conv.is_owned = ptr_is_owned(o);
76618         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76619         o_conv.is_owned = false;
76620         LDKStr ret_str = Description_to_str(&o_conv);
76621         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76622         Str_free(ret_str);
76623         return ret_conv;
76624 }
76625
76626 int64_t  CS_LDK_ExpiryTime_from_seconds(int64_t seconds) {
76627         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
76628         int64_t ret_ref = 0;
76629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76631         return ret_ref;
76632 }
76633
76634 int64_t  CS_LDK_ExpiryTime_from_duration(int64_t duration) {
76635         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
76636         int64_t ret_ref = 0;
76637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76639         return ret_ref;
76640 }
76641
76642 int64_t  CS_LDK_ExpiryTime_as_seconds(int64_t this_arg) {
76643         LDKExpiryTime this_arg_conv;
76644         this_arg_conv.inner = untag_ptr(this_arg);
76645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76647         this_arg_conv.is_owned = false;
76648         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
76649         return ret_conv;
76650 }
76651
76652 int64_t  CS_LDK_ExpiryTime_as_duration(int64_t this_arg) {
76653         LDKExpiryTime this_arg_conv;
76654         this_arg_conv.inner = untag_ptr(this_arg);
76655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76657         this_arg_conv.is_owned = false;
76658         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
76659         return ret_conv;
76660 }
76661
76662 int64_t  CS_LDK_PrivateRoute_new(int64_t hops) {
76663         LDKRouteHint hops_conv;
76664         hops_conv.inner = untag_ptr(hops);
76665         hops_conv.is_owned = ptr_is_owned(hops);
76666         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
76667         hops_conv = RouteHint_clone(&hops_conv);
76668         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
76669         *ret_conv = PrivateRoute_new(hops_conv);
76670         return tag_ptr(ret_conv, true);
76671 }
76672
76673 int64_t  CS_LDK_PrivateRoute_into_inner(int64_t this_arg) {
76674         LDKPrivateRoute this_arg_conv;
76675         this_arg_conv.inner = untag_ptr(this_arg);
76676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76678         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
76679         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
76680         int64_t ret_ref = 0;
76681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76683         return ret_ref;
76684 }
76685
76686 int32_t  CS_LDK_CreationError_clone(int64_t orig) {
76687         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
76688         int32_t ret_conv = LDKCreationError_to_cs(CreationError_clone(orig_conv));
76689         return ret_conv;
76690 }
76691
76692 int32_t  CS_LDK_CreationError_description_too_long() {
76693         int32_t ret_conv = LDKCreationError_to_cs(CreationError_description_too_long());
76694         return ret_conv;
76695 }
76696
76697 int32_t  CS_LDK_CreationError_route_too_long() {
76698         int32_t ret_conv = LDKCreationError_to_cs(CreationError_route_too_long());
76699         return ret_conv;
76700 }
76701
76702 int32_t  CS_LDK_CreationError_timestamp_out_of_bounds() {
76703         int32_t ret_conv = LDKCreationError_to_cs(CreationError_timestamp_out_of_bounds());
76704         return ret_conv;
76705 }
76706
76707 int32_t  CS_LDK_CreationError_invalid_amount() {
76708         int32_t ret_conv = LDKCreationError_to_cs(CreationError_invalid_amount());
76709         return ret_conv;
76710 }
76711
76712 int32_t  CS_LDK_CreationError_missing_route_hints() {
76713         int32_t ret_conv = LDKCreationError_to_cs(CreationError_missing_route_hints());
76714         return ret_conv;
76715 }
76716
76717 int32_t  CS_LDK_CreationError_min_final_cltv_expiry_delta_too_short() {
76718         int32_t ret_conv = LDKCreationError_to_cs(CreationError_min_final_cltv_expiry_delta_too_short());
76719         return ret_conv;
76720 }
76721
76722 jboolean  CS_LDK_CreationError_eq(int64_t a, int64_t b) {
76723         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
76724         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
76725         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
76726         return ret_conv;
76727 }
76728
76729 jstring  CS_LDK_CreationError_to_str(int64_t o) {
76730         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
76731         LDKStr ret_str = CreationError_to_str(o_conv);
76732         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76733         Str_free(ret_str);
76734         return ret_conv;
76735 }
76736
76737 int32_t  CS_LDK_Bolt11SemanticError_clone(int64_t orig) {
76738         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
76739         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_clone(orig_conv));
76740         return ret_conv;
76741 }
76742
76743 int32_t  CS_LDK_Bolt11SemanticError_no_payment_hash() {
76744         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_hash());
76745         return ret_conv;
76746 }
76747
76748 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_hashes() {
76749         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_hashes());
76750         return ret_conv;
76751 }
76752
76753 int32_t  CS_LDK_Bolt11SemanticError_no_description() {
76754         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_description());
76755         return ret_conv;
76756 }
76757
76758 int32_t  CS_LDK_Bolt11SemanticError_multiple_descriptions() {
76759         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_descriptions());
76760         return ret_conv;
76761 }
76762
76763 int32_t  CS_LDK_Bolt11SemanticError_no_payment_secret() {
76764         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_secret());
76765         return ret_conv;
76766 }
76767
76768 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_secrets() {
76769         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_secrets());
76770         return ret_conv;
76771 }
76772
76773 int32_t  CS_LDK_Bolt11SemanticError_invalid_features() {
76774         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_features());
76775         return ret_conv;
76776 }
76777
76778 int32_t  CS_LDK_Bolt11SemanticError_invalid_recovery_id() {
76779         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_recovery_id());
76780         return ret_conv;
76781 }
76782
76783 int32_t  CS_LDK_Bolt11SemanticError_invalid_signature() {
76784         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_signature());
76785         return ret_conv;
76786 }
76787
76788 int32_t  CS_LDK_Bolt11SemanticError_imprecise_amount() {
76789         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_imprecise_amount());
76790         return ret_conv;
76791 }
76792
76793 jboolean  CS_LDK_Bolt11SemanticError_eq(int64_t a, int64_t b) {
76794         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
76795         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
76796         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
76797         return ret_conv;
76798 }
76799
76800 jstring  CS_LDK_Bolt11SemanticError_to_str(int64_t o) {
76801         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
76802         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
76803         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76804         Str_free(ret_str);
76805         return ret_conv;
76806 }
76807
76808 void  CS_LDK_SignOrCreationError_free(int64_t this_ptr) {
76809         if (!ptr_is_owned(this_ptr)) return;
76810         void* this_ptr_ptr = untag_ptr(this_ptr);
76811         CHECK_ACCESS(this_ptr_ptr);
76812         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
76813         FREE(untag_ptr(this_ptr));
76814         SignOrCreationError_free(this_ptr_conv);
76815 }
76816
76817 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
76818         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76819         *ret_copy = SignOrCreationError_clone(arg);
76820         int64_t ret_ref = tag_ptr(ret_copy, true);
76821         return ret_ref;
76822 }
76823 int64_t  CS_LDK_SignOrCreationError_clone_ptr(int64_t arg) {
76824         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
76825         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
76826         return ret_conv;
76827 }
76828
76829 int64_t  CS_LDK_SignOrCreationError_clone(int64_t orig) {
76830         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
76831         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76832         *ret_copy = SignOrCreationError_clone(orig_conv);
76833         int64_t ret_ref = tag_ptr(ret_copy, true);
76834         return ret_ref;
76835 }
76836
76837 int64_t  CS_LDK_SignOrCreationError_sign_error() {
76838         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76839         *ret_copy = SignOrCreationError_sign_error();
76840         int64_t ret_ref = tag_ptr(ret_copy, true);
76841         return ret_ref;
76842 }
76843
76844 int64_t  CS_LDK_SignOrCreationError_creation_error(int32_t a) {
76845         LDKCreationError a_conv = LDKCreationError_from_cs(a);
76846         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76847         *ret_copy = SignOrCreationError_creation_error(a_conv);
76848         int64_t ret_ref = tag_ptr(ret_copy, true);
76849         return ret_ref;
76850 }
76851
76852 jboolean  CS_LDK_SignOrCreationError_eq(int64_t a, int64_t b) {
76853         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
76854         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
76855         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
76856         return ret_conv;
76857 }
76858
76859 jstring  CS_LDK_SignOrCreationError_to_str(int64_t o) {
76860         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
76861         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
76862         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76863         Str_free(ret_str);
76864         return ret_conv;
76865 }
76866
76867 int64_t  CS_LDK_payment_parameters_from_zero_amount_invoice(int64_t invoice, int64_t amount_msat) {
76868         LDKBolt11Invoice invoice_conv;
76869         invoice_conv.inner = untag_ptr(invoice);
76870         invoice_conv.is_owned = ptr_is_owned(invoice);
76871         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76872         invoice_conv.is_owned = false;
76873         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76874         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
76875         return tag_ptr(ret_conv, true);
76876 }
76877
76878 int64_t  CS_LDK_payment_parameters_from_invoice(int64_t invoice) {
76879         LDKBolt11Invoice invoice_conv;
76880         invoice_conv.inner = untag_ptr(invoice);
76881         invoice_conv.is_owned = ptr_is_owned(invoice);
76882         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76883         invoice_conv.is_owned = false;
76884         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76885         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
76886         return tag_ptr(ret_conv, true);
76887 }
76888
76889 int64_t  CS_LDK_create_phantom_invoice(int64_t amt_msat, int64_t payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, int32_t network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
76890         void* amt_msat_ptr = untag_ptr(amt_msat);
76891         CHECK_ACCESS(amt_msat_ptr);
76892         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76893         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76894         void* payment_hash_ptr = untag_ptr(payment_hash);
76895         CHECK_ACCESS(payment_hash_ptr);
76896         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76897         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76898         LDKStr description_conv = str_ref_to_owned_c(description);
76899         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76900         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76901         if (phantom_route_hints_constr.datalen > 0)
76902                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76903         else
76904                 phantom_route_hints_constr.data = NULL;
76905         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76906         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76907                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76908                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76909                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76910                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76911                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76912                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76913                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76914         }
76915         FREE(phantom_route_hints);
76916         void* entropy_source_ptr = untag_ptr(entropy_source);
76917         CHECK_ACCESS(entropy_source_ptr);
76918         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76919         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76920                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76921                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76922         }
76923         void* node_signer_ptr = untag_ptr(node_signer);
76924         CHECK_ACCESS(node_signer_ptr);
76925         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76926         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76927                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76928                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76929         }
76930         void* logger_ptr = untag_ptr(logger);
76931         CHECK_ACCESS(logger_ptr);
76932         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76933         if (logger_conv.free == LDKLogger_JCalls_free) {
76934                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76935                 LDKLogger_JCalls_cloned(&logger_conv);
76936         }
76937         LDKCurrency network_conv = LDKCurrency_from_cs(network);
76938         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76939         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76940         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76941         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76942         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76943         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_conv, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
76944         return tag_ptr(ret_conv, true);
76945 }
76946
76947 int64_t  CS_LDK_create_phantom_invoice_with_description_hash(int64_t amt_msat, int64_t payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, int32_t network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
76948         void* amt_msat_ptr = untag_ptr(amt_msat);
76949         CHECK_ACCESS(amt_msat_ptr);
76950         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76951         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76952         void* payment_hash_ptr = untag_ptr(payment_hash);
76953         CHECK_ACCESS(payment_hash_ptr);
76954         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76955         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76956         LDKSha256 description_hash_conv;
76957         description_hash_conv.inner = untag_ptr(description_hash);
76958         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76959         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76960         description_hash_conv = Sha256_clone(&description_hash_conv);
76961         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76962         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76963         if (phantom_route_hints_constr.datalen > 0)
76964                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76965         else
76966                 phantom_route_hints_constr.data = NULL;
76967         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76968         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76969                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76970                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76971                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76972                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76973                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76974                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76975                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76976         }
76977         FREE(phantom_route_hints);
76978         void* entropy_source_ptr = untag_ptr(entropy_source);
76979         CHECK_ACCESS(entropy_source_ptr);
76980         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76981         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76982                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76983                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76984         }
76985         void* node_signer_ptr = untag_ptr(node_signer);
76986         CHECK_ACCESS(node_signer_ptr);
76987         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76988         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76989                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76990                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76991         }
76992         void* logger_ptr = untag_ptr(logger);
76993         CHECK_ACCESS(logger_ptr);
76994         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76995         if (logger_conv.free == LDKLogger_JCalls_free) {
76996                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76997                 LDKLogger_JCalls_cloned(&logger_conv);
76998         }
76999         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77000         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77001         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77002         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77003         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77004         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77005         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_conv, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
77006         return tag_ptr(ret_conv, true);
77007 }
77008
77009 int64_t  CS_LDK_create_invoice_from_channelmanager(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
77010         LDKChannelManager channelmanager_conv;
77011         channelmanager_conv.inner = untag_ptr(channelmanager);
77012         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77013         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77014         channelmanager_conv.is_owned = false;
77015         void* node_signer_ptr = untag_ptr(node_signer);
77016         CHECK_ACCESS(node_signer_ptr);
77017         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77018         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77019                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77020                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77021         }
77022         void* logger_ptr = untag_ptr(logger);
77023         CHECK_ACCESS(logger_ptr);
77024         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77025         if (logger_conv.free == LDKLogger_JCalls_free) {
77026                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77027                 LDKLogger_JCalls_cloned(&logger_conv);
77028         }
77029         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77030         void* amt_msat_ptr = untag_ptr(amt_msat);
77031         CHECK_ACCESS(amt_msat_ptr);
77032         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77033         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77034         LDKStr description_conv = str_ref_to_owned_c(description);
77035         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77036         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77037         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77038         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77039         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77040         *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);
77041         return tag_ptr(ret_conv, true);
77042 }
77043
77044 int64_t  CS_LDK_create_invoice_from_channelmanager_with_description_hash(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
77045         LDKChannelManager channelmanager_conv;
77046         channelmanager_conv.inner = untag_ptr(channelmanager);
77047         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77048         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77049         channelmanager_conv.is_owned = false;
77050         void* node_signer_ptr = untag_ptr(node_signer);
77051         CHECK_ACCESS(node_signer_ptr);
77052         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77053         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77054                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77055                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77056         }
77057         void* logger_ptr = untag_ptr(logger);
77058         CHECK_ACCESS(logger_ptr);
77059         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77060         if (logger_conv.free == LDKLogger_JCalls_free) {
77061                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77062                 LDKLogger_JCalls_cloned(&logger_conv);
77063         }
77064         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77065         void* amt_msat_ptr = untag_ptr(amt_msat);
77066         CHECK_ACCESS(amt_msat_ptr);
77067         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77068         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77069         LDKSha256 description_hash_conv;
77070         description_hash_conv.inner = untag_ptr(description_hash);
77071         description_hash_conv.is_owned = ptr_is_owned(description_hash);
77072         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
77073         description_hash_conv = Sha256_clone(&description_hash_conv);
77074         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77075         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77076         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77077         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77078         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77079         *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);
77080         return tag_ptr(ret_conv, true);
77081 }
77082
77083 int64_t  CS_LDK_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t 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) {
77084         LDKChannelManager channelmanager_conv;
77085         channelmanager_conv.inner = untag_ptr(channelmanager);
77086         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77087         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77088         channelmanager_conv.is_owned = false;
77089         void* node_signer_ptr = untag_ptr(node_signer);
77090         CHECK_ACCESS(node_signer_ptr);
77091         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77092         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77093                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77094                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77095         }
77096         void* logger_ptr = untag_ptr(logger);
77097         CHECK_ACCESS(logger_ptr);
77098         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77099         if (logger_conv.free == LDKLogger_JCalls_free) {
77100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77101                 LDKLogger_JCalls_cloned(&logger_conv);
77102         }
77103         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77104         void* amt_msat_ptr = untag_ptr(amt_msat);
77105         CHECK_ACCESS(amt_msat_ptr);
77106         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77107         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77108         LDKSha256 description_hash_conv;
77109         description_hash_conv.inner = untag_ptr(description_hash);
77110         description_hash_conv.is_owned = ptr_is_owned(description_hash);
77111         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
77112         description_hash_conv = Sha256_clone(&description_hash_conv);
77113         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77114         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77115         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77116         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77117         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77118         *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);
77119         return tag_ptr(ret_conv, true);
77120 }
77121
77122 int64_t  CS_LDK_create_invoice_from_channelmanager_and_duration_since_epoch(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t 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) {
77123         LDKChannelManager channelmanager_conv;
77124         channelmanager_conv.inner = untag_ptr(channelmanager);
77125         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77126         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77127         channelmanager_conv.is_owned = false;
77128         void* node_signer_ptr = untag_ptr(node_signer);
77129         CHECK_ACCESS(node_signer_ptr);
77130         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77131         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77132                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77133                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77134         }
77135         void* logger_ptr = untag_ptr(logger);
77136         CHECK_ACCESS(logger_ptr);
77137         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77138         if (logger_conv.free == LDKLogger_JCalls_free) {
77139                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77140                 LDKLogger_JCalls_cloned(&logger_conv);
77141         }
77142         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77143         void* amt_msat_ptr = untag_ptr(amt_msat);
77144         CHECK_ACCESS(amt_msat_ptr);
77145         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77146         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77147         LDKStr description_conv = str_ref_to_owned_c(description);
77148         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77149         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77150         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77151         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77152         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77153         *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);
77154         return tag_ptr(ret_conv, true);
77155 }
77156
77157 int64_t  CS_LDK_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t 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) {
77158         LDKChannelManager channelmanager_conv;
77159         channelmanager_conv.inner = untag_ptr(channelmanager);
77160         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77161         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77162         channelmanager_conv.is_owned = false;
77163         void* node_signer_ptr = untag_ptr(node_signer);
77164         CHECK_ACCESS(node_signer_ptr);
77165         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77166         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77167                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77168                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77169         }
77170         void* logger_ptr = untag_ptr(logger);
77171         CHECK_ACCESS(logger_ptr);
77172         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77173         if (logger_conv.free == LDKLogger_JCalls_free) {
77174                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77175                 LDKLogger_JCalls_cloned(&logger_conv);
77176         }
77177         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77178         void* amt_msat_ptr = untag_ptr(amt_msat);
77179         CHECK_ACCESS(amt_msat_ptr);
77180         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77181         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77182         LDKStr description_conv = str_ref_to_owned_c(description);
77183         LDKThirtyTwoBytes payment_hash_ref;
77184         CHECK(payment_hash->arr_len == 32);
77185         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
77186         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77187         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77188         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77189         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77190         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77191         *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);
77192         return tag_ptr(ret_conv, true);
77193 }
77194
77195 int64_t  CS_LDK_SiPrefix_from_str(jstring s) {
77196         LDKStr s_conv = str_ref_to_owned_c(s);
77197         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
77198         *ret_conv = SiPrefix_from_str(s_conv);
77199         return tag_ptr(ret_conv, true);
77200 }
77201
77202 int64_t  CS_LDK_Bolt11Invoice_from_str(jstring s) {
77203         LDKStr s_conv = str_ref_to_owned_c(s);
77204         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
77205         *ret_conv = Bolt11Invoice_from_str(s_conv);
77206         return tag_ptr(ret_conv, true);
77207 }
77208
77209 int64_t  CS_LDK_SignedRawBolt11Invoice_from_str(jstring s) {
77210         LDKStr s_conv = str_ref_to_owned_c(s);
77211         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
77212         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
77213         return tag_ptr(ret_conv, true);
77214 }
77215
77216 jstring  CS_LDK_Bolt11ParseError_to_str(int64_t o) {
77217         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
77218         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
77219         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77220         Str_free(ret_str);
77221         return ret_conv;
77222 }
77223
77224 jstring  CS_LDK_ParseOrSemanticError_to_str(int64_t o) {
77225         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
77226         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
77227         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77228         Str_free(ret_str);
77229         return ret_conv;
77230 }
77231
77232 jstring  CS_LDK_Bolt11Invoice_to_str(int64_t o) {
77233         LDKBolt11Invoice o_conv;
77234         o_conv.inner = untag_ptr(o);
77235         o_conv.is_owned = ptr_is_owned(o);
77236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77237         o_conv.is_owned = false;
77238         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
77239         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77240         Str_free(ret_str);
77241         return ret_conv;
77242 }
77243
77244 jstring  CS_LDK_SignedRawBolt11Invoice_to_str(int64_t o) {
77245         LDKSignedRawBolt11Invoice o_conv;
77246         o_conv.inner = untag_ptr(o);
77247         o_conv.is_owned = ptr_is_owned(o);
77248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77249         o_conv.is_owned = false;
77250         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
77251         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77252         Str_free(ret_str);
77253         return ret_conv;
77254 }
77255
77256 jstring  CS_LDK_Currency_to_str(int64_t o) {
77257         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
77258         LDKStr ret_str = Currency_to_str(o_conv);
77259         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77260         Str_free(ret_str);
77261         return ret_conv;
77262 }
77263
77264 jstring  CS_LDK_SiPrefix_to_str(int64_t o) {
77265         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
77266         LDKStr ret_str = SiPrefix_to_str(o_conv);
77267         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77268         Str_free(ret_str);
77269         return ret_conv;
77270 }
77271
77272 void  CS_LDK_GraphSyncError_free(int64_t this_ptr) {
77273         if (!ptr_is_owned(this_ptr)) return;
77274         void* this_ptr_ptr = untag_ptr(this_ptr);
77275         CHECK_ACCESS(this_ptr_ptr);
77276         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
77277         FREE(untag_ptr(this_ptr));
77278         GraphSyncError_free(this_ptr_conv);
77279 }
77280
77281 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
77282         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77283         *ret_copy = GraphSyncError_clone(arg);
77284         int64_t ret_ref = tag_ptr(ret_copy, true);
77285         return ret_ref;
77286 }
77287 int64_t  CS_LDK_GraphSyncError_clone_ptr(int64_t arg) {
77288         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
77289         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
77290         return ret_conv;
77291 }
77292
77293 int64_t  CS_LDK_GraphSyncError_clone(int64_t orig) {
77294         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
77295         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77296         *ret_copy = GraphSyncError_clone(orig_conv);
77297         int64_t ret_ref = tag_ptr(ret_copy, true);
77298         return ret_ref;
77299 }
77300
77301 int64_t  CS_LDK_GraphSyncError_decode_error(int64_t a) {
77302         void* a_ptr = untag_ptr(a);
77303         CHECK_ACCESS(a_ptr);
77304         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
77305         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
77306         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77307         *ret_copy = GraphSyncError_decode_error(a_conv);
77308         int64_t ret_ref = tag_ptr(ret_copy, true);
77309         return ret_ref;
77310 }
77311
77312 int64_t  CS_LDK_GraphSyncError_lightning_error(int64_t a) {
77313         LDKLightningError a_conv;
77314         a_conv.inner = untag_ptr(a);
77315         a_conv.is_owned = ptr_is_owned(a);
77316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77317         a_conv = LightningError_clone(&a_conv);
77318         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77319         *ret_copy = GraphSyncError_lightning_error(a_conv);
77320         int64_t ret_ref = tag_ptr(ret_copy, true);
77321         return ret_ref;
77322 }
77323
77324 void  CS_LDK_RapidGossipSync_free(int64_t this_obj) {
77325         LDKRapidGossipSync this_obj_conv;
77326         this_obj_conv.inner = untag_ptr(this_obj);
77327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77329         RapidGossipSync_free(this_obj_conv);
77330 }
77331
77332 int64_t  CS_LDK_RapidGossipSync_new(int64_t network_graph, int64_t logger) {
77333         LDKNetworkGraph network_graph_conv;
77334         network_graph_conv.inner = untag_ptr(network_graph);
77335         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77336         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77337         network_graph_conv.is_owned = false;
77338         void* logger_ptr = untag_ptr(logger);
77339         CHECK_ACCESS(logger_ptr);
77340         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77341         if (logger_conv.free == LDKLogger_JCalls_free) {
77342                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77343                 LDKLogger_JCalls_cloned(&logger_conv);
77344         }
77345         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
77346         int64_t ret_ref = 0;
77347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77349         return ret_ref;
77350 }
77351
77352 int64_t  CS_LDK_RapidGossipSync_sync_network_graph_with_file_path(int64_t this_arg, jstring sync_path) {
77353         LDKRapidGossipSync this_arg_conv;
77354         this_arg_conv.inner = untag_ptr(this_arg);
77355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77357         this_arg_conv.is_owned = false;
77358         LDKStr sync_path_conv = str_ref_to_owned_c(sync_path);
77359         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
77360         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
77361         return tag_ptr(ret_conv, true);
77362 }
77363
77364 int64_t  CS_LDK_RapidGossipSync_update_network_graph(int64_t this_arg, int8_tArray update_data) {
77365         LDKRapidGossipSync this_arg_conv;
77366         this_arg_conv.inner = untag_ptr(this_arg);
77367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77369         this_arg_conv.is_owned = false;
77370         LDKu8slice update_data_ref;
77371         update_data_ref.datalen = update_data->arr_len;
77372         update_data_ref.data = update_data->elems;
77373         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
77374         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
77375         FREE(update_data);
77376         return tag_ptr(ret_conv, true);
77377 }
77378
77379 int64_t  CS_LDK_RapidGossipSync_update_network_graph_no_std(int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) {
77380         LDKRapidGossipSync this_arg_conv;
77381         this_arg_conv.inner = untag_ptr(this_arg);
77382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77384         this_arg_conv.is_owned = false;
77385         LDKu8slice update_data_ref;
77386         update_data_ref.datalen = update_data->arr_len;
77387         update_data_ref.data = update_data->elems;
77388         void* current_time_unix_ptr = untag_ptr(current_time_unix);
77389         CHECK_ACCESS(current_time_unix_ptr);
77390         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
77391         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
77392         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
77393         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
77394         FREE(update_data);
77395         return tag_ptr(ret_conv, true);
77396 }
77397
77398 jboolean  CS_LDK_RapidGossipSync_is_initial_sync_complete(int64_t this_arg) {
77399         LDKRapidGossipSync this_arg_conv;
77400         this_arg_conv.inner = untag_ptr(this_arg);
77401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77403         this_arg_conv.is_owned = false;
77404         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
77405         return ret_conv;
77406 }
77407